/* Import font đẹp hơn */
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;600&display=swap');

/* Reset mặc định */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Poppins', sans-serif;
}

/* Body */
body {
    background: linear-gradient(135deg, #f8f9fa, #e3e6e8);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
}

/* Container */
.container {
    width: 100%;
    max-width: 1200px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    padding: 20px;
}

/* Tiêu đề */
h1 {
    font-size: 28px;
    font-weight: 600;
    color: #333;
    margin-bottom: 20px;
    text-align: center;
}

/* Form nhập chủ đề */
.add-topic form {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

input {
    flex-grow: 1;
    padding: 10px;
    border: 2px solid #bbb;
    border-radius: 5px;
    outline: none;
    font-size: 16px;
}

button {
    padding: 10px 15px;
    background: #007bff;
    color: white;
    border: none;
    cursor: pointer;
    border-radius: 5px;
    font-size: 16px;
    transition: 0.3s;
}

button:hover {
    background: #0056b3;
}

/* Danh sách chủ đề */
.topic-lists h2 {
    font-size: 22px;
    font-weight: bold;
    color: #222;
    margin-bottom: 10px;
}

/* Grid View */
.grid-view {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); /* Tăng minmax */
    grid-template-rows: auto; /* Cho phép hàng tự động điều chỉnh chiều cao */
    gap: 10px;
    max-width: calc(180px * 6 + 50px); /* Giới hạn chiều rộng cho 6 topic */
    margin: 0 auto; /* Căn giữa */
}

/* List View */
.list-view {
    list-style: none;
    padding: 0;
    display: none; /* Hide by default */
}

/* Topic Item */
.topic-item {
    display: flex;
    flex-direction: column; /* Sắp xếp biểu tượng, tên và actions theo chiều dọc */
    align-items: center; /* Căn chỉnh nội dung theo chiều ngang */
    padding: 20px;
    border: 1px solid #ddd;
    border-radius: 8px;
    margin-bottom: 10px;
    background-color: #f9f9f9;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    text-align: center; /* Căn chỉnh text */
    min-height: 100px;
}
.topic-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

.topic-item span.material-icons {
    margin-bottom: 10px;
    font-size: 24px;
}

.topic-item span:not(.material-icons) {
    text-transform: uppercase;
    font-weight: bold;
    margin-bottom: 10px;
}

.topic-item .actions {
    display: none;
    flex-direction: row; /* Sắp xếp actions theo chiều ngang */
    justify-content: center; /* Căn giữa actions */
    margin-top: 10px; /* Thêm margin top */
}

.topic-item:hover .actions {
    display: flex;
}

.topic-item .actions button {
    background: none;
    border: none;
    padding: 5px 10px; /* Thêm padding cho nút */
    cursor: pointer;
}

.topic-item .actions button span.material-icons {
    font-size: 20px;
}

.edit-btn span.material-icons {
    color: #007bff;
}

.delete-btn span.material-icons {
    color: #dc3545;
}

/* View Toggle (Grid/List) */
.view-toggle {
    text-align: right;
    margin-bottom: 10px;
}

#toggle-view-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px 12px;
    background: #6c757d;
    color: white;
    border: none;
    cursor: pointer;
    border-radius: 5px;
    font-size: 14px;
    transition: 0.3s;
}

#toggle-view-btn:hover {
    background: #5a6268;
}
