/* ======================================================
   THE CAR STORE / AUTONEST
   CLEAN MASTER STYLESHEET
   BLACK / YELLOW / RED THEME
   ====================================================== */


/* ======================================================
   1. RESET / GLOBAL
   ====================================================== */
*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    padding: 0;
    font-family: Arial, Helvetica, sans-serif;
    background: #0b0b0b;
    color: #f3f4f6;
    line-height: 1.5;
}

img {
    max-width: 100%;
    display: block;
}

a {
    color: #facc15;
    text-decoration: none;
    transition: all 0.18s ease;
}

a:hover {
    color: #fde047;
}

h1,
h2,
h3 {
    margin-top: 0;
    line-height: 1.2;
}

.container {
    width: 100%;
    max-width: 1280px;
    margin: 0 auto;
    padding-left: 16px;
    padding-right: 16px;
}

.page-wrap {
    width: 100%;
    max-width: 1500px;
    margin: 0 auto;
    padding: 24px 16px 36px;
}


/* ======================================================
   2. SHARED BUTTONS
   ====================================================== */
button {
    font: inherit;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 42px;
    padding: 10px 16px;
    border: none;
    border-radius: 10px;
    text-decoration: none;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.18s ease;
}

.btn.edit,
.btn-primary,
.inventory-filter-button,
.dash-btn,
.actions a,
.inventory-card-button {
    background: #facc15;
    color: #111111;
    box-shadow: 0 0 0 1px rgba(250, 204, 21, 0.18), 0 6px 18px rgba(250, 204, 21, 0.10);
}

.btn.edit:hover,
.btn-primary:hover,
.inventory-filter-button:hover,
.dash-btn:hover,
.actions a:hover,
.inventory-card-button:hover {
    background: #eab308;
    color: #111111;
    transform: translateY(-1px);
}

.btn.delete,
.dash-btn.logout {
    background: #dc2626;
    color: #ffffff;
}

.btn.delete:hover,
.dash-btn.logout:hover {
    background: #b91c1c;
}

.btn.add {
    background: #16a34a;
    color: #ffffff;
}

.btn.add:hover {
    background: #15803d;
}

.btn.back,
.btn.view,
.btn-secondary,
.inventory-reset-btn,
.inventory-tools .inventory-reset,
.public-back {
    background: #1f2937;
    color: #f9fafb;
    border: 1px solid #374151;
}

.btn.back:hover,
.btn.view:hover,
.btn-secondary:hover,
.inventory-reset-btn:hover,
.inventory-tools .inventory-reset:hover,
.public-back:hover {
    background: #374151;
    color: #ffffff;
}


/* ======================================================
   3. ALERTS
   ====================================================== */
.success {
    background: rgba(22, 163, 74, 0.18);
    color: #bbf7d0;
    border: 1px solid rgba(22, 163, 74, 0.35);
    padding: 12px 14px;
    border-radius: 10px;
    margin-bottom: 18px;
    font-weight: 700;
}

.error {
    background: rgba(220, 38, 38, 0.16);
    color: #fecaca;
    border: 1px solid rgba(220, 38, 38, 0.34);
    padding: 12px 14px;
    border-radius: 10px;
    margin-bottom: 18px;
    font-weight: 700;
}


/* ======================================================
   4. ADMIN TOP BAR / NAV
   ====================================================== */
.admin-topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    background: linear-gradient(180deg, #090909, #111111);
    color: #ffffff;
    padding: 14px 24px;
    border-bottom: 1px solid #1f2937;
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.28);
    position: sticky;
    top: 0;
    z-index: 2000;
}

.admin-brand {
    font-size: 22px;
    font-weight: 800;
    color: #facc15;
}

.admin-nav {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.admin-nav a {
    color: #f3f4f6;
    text-decoration: none;
    padding: 10px 14px;
    border-radius: 10px;
    background: transparent;
    border: 1px solid transparent;
}

.admin-nav a:hover,
.admin-nav a.active {
    background: #171717;
    border-color: #2a2a2a;
    color: #facc15;
}

.admin-nav a.admin-logout {
    background: rgba(220, 38, 38, 0.12);
    border-color: rgba(220, 38, 38, 0.20);
}

.admin-nav a.admin-logout:hover {
    background: rgba(220, 38, 38, 0.22);
    color: #ffffff;
}

.admin-menu-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 28px;
    color: white;
    cursor: pointer;
    padding: 0;
}


/* ======================================================
   5. STATUS BAR / ONLINE USERS
   ====================================================== */
.status-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    background: #111827;
    color: #ffffff;
    padding: 12px 16px;
    border-radius: 10px;
    border: 1px solid #1f2937;
    margin-bottom: 20px;
    font-size: 14px;
}

.online-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    background: #22c55e;
    border-radius: 50%;
    margin-right: 6px;
}

.online-users-box {
    background: #121212;
    border: 1px solid #222;
    border-radius: 10px;
    padding: 16px;
    margin-bottom: 20px;
    color: #f3f4f6;
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.16);
}

.online-users-box h3 {
    margin-top: 0;
    color: #facc15;
}

.online-users-box ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.online-users-box li {
    padding: 8px 0;
    border-bottom: 1px solid #232323;
}

.online-text {
    color: #4ade80;
    font-weight: 700;
}

.offline-text {
    color: #9ca3af;
    font-weight: 700;
}


/* ======================================================
   6. ADMIN DASHBOARD CARDS
   ====================================================== */
.cards {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-bottom: 40px;
}

.card {
    background: linear-gradient(180deg, #111111, #181818);
    padding: 25px;
    border-radius: 14px;
    border: 1px solid #222;
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.20);
    color: #f3f4f6;
}

.card h2 {
    margin: 0;
    font-size: 28px;
    color: #facc15;
}

.card p {
    color: #a1a1aa;
    margin-top: 6px;
}

.dashboard-actions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 14px;
    margin: 30px 0;
}

.dash-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px;
    text-align: center;
    border-radius: 12px;
    font-size: 15px;
}


/* ======================================================
   7. TABLES
   ====================================================== */
.table-wrap {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.table-wrap table {
    min-width: 900px;
}

table {
    width: 100%;
    background: #111111;
    color: #f3f4f6;
    border-collapse: collapse;
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.18);
}

th,
td {
    padding: 12px;
    border-bottom: 1px solid #1f1f1f;
}

th {
    background: #0d0d0d;
    color: #facc15;
    text-align: left;
    white-space: nowrap;
}

tr:hover {
    background: #161616;
}

.sort-link,
th a.sort-link {
    color: #facc15;
    text-decoration: none;
    font-weight: 700;
    white-space: nowrap;
}

.sort-link:hover,
th a.sort-link:hover {
    text-decoration: underline;
}


/* ======================================================
   8. STATUS LABELS
   ====================================================== */
.status-sold,
.status-pending,
.status-wholesale,
.status-available {
    display: inline-block;
    padding: 6px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.4px;
}

.status-sold {
    background: #dc2626;
    color: #ffffff;
}

.status-pending {
    background: #facc15;
    color: #111111;
}

.status-wholesale {
    background: #6b7280;
    color: #ffffff;
}

.status-available {
    background: #16a34a;
    color: #ffffff;
}


/* ======================================================
   9. FORMS
   ====================================================== */
form {
    width: 100%;
    background: #111111;
    color: #f3f4f6;
    padding: 24px;
    border-radius: 14px;
    border: 1px solid #222;
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.18);
}

label {
    display: block;
    margin-top: 14px;
    font-weight: 700;
    color: #f3f4f6;
}

input,
textarea,
select {
    width: 100%;
    padding: 11px 12px;
    margin-top: 6px;
    margin-bottom: 14px;
    border: 1px solid #323232;
    border-radius: 10px;
    font-size: 14px;
    background: #171717;
    color: #f9fafb;
}

input:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: #facc15;
    box-shadow: 0 0 0 3px rgba(250, 204, 21, 0.12);
}

textarea {
    min-height: 100px;
}

.form-group {
    margin-bottom: 18px;
}

.form-group label {
    margin-bottom: 6px;
}

.form-group input,
.form-group textarea {
    margin-bottom: 0;
}

.vehicle-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 22px;
}

.vehicle-grid .form-group {
    margin-bottom: 4px;
}

.vehicle-grid textarea {
    height: 110px;
}

.full-width {
    grid-column: 1 / -1;
}

.section-title {
    grid-column: 1 / -1;
    margin-top: 20px;
    font-size: 18px;
    color: #facc15;
    border-top: 1px solid #2b2b2b;
    padding-top: 15px;
}

.file-upload {
    grid-column: 1 / -1;
}

.vin-row {
    display: flex;
    gap: 10px;
    align-items: flex-start;
}

.vin-row input {
    flex: 1;
    margin-bottom: 0;
}


/* ======================================================
   10. PHOTO BOX / IMAGE UTILITIES
   ====================================================== */
.photo-order-status {
    margin: 12px 0 0;
    font-weight: 700;
    min-height: 22px;
}

.photo-order-status.is-saving {
    color: #b8860b;
}

.photo-order-status.is-success {
    color: #0a7a2f;
}

.photo-order-status.is-error {
    color: #b00020;
}

.photo-order-wrap {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 24px;
    margin-top: 20px;
    align-items: start;
}

.photo-box {
    position: relative;
    background: #111111;
    border: 2px solid #2b2b2b;
    border-radius: 16px;
    padding: 14px;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.18);
    transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease, opacity 0.18s ease;
    text-align: center;
}

.photo-box:hover {
    border-color: #d4af37;
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.24);
}

.photo-box.dragging {
    opacity: 0.82;
    transform: scale(1.01);
    border-color: #facc15;
    box-shadow: 0 16px 30px rgba(0, 0, 0, 0.28);
}

.photo-box.drop-target {
    border-color: #facc15;
    box-shadow: 0 0 0 2px rgba(250, 204, 21, 0.28), 0 12px 26px rgba(0, 0, 0, 0.24);
    transform: translateY(-2px);
}

.photo-box-primary {
    border-color: #d4af37;
}

.photo-image-wrap {
    position: relative;
    border-radius: 14px;
    overflow: hidden;
}

.photo-image-wrap img {
    display: block;
    width: 100%;
    height: 220px;
    object-fit: cover;
    border-radius: 14px;
    border: 2px solid #c00000;
    user-select: none;
    -webkit-user-drag: none;
}

.photo-badges-row {
    position: absolute;
    top: 10px;
    left: 10px;
    right: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    pointer-events: none;
    z-index: 4;
}

.photo-primary-badge,
.photo-position-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 28px;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 800;
    line-height: 1;
}

.photo-primary-badge {
    display: none;
    background: #d4af37;
    color: #111111;
}

.photo-box-primary .photo-primary-badge {
    display: inline-flex;
}

.photo-position-badge {
    background: rgba(0, 0, 0, 0.82);
    color: #ffffff;
}

.photo-drag-handle {
    position: absolute;
    right: 10px;
    bottom: 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    width: 48px;
    height: 48px;
    border-radius: 12px;
    background: rgba(0, 0, 0, 0.94);
    border: 2px solid #facc15;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.32);
    cursor: grab;
    user-select: none;
    z-index: 5;
}

.photo-drag-handle span {
    display: block;
    width: 20px;
    height: 4px;
    border-radius: 999px;
    background: #facc15;
}

.photo-drag-handle:hover {
    background: #111111;
    border-color: #ffe45c;
    transform: translateY(-1px);
}

.photo-drag-handle:active {
    transform: scale(0.97);
}

.photo-box.dragging .photo-drag-handle {
    cursor: grabbing;
}

.image-order-controls {
    margin-top: 12px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.image-order-controls .btn {
    width: 100%;
}

.image-order-controls .image-delete-btn {
    grid-column: 1 / -1;
}

.note {
    font-size: 14px;
    color: #a1a1aa;
    margin-top: 5px;
    margin-bottom: 10px;
}

.action-group {
    margin-top: 20px;
}

#imageOrderForm {
    margin-top: 20px;
}

@media (max-width: 1100px) {
    .photo-order-wrap {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .photo-image-wrap img {
        height: 210px;
    }
}

@media (max-width: 768px) {
    .photo-order-wrap {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .photo-image-wrap img {
        height: auto;
        max-height: 320px;
    }

    .photo-drag-handle {
        width: 78px;
        height: 78px;
        right: 10px;
        bottom: 10px;
        border-radius: 14px;
    }

    .photo-drag-handle span {
        width: 34px;
        height: 5px;
    }

    .image-order-controls {
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }
}


/* ======================================================
   11. ACTION CELLS
   ====================================================== */
.actions-cell {
    min-width: 170px;
    white-space: nowrap;
}

.action-group {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.protected-text {
    color: #9ca3af;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    min-height: 38px;
}

.delete-form,
.actions-cell form {
    display: inline-flex;
    width: auto !important;
    margin: 0;
    background: transparent !important;
    padding: 0 !important;
    box-shadow: none !important;
    border-radius: 0 !important;
    border: none !important;
}


/* ======================================================
   12. USER PERMISSIONS
   ====================================================== */
.permissions-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px 20px;
    margin-top: 10px;
}

.permission-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
}

.permission-item input {
    width: auto;
    margin: 0;
    cursor: pointer;
}

.permission-item label {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    font-weight: 700;
}


/* ======================================================
   18. FINANCE BOX
   ====================================================== */
.finance-box {
    margin-top: 30px;
    padding: 30px;
    background: linear-gradient(135deg, #090909, #141414);
    color: #ffffff;
    border-radius: 18px;
    text-align: center;
    box-shadow: 0 16px 34px rgba(0, 0, 0, 0.35);
    border: 1px solid #202020;
}

.finance-box .label {
    font-size: 14px;
    letter-spacing: 2px;
    opacity: 0.85;
}

.finance-box .down {
    font-size: 48px;
    font-weight: 800;
    color: #22e58a;
    margin: 10px 0;
}

.finance-box .monthly {
    font-size: 56px;
    font-weight: 900;
    color: #60a5fa;
    margin: 10px 0;
}

.finance-box small {
    display: block;
    margin-top: 20px;
    font-size: 12px;
    opacity: 0.7;
}




/* ======================================================
   21. RESPONSIVE
   ====================================================== */
@media (max-width: 900px) {
    .cards {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 768px) {
    .admin-topbar {
        flex-wrap: wrap;
    }

    .admin-menu-toggle {
        display: block;
    }

    .admin-nav {
        width: 100%;
        display: none;
        flex-direction: column;
        margin-top: 10px;
    }

    .admin-nav.open {
        display: flex;
    }

    .admin-nav a {
        padding: 12px 10px;
        border-radius: 8px;
        background: #171717;
    }

    .page-wrap {
        padding: 20px 16px 30px;
    }

    .vehicle-shell {
        padding: 20px;
    }

    .vehicle-info-grid {
        grid-template-columns: 1fr;
    }

    .vehicle-price {
        font-size: 24px;
    }

    .main-image {
        width: 100%;
    }

    .thumbs {
        justify-content: flex-start;
    }

    .thumbs img {
        width: 84px;
        height: 64px;
    }

    .modal-image {
        max-width: 94vw;
        max-height: 78vh;
    }

    .modal-prev,
    .modal-next {
        font-size: 42px;
        padding: 6px 8px;
    }

    .modal-prev {
        left: 6px;
    }

    .modal-next {
        right: 6px;
    }

    .modal-close {
        font-size: 34px;
        top: 10px;
        right: 12px;
    }

    .permissions-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 700px) {
    .vehicle-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 600px) {
    .cards {
        grid-template-columns: 1fr;
    }

    .vin-row {
        flex-direction: column;
    }

    .vin-row .btn,
    .vin-row button {
        width: 100%;
    }

    .finance-box .down {
        font-size: 34px;
    }

    .finance-box .monthly {
        font-size: 40px;
    }
}