/* Admin Dashboard Styles */
.admin-container {
    padding: 2rem;
    background-color: var(--background);
    min-height: 100vh;
    box-sizing: border-box;
}

.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    background: var(--card-bg);
    padding: 1.5rem 2rem;
    border-radius: 12px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
}

.admin-title-group h1 {
    margin: 0;
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--foreground);
    letter-spacing: -0.5px;
}

.admin-title-group p {
    margin: 0.5rem 0 0 0;
    color: var(--muted-foreground);
    font-size: 0.9rem;
}

.admin-actions {
    display: flex;
    gap: 1rem;
}

/* Data Table Styles */
.admin-table-container {
    background: var(--card-bg);
    border-radius: 12px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
    overflow-x: auto;
    /* Enable horizontal scroll */
}

.admin-controls {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    gap: 1rem;
    align-items: center;
    flex-wrap: wrap;
}

.search-input {
    flex-grow: 1;
    max-width: 400px;
    padding: 0.75rem 1rem 0.75rem 2.8rem;
    /* Fix: Space for icon */
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--background);
    color: var(--foreground);
    font-size: 0.9rem;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
}

.admin-table th {
    background: var(--secondary);
    color: var(--secondary-foreground);
    font-weight: 600;
    text-align: left;
    padding: 1rem 1.5rem;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    cursor: pointer;
    user-select: none;
}

.admin-table th:hover {
    background: var(--nav-hover);
    color: #000;
}

.admin-table td {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
    vertical-align: middle;
}

.admin-table tr:last-child td {
    border-bottom: none;
}

.admin-table tr:hover td {
    background: var(--card1-bg);
}

/* Status Badges */
.status-badge {
    padding: 0.35em 0.8em;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
}

.status-instock {
    background: #dcfce7;
    color: #166534;
    border: 1px solid #bbf7d0;
}

.status-outstock {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

/* Product Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    padding: 2rem;
}

.modal-content.product-modal {
    width: 100%;
    max-width: 900px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
}

.modal-body.scrollable {
    overflow-y: auto;
    padding: 2rem;
    max-height: calc(90vh - 140px);
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
}

.form-full {
    grid-column: 1 / -1;
}

.image-upload-area {
    border: 2px dashed var(--border-color);
    border-radius: 8px;
    padding: 2rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    background: var(--background);
    display: block;
    width: 100%;
}

.image-upload-area:hover {
    border-color: var(--nav-hover);
    background: var(--card1-bg);
}

.image-preview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.image-preview-card {
    position: relative;
    aspect-ratio: 1;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid var(--border-color);
}

.image-preview-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.remove-image-btn {
    position: absolute;
    top: 4px;
    right: 4px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    border: none;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
}

@media (max-width: 768px) {
    .form-grid {
        grid-template-columns: 1fr;
    }

    .admin-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
}

.create-category-btn {
    font-size: 0.75rem;
    font-weight: 700;
    color: #2563eb;
    display: flex;
    align-items: center;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
}

.create-category-btn:hover {
    background: #eff6ff;
}