/* ============================================
   1. Reset & Global Styles
   ============================================ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    height: 100%;
}

body {
    font-family: 'Segoe UI', Arial, sans-serif;
    background: #1c222b;
    color: #e4e4e3;
    display: flex;
    flex-direction: column;
    line-height: 1.6;
}

h1, h2, h3, h4, h5, h6 {
    color: #ff9400;
    margin-bottom: 15px;
    letter-spacing: 0.5px;
    font-weight: 700;
}

h1 {
    letter-spacing: 1.2px;
    text-align: center;
    margin-top: 0;
}

p {
    color: #ccc;
    line-height: 1.7;
}

a {
    color: #ff9400;
    text-decoration: none;
    transition: color 0.2s;
}

a:hover {
    color: #ffab38;
}

/* Animation */
@keyframes pageFadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

main {
    flex: 1;
    width: 100%;
    margin-top: 80px; /* Space for fixed header */
    display: flex;
    justify-content: center;
    align-items: flex-start;
    animation: pageFadeIn 0.4s ease-out;
}

/* ============================================
   2. Layout & Containers
   ============================================ */
.page-container {
    width: 100%;
    max-width: 1600px;
    padding: 20px;
    margin: 0 auto;
}

.card {
    background: linear-gradient(145deg, #242b37, #1f2530);
    padding: 40px 36px;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.3);
    margin: 0 auto 40px auto;
    width: 100%;
    max-width: 600px; /* Default narrow card */
    border: 1px solid #333;
}

.card-wide {
    max-width: 1200px; /* Wider card for dashboards/indexes */
}

/* ============================================
   3. Header & Navigation
   ============================================ */
header {
    background: linear-gradient(135deg, #1a1a1a 0%, #2d2d2d 100%);
    padding: 5px 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
    border-bottom: 3px solid #ff9400;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
}

.header-container {
    max-width: 1600px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
}

.logo-section {
    display: flex;
    align-items: center;
}

.header-logo {
    height: 70px;
    width: auto;
    object-fit: contain;
    display: block; /* Fixes bottom spacing gap */
}

/* Desktop Navigation */
.main-nav {
    display: flex;
    gap: 20px;
    align-items: center;
}

.main-nav a {
    color: #fff;
    padding: 8px 14px;
    border-radius: 4px;
    font-weight: 500;
    transition: background 0.3s, color 0.3s;
}

.main-nav a:hover, 
.main-nav a.active {
    background: #ff9400;
    color: #1a1a1a;
}

/* ============================================
   4. Account Dropdown
   ============================================ */
.account-menu {
    position: relative;
    display: inline-block;
}

.account-btn {
    background: #252d3a;
    color: #fff;
    border: 1px solid #ff9400;
    padding: 8px 14px;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s;
    font-size: 1em;
}

.account-btn:hover {
    background: #ff9400;
    color: #1a1a1a;
}

.dropdown-menu {
    display: none;
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    background: #252d3a;
    border: 1px solid #ff9400;
    border-radius: 4px;
    min-width: 200px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
    z-index: 10000;
    flex-direction: column;
}

.dropdown-menu.active {
    display: flex;
}

.dropdown-menu a {
    display: block;
    color: #fff;
    padding: 12px 16px;
    border: none;
    background: none;
    text-align: left;
    font-weight: 400;
    white-space: nowrap;
    border-radius: 0;
}

.dropdown-menu a:hover {
    background: #ff9400;
    color: #1a1a1a;
    padding-left: 20px; /* Slide effect */
}

/* ============================================
   5. Buttons & Forms
   ============================================ */
.btn {
    background: #ff9400;
    color: #1a1a1a;
    padding: 10px 20px;
    border-radius: 5px;
    border: none;
    font-weight: bold;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
    transition: transform 0.2s, background 0.2s, box-shadow 0.2s;
    font-size: 1em;
    box-shadow: 0 4px 6px rgba(0,0,0,0.2);
}

.btn:hover {
    background: #ffab38;
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0,0,0,0.3);
}

.btn-full {
    width: 100%;
    text-align: center;
}

.btn-login {
    background: #ff9400;
    color: #1a1a1a !important;
    padding: 8px 16px !important;
    border-radius: 4px;
    font-weight: bold;
}

/* Inputs */
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="file"],
select,
textarea {
    padding: 12px;
    border-radius: 6px;
    border: 1px solid #444;
    background: #151a21;
    color: #eee;
    font-size: 1em;
    font-family: inherit;
    outline: none;
    transition: border 0.3s, box-shadow 0.3s;
    width: 100%;
}

input:focus, select:focus, textarea:focus {
    border-color: #ff9400;
    box-shadow: 0 0 0 3px rgba(255, 148, 0, 0.15);
    background: #1c222b;
}

/* ============================================
   6. Part Details Page (Grids & Gallery)
   ============================================ */
.detail-header {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    align-items: start;
    margin-bottom: 30px;
}

/* Main Image */
.image-container {
    position: relative;
    display: block;
    cursor: pointer;
    overflow: hidden;
    border-radius: 8px;
    background: #000;
}

.image-container img {
    transition: transform 0.3s ease;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.image-container:hover img {
    transform: scale(1.05);
}

.image-zoom-icon {
    position: absolute;
    bottom: 10px;
    right: 10px;
    background: rgba(255, 148, 0, 0.9);
    color: white;
    padding: 6px 10px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: bold;
    opacity: 0;
    transition: opacity 0.3s;
}

.image-container:hover .image-zoom-icon {
    opacity: 1;
}

/* Community Gallery Grid */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(70px, 1fr));
    gap: 10px;
    margin-top: 15px;
}

.gallery-item {
    aspect-ratio: 1/1;
    border-radius: 4px;
    overflow: hidden;
    cursor: pointer;
    position: relative;
    border: 1px solid #333;
}

.gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: opacity 0.2s;
}

.gallery-item:hover {
    border-color: #ff9400;
}

/* Info Cards */
.info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

.info-item {
    background: #252d3a;
    padding: 15px;
    border-radius: 6px;
    border-left: 3px solid #ff9400;
}

.info-item strong {
    color: #ff9400;
    display: block;
    margin-bottom: 5px;
    font-size: 0.9em;
    text-transform: uppercase;
}

/* Stats Cards */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
    margin: 20px 0;
}

.stat-card {
    background: #252d3a;
    padding: 20px;
    border-radius: 6px;
    text-align: center;
    border: 1px solid #333;
}

.stat-number {
    font-size: 2em;
    color: #ff9400;
    font-weight: bold;
}

/* ============================================
   7. Tables & Admin
   ============================================ */
table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
    background: #252d3a;
    border-radius: 8px;
    overflow: hidden;
}

th, td {
    padding: 15px;
    text-align: left;
    border-bottom: 1px solid #333;
}

th {
    background: #1a1a1a;
    color: #ff9400;
    font-weight: bold;
    text-transform: uppercase;
    font-size: 0.85em;
}

tr:last-child td {
    border-bottom: none;
}

tr:hover {
    background: #2a3544;
}

/* Admin Tabs */
.admin-tabs {
    display: flex;
    gap: 5px;
    margin-bottom: 20px;
    border-bottom: 2px solid #333;
    flex-wrap: wrap;
}

.admin-tabs a {
    padding: 10px 20px;
    background: #252d3a;
    color: #aaa;
    border-radius: 6px 6px 0 0;
}

.admin-tabs a.active {
    background: #ff9400;
    color: #1a1a1a;
    font-weight: bold;
}

.action-btn {
    padding: 5px 10px;
    border-radius: 4px;
    font-size: 0.8em;
    border: none;
    cursor: pointer;
    margin: 0 2px;
}

.btn-edit { background: #2196F3; color: white; }
.btn-delete { background: #ff6b6b; color: white; }
.btn-resolve { background: #4CAF50; color: white; }

/* ============================================
   8. Profile & Garage
   ============================================ */
.current-car-badge {
    background: rgba(255, 148, 0, 0.15);
    color: #ff9400;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.8em;
    border: 1px solid rgba(255, 148, 0, 0.3);
    margin-left: 10px;
}

/* ============================================
   9. Modals (Lightbox & Reports)
   ============================================ */
.lightbox {
    display: none;
    position: fixed;
    z-index: 9999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s;
}

.lightbox.active {
    display: flex;
}

.lightbox-content {
    position: relative;
    max-width: 90%;
    max-height: 90%;
}

.lightbox-content img {
    max-width: 100%;
    max-height: 85vh;
    border-radius: 8px;
    box-shadow: 0 0 20px rgba(0,0,0,0.5);
}

.lightbox-close {
    position: absolute;
    top: -40px;
    right: -10px;
    color: #fff;
    font-size: 30px;
    cursor: pointer;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* ============================================
   10. Mobile Menu & Responsiveness
   ============================================ */
.hamburger {
    display: none; /* Hidden on desktop */
    background: none;
    border: none;
    cursor: pointer;
    padding: 10px;
    z-index: 2000;
}

.hamburger span {
    display: block;
    width: 25px;
    height: 3px;
    margin: 5px 0;
    background-color: #fff;
    transition: all 0.3s ease;
}

/* Mobile Breakpoint */
@media (max-width: 768px) {
    .header-container {
        padding: 0 10px;
    }

    .hamburger {
        display: block; /* Show on mobile */
    }

    /* Hamburger Animation */
    .hamburger.active span:nth-child(1) { transform: rotate(45deg) translate(5px, 5px); }
    .hamburger.active span:nth-child(2) { opacity: 0; }
    .hamburger.active span:nth-child(3) { transform: rotate(-45deg) translate(7px, -6px); }

    /* Mobile Nav */
    .main-nav {
        position: fixed;
        top: 80px; /* Below new taller header */
        left: 0;
        width: 100%;
        height: 0;
        background-color: #1a1a1a;
        flex-direction: column;
        align-items: stretch;
        overflow: hidden;
        transition: height 0.3s ease;
        z-index: 1500;
        border-bottom: 2px solid #ff9400;
        gap: 0;
    }

    .main-nav.active {
        height: auto;
        padding-bottom: 20px;
    }

    .main-nav a {
        padding: 15px;
        text-align: center;
        border-bottom: 1px solid #333;
        width: 100%;
        display: block;
    }

    /* Mobile Account Dropdown */
    .account-menu {
        width: 100%;
        text-align: center;
        margin-top: 10px;
    }

    .account-btn {
        width: 90%;
        margin: 0 auto;
        display: block;
    }

    .dropdown-menu {
        position: static; /* Stack inline on mobile */
        width: 90%;
        margin: 10px auto;
        border: 1px solid #444;
        box-shadow: none;
    }

    /* Grids to Single Column */
    .detail-header, 
    .info-grid, 
    .stats-grid, 
    .garage-form {
        grid-template-columns: 1fr;
    }
}

/* Footer */
footer {
    background: #151920;
    padding: 20px;
    text-align: center;
    color: #666;
    margin-top: auto; /* Pushes footer to bottom */
    font-size: 0.9em;
}