
.admin-dashboard {
    padding: 20px;
    background-color: #f5f5f5;
    min-height: calc(100vh - 200px);
}

.admin-dashboard h1 {
    color: #333;
    margin-bottom: 30px;
    font-size: 28px;
}

.admin-menu {
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    margin-bottom: 30px;
}

.admin-menu ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
}

.admin-menu ul + ul {
    margin-top: 20px;
}

.admin-menu li a {
    display: block;
    padding: 15px 20px;
    background-color: #007bff;
    color: white;
    text-decoration: none;
    border-radius: 5px;
    transition: background-color 0.3s;
    text-align: center;
    font-weight: 500;
}

.admin-menu li a:hover {
    background-color: #0056b3;
}

.admin-section {
    background: white;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    margin-bottom: 20px;
}

.admin-section h1 {
    color: #333;
    margin-top: 0;
    margin-bottom: 20px;
    font-size: 24px;
    border-bottom: 2px solid #007bff;
    padding-bottom: 10px;
}

.admin-section h2 {
    color: #555;
    margin-top: 20px;
    margin-bottom: 15px;
    font-size: 18px;
}

.database-backup-section {
    margin: 24px 0;
    padding: 20px;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    background: #f8f9fa;
}

.database-backup-section h2 {
    margin-top: 0;
}

.database-backup-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.database-backup-actions .btn {
    margin: 0;
}

.database-restore-form {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.database-restore-form input[type="file"] {
    max-width: 280px;
}

.database-backup-warning {
    margin: 14px 0 0;
    color: #856404;
    font-size: 13px;
}

.media-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 24px;
}

.media-header h1 {
    margin-bottom: 6px;
}

.media-count {
    margin: 0;
    color: #666;
}

.media-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 20px;
}

.media-actions .btn {
    margin: 0;
}

.media-select-all {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-right: auto;
    cursor: pointer;
    font-weight: 600;
}

.media-select-all input,
.media-checkbox input {
    width: 18px;
    height: 18px;
    margin: 0;
    cursor: pointer;
}

.media-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
    gap: 20px;
}

.media-item {
    position: relative;
    min-width: 0;
    padding: 12px;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    background: #fff;
}

.media-checkbox {
    position: absolute;
    top: 20px;
    left: 20px;
    z-index: 1;
    display: flex;
    padding: 5px;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.9);
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.media-item > a {
    display: block;
    aspect-ratio: 1;
    overflow: hidden;
    background: #f3f4f5;
}

.media-item img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.media-item-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin: 12px 0;
}

.media-filename {
    overflow: hidden;
    color: #333;
    font-size: 13px;
    font-weight: 600;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.media-filesize {
    color: #777;
    font-size: 12px;
}

.media-item form,
.media-item .btn {
    width: 100%;
    margin-right: 0;
}

.media-empty {
    padding: 40px 20px;
    border: 1px dashed #cfd4da;
    color: #666;
    text-align: center;
}

.media-picker-preview {
    display: block;
    width: 120px;
    height: 120px;
    margin: 8px 0;
    border: 1px solid #ced4da;
    background: #f3f4f5;
    object-fit: contain;
}

.media-select {
    min-height: 42px;
    padding-left: 48px;
    background-position: 8px center;
    background-repeat: no-repeat;
    background-size: 32px 32px;
}

.media-select-wrap {
    position: relative;
    width: 100%;
    margin: 8px 0;
}

.media-select-button {
    display: flex;
    align-items: center;
    width: 100%;
    min-height: 42px;
    gap: 10px;
    padding: 6px 36px 6px 10px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    background: #fff;
    color: #333;
    cursor: pointer;
    font: inherit;
    text-align: left;
}

.media-select-button::after {
    position: absolute;
    top: 50%;
    right: 14px;
    content: '';
    border: 5px solid transparent;
    border-top-color: #555;
    transform: translateY(-25%);
}

.media-select-button img,
.media-select-option img {
    flex: 0 0 auto;
    width: 32px;
    height: 32px;
    border: 1px solid #ddd;
    background: #f3f4f5;
    object-fit: contain;
}

.media-select-menu {
    position: absolute;
    top: calc(100% + 3px);
    right: 0;
    left: 0;
    z-index: 20;
    max-height: 280px;
    overflow-y: auto;
    border: 1px solid #adb5bd;
    border-radius: 4px;
    background: #fff;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.media-select-option {
    display: flex;
    align-items: center;
    width: 100%;
    min-height: 46px;
    gap: 10px;
    padding: 6px 10px;
    border: 0;
    border-bottom: 1px solid #eee;
    background: #fff;
    color: #333;
    cursor: pointer;
    font: inherit;
    text-align: left;
}

.media-select-option:last-child {
    border-bottom: 0;
}

.media-select-option:hover,
.media-select-option:focus-visible {
    background: #f1f3f5;
}

.attribute-section {
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid #dee2e6;
}

.category-section {
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid #dee2e6;
}

.admin-form {
    max-width: 600px;
    margin: 20px 0;
}

#values-container {
    display: none;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
    background-color: white;
    border: 1px solid #ddd;
    border-radius: 5px;
    overflow: hidden;
}

.admin-table thead {
    background-color: #f8f9fa;
    border-bottom: 2px solid #dee2e6;
}

.admin-table thead th {
    padding: 12px 15px;
    color: #333;
    font-weight: 600;
    text-align: left;
    white-space: nowrap;
}

.admin-table tbody tr {
    border-bottom: 1px solid #dee2e6;
    transition: background-color 0.3s;
}

.admin-table tbody tr:hover {
    background-color: #f9f9f9;
}

.admin-table tbody td {
    padding: 12px 15px;
    color: #666;
}

.admin-table tbody tr:last-child {
    border-bottom: none;
}

.admin-table tbody tr td[colspan] {
    text-align: center;
    color: #999;
    padding: 30px 15px;
}

@media (max-width: 768px) {
    .admin-section {
        padding: 15px;
    }

    .admin-menu ul {
        grid-template-columns: 1fr;
    }

    .admin-table {
        font-size: 13px;
    }

    .admin-table thead th,
    .admin-table tbody td {
        padding: 8px 10px;
    }

}

@media (max-width: 480px) {
    .admin-dashboard,
    .admin-section {
        padding: 10px;
    }

    .admin-table {
        font-size: 12px;
        overflow-x: auto;
        display: block;
    }

    .admin-table thead {
        display: none;
    }

    .admin-table tbody,
    .admin-table tr,
    .admin-table td {
        display: block;
        width: 100%;
    }

    .admin-table tr {
        margin-bottom: 15px;
        border: 1px solid #ddd;
        border-radius: 5px;
    }

    .admin-table td {
        text-align: right;
        padding-left: 50%;
        position: relative;
        border: none;
        border-bottom: 1px solid #eee;
    }

    .admin-table td:before {
        content: attr(data-label);
        position: absolute;
        left: 10px;
        font-weight: 600;
        color: #333;
    }

}


.checkboxes-group {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 15px;
    margin-top: 10px;
    padding: 10px;
    background-color: #f9f9f9;
    border-radius: 5px;
}

.checkbox-item {
    display: flex;
    align-items: center;
}

.checkbox-item input[type="checkbox"] {
    width: auto;
    margin: 0;
    padding: 0;
    border: none;
    cursor: pointer;
    margin-right: 8px;
}

.checkbox-label {
    margin: 0;
    cursor: pointer;
    font-weight: normal;
    user-select: none;
    display: flex;
    align-items: center;
}

.attribute-label {
    display: block;
    margin-bottom: 10px;
    color: #333;
    font-weight: 600;
}

/* ========== Category Filter Styles ========== */

.category-filter {
    margin: 20px 0;
    padding: 20px;
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 5px;
}

.category-filter strong {
    display: block;
    margin-bottom: 15px;
    color: #333;
    font-size: 16px;
}

.category-tree {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.category-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.category-item[data-level="0"] {
    margin-left: 0;
}

.category-item[data-level="1"] {
    margin-left: 30px;
}

.category-item[data-level="2"] {
    margin-left: 60px;
}

.category-item[data-level="3"] {
    margin-left: 90px;
}

.category-toggle {
    width: 24px;
    height: 24px;
    min-width: 24px;
    padding: 0;
    border: none;
    background: none;
    color: #666;
    cursor: pointer;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s, transform 0.2s;
    border-radius: 3px;
}

.category-toggle:hover {
    background-color: #e9ecef;
    color: #333;
}

.category-toggle.collapsed::before {
    content: '▶';
}

.category-toggle.expanded::before {
    content: '▼';
}

.category-toggle.no-children {
    visibility: hidden;
    cursor: default;
}

.category-toggle.no-children:hover {
    background: none;
}

.subcategories {
    display: none;
}

.subcategories.visible {
    display: flex;
    flex-direction: column;
}

.category-item .btn {
    margin: 0;
    white-space: nowrap;
    flex: 0 1 auto;
}

.category-item .btn-sm {
    padding: 6px 12px;
    font-size: 13px;
}

/* ===================================
   BULK ACTIONS & FORMS
=================================== */

.bulk-info-box {
    margin-bottom: 20px;
    padding: 15px;
    background: #f0f7ff;
    border-left: 4px solid #0084ff;
    border-radius: 4px;
}

.bulk-info-box ul {
    margin: 10px 0 0 0;
    padding-left: 20px;
    list-style: disc;
}

.bulk-info-box li {
    color: #333;
    font-size: 14px;
    margin-bottom: 5px;
}


/* ===================================
   PRODUCTS PAGE
=================================== */

.products-toolbar {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
    align-items: center;
}

.products-search-form {
    flex: 1;
    max-width: 300px;
    display: flex;
    gap: 10px;
}

.search-results-info {
    padding: 12px 15px;
    background-color: #e7f3ff;
    border-left: 4px solid #0084ff;
    margin: 15px 0;
    border-radius: 3px;
}

.search-results-count {
    float: right;
    color: #666;
    font-size: 13px;
}

.category-filter-container {
    margin: 20px 0;
}

.bulk-actions-form {
    margin-bottom: 20px;
}

.bulk-actions-panel {
    display: none;
    gap: 10px;
    align-items: center;
    padding: 12px;
    background: #f5f5f5;
    border-radius: 5px;
    animation: slideDown 0.3s ease;
}

.bulk-actions-panel.show {
    display: flex;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.no-results-message {
    padding: 20px;
    text-align: center;
    color: #999;
    background-color: #f9f9f9;
    border-radius: 5px;
    margin: 20px 0;
}

.no-results-message p:first-child {
    font-size: 16px;
    margin: 0;
}

.no-results-message p:last-child {
    font-size: 13px;
    margin: 10px 0 0 0;
}

.category-product-section {
    margin-bottom: 40px;
}

.checkbox-column {
    width: 40px;
}

.checkbox-cell {
    text-align: center;
    width: 40px;
}

.productCheckbox {
    cursor: pointer;
}

.product-row:hover {
    background-color: #f9f9f9;
}

.actions-cell {
    white-space: nowrap;
}

.empty-state {
    text-align: center;
}

/* ===================================
   CATEGORIES PAGE
=================================== */

.status-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
}

.status-active {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.status-inactive {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.child-category {
    padding-left: 40px !important;
}

.category-row:hover {
    background-color: #f9f9f9;
}

.form-checkbox {
    width: auto;
    margin-right: 8px;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
    accent-color: #007bff;
}

.edit-form {
    max-width: 600px;
}

/* Search Results Info Box */
.search-results-box {
    padding: 12px 15px;
    background-color: #e7f3ff;
    border-left: 4px solid #0084ff;
    margin: 15px 0;
    border-radius: 3px;
}

.search-results-box strong {
    display: block;
}

.search-results-count {
    float: right;
    color: #666;
    font-size: 13px;
}

/* Category Level Indentation */
.category-level-0 {
    margin-left: 0;
}

.category-level-1 {
    margin-left: 20px;
}

.category-level-2 {
    margin-left: 40px;
}

.category-level-3 {
    margin-left: 60px;
}

/* Bulk Attributes Flex Container */
.bulk-actions-buttons {
    display: flex;
    gap: 10px;
}

/* Selected Count Badge */
.selected-count {
    font-weight: bold;
    color: #333;
}

@media (max-width: 768px) {
    .admin-dashboard h1 {
        font-size: 24px;
        margin-bottom: 20px;
    }

    .admin-section h1 {
        font-size: 20px;
    }

    .products-toolbar,
    .bulk-actions-panel,
    .bulk-actions-buttons,
    .products-search-form {
        flex-direction: column;
        align-items: stretch;
        max-width: none;
    }

    .products-search-form {
        width: 100%;
    }

    .search-results-count {
        float: none;
        display: block;
        margin-top: 6px;
    }

    .checkboxes-group {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 480px) {
    .admin-menu,
    .admin-section {
        border-radius: 6px;
    }

    .checkboxes-group {
        grid-template-columns: 1fr;
    }

    .category-item {
        flex-wrap: wrap;
        align-items: flex-start;
    }

    .category-item[data-level="1"],
    .category-item[data-level="2"],
    .category-item[data-level="3"] {
        margin-left: 0;
    }

    .category-item .btn {
        width: 100%;
    }
}
