/* ============================================================
   admin.css — Admin Portal Design
   Inspiration: IKEA catalog (bold type + accent colors) 
              + Showroom (deep navy, warm whites, gold accents)
              + AirMenus (image overlays, card-based layout)
   ============================================================ */

/* ── Admin Layout ─────────────────────────────────────────── */
.admin-layout {
    display: flex;
    min-height: 100vh;
    background: var(--bg-page);
}

.admin-sidebar {
    width: 260px;
    background: var(--primary);
    color: white;
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    overflow-y: auto;
    z-index: 40;
    border-right: 3px solid var(--accent);
}

.admin-brand {
    padding: 1.5rem;
    font-size: 1.25rem;
    font-weight: 900;
    border-bottom: 1px solid rgba(255, 255, 255, 0.15);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: #fff;
    letter-spacing: -0.02em;
}

.admin-brand::before {
    content: "🏗️";
    font-size: 1.5rem;
}

.admin-nav {
    padding: 1.5rem 0;
    flex: 1;
}

.admin-nav-item {
    display: block;
    padding: 0.875rem 1.5rem;
    color: rgba(255, 255, 255, 0.7);
    transition: all 0.2s ease;
    font-weight: 500;
    cursor: pointer;
    border-left: 3px solid transparent;
    white-space: nowrap;
    position: relative;
}

.admin-nav-item:hover,
.admin-nav-item.active {
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
    border-left-color: var(--accent);
    padding-left: 1.35rem;
}

.admin-user {
    padding: 1.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.15);
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.6);
    line-height: 1.5;
}

.admin-user strong {
    display: block;
    color: #fff;
    font-weight: 700;
    margin-bottom: 0.5rem;
    word-break: break-all;
}

.admin-main {
    flex: 1;
    margin-left: 260px;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.admin-header {
    background: var(--bg-white);
    padding: 1.25rem 2rem;
    border-bottom: 2px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 35;
    box-shadow: var(--shadow-sm);
}

.admin-header h1 {
    margin: 0;
    font-size: 1.5rem;
    color: var(--primary);
}

.admin-content {
    padding: 2rem;
    flex: 1;
    overflow-y: auto;
}

/* ── Admin Panels & Cards ─────────────────────────────────── */
.panel {
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border);
    margin-bottom: 2rem;
    overflow: hidden;
    transition: box-shadow 0.2s ease;
}

.panel:hover {
    box-shadow: var(--shadow-lg);
}

.panel-header {
    padding: 1.5rem;
    border-bottom: 2px solid var(--accent-light);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(135deg, #f7f5f2 0%, #efece7 100%);
}

.panel-header h2,
.panel-header h3 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary);
    letter-spacing: -0.01em;
}

.panel-body {
    padding: 1.5rem;
}

.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.card {
    background: var(--bg-white);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: all 0.25s ease;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.card:hover {
    border-color: var(--accent);
    box-shadow: 0 8px 24px rgba(201, 149, 42, 0.15);
    transform: translateY(-2px);
}

.card-image {
    width: 100%;
    height: 180px;
    background: linear-gradient(135deg, var(--primary-light) 0%, var(--accent-light) 100%);
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.card:hover .card-image img {
    transform: scale(1.05);
}

.card-image.empty {
    color: var(--text-light);
    font-size: 3rem;
}

.card-body {
    padding: 1.5rem;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.card-title {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 0.5rem;
    line-height: 1.3;
}

.card-description {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
    flex: 1;
}

.card-specs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.spec-chip {
    display: inline-block;
    padding: 0.35rem 0.75rem;
    background: var(--accent-light);
    color: var(--accent-dark);
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.card-price {
    font-size: 1.5rem;
    font-weight: 900;
    color: var(--accent);
    margin-bottom: 1rem;
    line-height: 1;
}

.card-actions {
    display: flex;
    gap: 0.75rem;
}

/* ── Tables ───────────────────────────────────────────────── */
.table-responsive {
    overflow-x: auto;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 0.9375rem;
}

.admin-table th,
.admin-table td {
    padding: 1rem;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

.admin-table th {
    background: var(--primary-light);
    font-weight: 700;
    color: var(--primary);
    font-size: 0.8125rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.admin-table tbody tr {
    transition: background 0.2s ease;
}

.admin-table tbody tr:hover {
    background: var(--accent-light);
}

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

.admin-table .status-badge {
    display: inline-block;
    padding: 0.35rem 0.875rem;
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.status-active {
    background: #dcfce7;
    color: #166534;
}

.status-inactive {
    background: #f3f4f6;
    color: #6b7280;
}

/* ── Modals ───────────────────────────────────────────────── */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(26, 60, 94, 0.8);
    display: none;
    justify-content: center;
    align-items: flex-start;
    z-index: 1000;
    padding: 2rem 1rem;
    overflow-y: auto;
    backdrop-filter: blur(3px);
}

.modal-overlay.active {
    display: flex;
}

.modal {
    background: var(--bg-white);
    width: 100%;
    max-width: 600px;
    border-radius: var(--radius-lg);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
    position: relative;
    margin: auto;
    animation: slideDown 0.3s ease-out;
    border: 2px solid var(--border);
}

@keyframes slideDown {
    from {
        transform: translateY(-30px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-header {
    padding: 1.5rem;
    border-bottom: 2px solid var(--accent-light);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(135deg, #f7f5f2 0%, #efece7 100%);
}

.modal-header h3 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary);
}

.btn-close {
    background: transparent;
    border: none;
    font-size: 1.75rem;
    cursor: pointer;
    color: var(--text-muted);
    line-height: 1;
    transition: color 0.2s ease;
    padding: 0;
}

.btn-close:hover {
    color: var(--danger);
}

.modal-body {
    padding: 1.5rem;
    max-height: calc(100vh - 200px);
    overflow-y: auto;
}

.modal-footer {
    padding: 1.25rem 1.5rem;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    background: #f8fafc;
    border-bottom-left-radius: var(--radius-lg);
    border-bottom-right-radius: var(--radius-lg);
}

/* ── Login Page ───────────────────────────────────────────── */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
}

.login-card {
    background: var(--bg-white);
    padding: 3rem;
    border-radius: var(--radius-lg);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
    width: 100%;
    max-width: 420px;
    text-align: center;
    border: 3px solid var(--accent);
}

.login-card h1 {
    color: var(--primary);
    margin-bottom: 0.5rem;
    font-size: 2rem;
    font-weight: 900;
}

.login-card p {
    color: var(--text-muted);
    margin-bottom: 1.5rem;
    line-height: 1.6;
    font-size: 0.95rem;
}

.login-card .btn-primary {
    background: var(--primary);
    border-color: var(--primary);
}

.login-card .btn-primary:hover {
    background: var(--accent);
    border-color: var(--accent);
    box-shadow: 0 8px 20px rgba(201, 149, 42, 0.4);
}

#errorMsg {
    padding: 1rem;
    background: #fee2e2;
    border-left: 4px solid var(--danger);
    border-radius: var(--radius-sm);
    color: #991b1b;
    font-weight: 500;
    font-size: 0.9rem;
}

/* ── Form Elements ────────────────────────────────────────── */
.form-group {
    margin-bottom: 1.5rem;
    text-align: left;
}

.form-group label {
    display: block;
    font-size: 0.8125rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.9375rem;
    font-family: inherit;
    color: var(--text-main);
    background: var(--bg-white);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(201, 149, 42, 0.1);
}

/* ── Buttons (enhanced from style.css) ──────────────────── */
.btn {
    transition: all 0.2s ease;
    font-weight: 700;
}

.btn-primary {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

.btn-primary:hover {
    background: var(--primary-dark);
    box-shadow: 0 6px 20px rgba(26, 60, 94, 0.35);
    transform: translateY(-1px);
}

.btn-accent {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}

.btn-accent:hover {
    background: var(--accent-dark);
    box-shadow: 0 6px 20px rgba(201, 149, 42, 0.35);
    transform: translateY(-1px);
}

/* ── Utilities ────────────────────────────────────────────── */
.img-thumbnail {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: var(--radius-sm);
    border: 1.5px solid var(--border);
    transition: transform 0.2s ease;
}

.img-thumbnail:hover {
    transform: scale(1.05);
}

.empty-state {
    text-align: center;
    padding: 3rem 1.5rem;
    color: var(--text-muted);
}

.empty-state-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.empty-state-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 0.5rem;
}

/* ── Responsive ───────────────────────────────────────────── */
@media (max-width: 768px) {
    .admin-sidebar {
        width: 200px;
    }
    .admin-main {
        margin-left: 200px;
    }
    .admin-content {
        padding: 1rem;
    }
    .card-grid {
        grid-template-columns: 1fr;
    }
    .login-card {
        padding: 2rem;
        max-width: 100%;
        margin: 1rem;
    }
}

@media (max-width: 640px) {
    .admin-sidebar {
        position: fixed;
        left: 0;
        width: 100%;
        height: auto;
        max-height: 60vh;
        z-index: 50;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
    }
    .admin-sidebar.open {
        transform: translateX(0);
    }
    .admin-main {
        margin-left: 0;
    }
    .admin-header {
        padding: 1rem;
    }
    .modal {
        max-width: 100%;
        margin: 1rem;
    }
    .login-card {
        padding: 1.5rem;
        border-radius: var(--radius);
    }
}
