﻿:root {
    --admin-bg: #040404;
    --admin-panel: #090909;
    --admin-card: #111111;
    --admin-border: rgba(255, 255, 255, 0.08);
    --admin-primary: #ff1f3d;
    --admin-text: #f4f4f4;
    --admin-text-muted: rgba(244, 244, 244, 0.65);
    --admin-chip: rgba(255, 255, 255, 0.08);
    --admin-shadow: 0 25px 60px rgba(0, 0, 0, 0.55);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: "Poppins", "Segoe UI", sans-serif;
    background: radial-gradient(circle at top, rgba(255, 31, 61, 0.28), transparent 45%), #020202;
    color: var(--admin-text);
    min-height: 100vh;
    line-height: 1.5;
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    background-image: radial-gradient(rgba(255, 255, 255, 0.06) 1px, transparent 0);
    background-size: 120px 120px;
    opacity: 0.4;
    pointer-events: none;
}

.hidden {
    display: none !important;
}

a {
    color: var(--admin-primary);
}

.admin-shell {
    display: flex;
    min-height: 100vh;
    position: relative;
    z-index: 1;
}

.admin-sidebar {
    width: 260px;
    background: var(--admin-panel);
    border-right: 1px solid var(--admin-border);
    padding: 2rem 1.5rem;
    position: sticky;
    top: 0;
    height: 100vh;
    box-shadow: var(--admin-shadow);
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.admin-sidebar .logo {
    font-size: 1.35rem;
    font-weight: 600;
    color: var(--admin-text);
    text-decoration: none;
}

.admin-sidebar .logo span {
    color: var(--admin-primary);
}

.admin-nav {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.admin-nav a {
    color: var(--admin-text-muted);
    text-decoration: none;
    padding: 0.75rem 1rem;
    border-radius: 12px;
    transition: background 0.2s ease, color 0.2s ease, transform 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.55rem;
}

.admin-nav a:hover,
.admin-nav a.active {
    background: rgba(255, 31, 61, 0.16);
    color: var(--admin-primary);
    transform: translateX(4px);
}

.admin-nav a i {
    font-size: 0.95rem;
}

.admin-main {
    flex: 1;
    padding: 2.5rem 3rem;
}

.admin-header {
    margin-bottom: 2rem;
}

.admin-header--stacked {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.hero-card {
    background: linear-gradient(135deg, rgba(255, 31, 61, 0.25), rgba(17, 17, 17, 0.95));
    border-radius: 26px;
    padding: 2rem;
    display: flex;
    gap: 1.5rem;
    align-items: center;
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: var(--admin-shadow);
}

.hero-icon {
    width: 72px;
    height: 72px;
    border-radius: 20px;
    background: rgba(0, 0, 0, 0.35);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    color: var(--admin-primary);
}

.hero-card h1 {
    margin: 0;
    font-size: 2rem;
}

.metric-large {
    font-size: 1.85rem;
    font-weight: 600;
    margin: 0.3rem 0 0;
    line-height: 1.2;
}

.hero-card .metric-large {
    font-size: 3rem;
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.85rem;
    color: var(--admin-text);
    background: var(--admin-chip);
    padding: 0.35rem 0.9rem;
    border-radius: 999px;
}

.btn {
    border: none;
    border-radius: 999px;
    padding: 0.65rem 1.4rem;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.btn-primary {
    background: var(--admin-primary);
    color: #ffffff;
    box-shadow: 0 14px 35px rgba(255, 31, 61, 0.45);
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--admin-border);
    color: var(--admin-text);
}

.btn:not(:disabled):hover {
    transform: translateY(-1px);
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--admin-card);
    border-radius: 20px;
    padding: 1.2rem;
    border: 1px solid var(--admin-border);
    display: flex;
    gap: 1rem;
    box-shadow: var(--admin-shadow);
    align-items: center;
}

.stat-icon {
    width: 44px;
    height: 44px;
    border-radius: 15px;
    background: rgba(255, 31, 61, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--admin-primary);
}

.stat-card strong {
    display: block;
    font-size: 1.6rem;
}

.stat-subtext {
    font-size: 0.85rem;
    color: var(--admin-text-muted);
    margin-top: 0.35rem;
}

.card-grid,
.section-card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.2rem;
}

.card {
    background: var(--admin-card);
    border: 1px solid var(--admin-border);
    border-radius: 22px;
    padding: 1.5rem;
    box-shadow: var(--admin-shadow);
    min-height: 160px;
}

.card h2 {
    margin: 0 0 0.6rem;
}

.card h3 {
    margin-top: 0;
    font-size: 1rem;
    color: var(--admin-text-muted);
}

.card .metric-large {
    font-size: 2rem;
    word-break: break-word;
}

.card .stat-subtext {
    margin-top: 0.3rem;
}

.section {
    margin-top: 2.5rem;
}

.two-column {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.4rem;
}

.signal-list,
.analytics-list {
    list-style: none;
    padding: 0;
    margin: 1rem 0 0;
    display: grid;
    gap: 0.9rem;
}

.signal-list li,
.analytics-list li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    padding-bottom: 0.7rem;
    border-bottom: 1px solid var(--admin-border);
}

.table-container {
    border-radius: 24px;
    overflow: hidden;
    border: 1px solid var(--admin-border);
    box-shadow: var(--admin-shadow);
}

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.92rem;
}

.table thead {
    background: rgba(255, 255, 255, 0.04);
    font-size: 0.78rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

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

.table tbody tr:hover {
    background: rgba(255, 255, 255, 0.02);
}

.table-actions {
    display: flex;
    flex-wrap: nowrap;
    gap: 0.5rem;
    align-items: center;
    justify-content: flex-start;
    min-width: 220px;
    flex-shrink: 0;
}

.table-actions button {
    font-size: 0.78rem;
    padding: 0.35rem 0.8rem;
    border-radius: 999px;
    white-space: nowrap;
}

.status-pill {
    padding: 0.3rem 0.9rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: capitalize;
}

.status-available {
    background: rgba(76, 175, 80, 0.25);
    color: #aafdb5;
}

.status-reserved {
    background: rgba(255, 193, 7, 0.25);
    color: #ffe29f;
}

.status-sold,
.status-completed {
    background: rgba(255, 82, 82, 0.25);
    color: #ffb0b0;
}

.status-new {
    background: rgba(255, 31, 61, 0.25);
    color: #ffb5c2;
}

.status-read {
    background: rgba(255, 255, 255, 0.15);
    color: var(--admin-text);
}

.status-replied {
    background: rgba(76, 175, 80, 0.25);
    color: #aafdb5;
}

.status-closed,
.status-cancelled {
    background: rgba(158, 158, 158, 0.25);
    color: #d8d8d8;
}

.form-card {
    background: var(--admin-card);
    border: 1px solid var(--admin-border);
    border-radius: 24px;
    padding: 1.5rem;
    box-shadow: var(--admin-shadow);
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
}

label {
    display: block;
    font-size: 0.85rem;
    margin-bottom: 0.35rem;
    color: var(--admin-text-muted);
}

input,
select,
textarea {
    width: 100%;
    padding: 0.85rem 1rem;
    border-radius: 14px;
    border: 1px solid var(--admin-border);
    background: #080808;
    color: var(--admin-text);
    font-family: inherit;
}

textarea {
    min-height: 120px;
    resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
    outline: 1px solid rgba(255, 31, 61, 0.45);
}

.summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 1rem;
    margin-top: 1.5rem;
}

.summary-card {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--admin-border);
    border-radius: 18px;
    padding: 1rem 1.2rem;
    box-shadow: var(--admin-shadow);
}

.summary-card p {
    margin: 0;
    font-size: 0.85rem;
    color: var(--admin-text-muted);
}

.summary-card strong {
    display: block;
    margin-top: 0.35rem;
    font-size: 1.6rem;
}

.summary-card--total strong {
    color: var(--admin-primary);
}

.summary-card--new strong {
    color: #8dffb0;
}

.summary-card--replied strong {
    color: #8cc8ff;
}

.summary-card--closed strong {
    color: #d0d0d0;
}

.toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: center;
    margin-bottom: 1.3rem;
}

.search-field {
    flex: 1;
    min-width: 220px;
    display: flex;
    align-items: center;
    background: #080808;
    border: 1px solid var(--admin-border);
    border-radius: 999px;
    padding: 0.4rem 1rem;
    gap: 0.5rem;
}

.search-field input {
    border: none;
    outline: none;
    background: transparent;
    padding: 0;
    color: var(--admin-text);
}

.filter-tabs {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-top: 1rem;
}

.filter-btn {
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(255, 255, 255, 0.05);
    color: var(--admin-text);
    padding: 0.5rem 1.4rem;
    border-radius: 999px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: border 0.2s ease, background 0.2s ease, color 0.2s ease;
}

.filter-btn.active {
    border-color: var(--admin-primary);
    color: var(--admin-primary);
    background: rgba(255, 31, 61, 0.18);
    box-shadow: 0 8px 18px rgba(255, 31, 61, 0.25);
}

.alert {
    background: rgba(255, 31, 61, 0.12);
    color: var(--admin-text);
    border: 1px solid rgba(255, 31, 61, 0.25);
    padding: 0.85rem 1rem;
    border-radius: 14px;
    margin: 1rem 0;
}

.modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    z-index: 1000;
}

.modal.open {
    display: flex;
}

.modal-card {
    width: 100%;
    max-width: 620px;
    background: #0e0e0e;
    border-radius: 24px;
    padding: 2rem;
    position: relative;
    box-shadow: var(--admin-shadow);
    border: 1px solid var(--admin-border);
}

.modal-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: transparent;
    border: none;
    color: var(--admin-text);
    font-size: 1.3rem;
    cursor: pointer;
}

.modal-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.8rem;
    margin-top: 1.5rem;
}

.analytics-card {
    padding: 1rem;
    border: 1px solid var(--admin-border);
    border-radius: 16px;
    background: #0b0b0b;
}

.analytics-card h4 {
    margin: 0 0 0.4rem;
    font-size: 0.85rem;
    color: var(--admin-text-muted);
}

.analytics-card strong {
    font-size: 1.2rem;
}

.login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.login-card {
    width: 100%;
    max-width: 360px;
    background: rgba(10, 10, 10, 0.9);
    border-radius: 26px;
    border: 1px solid var(--admin-border);
    padding: 2.2rem 2rem;
    text-align: center;
    box-shadow: var(--admin-shadow);
    position: relative;
}

.login-icon {
    width: 70px;
    height: 70px;
    border-radius: 18px;
    background: rgba(255, 31, 61, 0.18);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--admin-primary);
    font-size: 2rem;
    margin: 0 auto 1.2rem;
}

.login-card h1 {
    margin: 0;
}

.login-card p {
    color: var(--admin-text-muted);
    margin-top: 0.3rem;
}

.login-card form {
    text-align: left;
    margin-top: 1.2rem;
}

.login-card .form-group {
    margin-bottom: 1rem;
}

.login-card button {
    width: 100%;
    margin-top: 0.5rem;
}

.login-footnote {
    margin-top: 1.2rem;
    font-size: 0.8rem;
    color: var(--admin-text-muted);
    line-height: 1.5;
}

.login-footnote a {
    color: var(--admin-primary);
    text-decoration: none;
}

@media (max-width: 960px) {
    .admin-shell {
        flex-direction: column;
    }

    .admin-sidebar {
        width: 100%;
        height: auto;
        position: static;
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        gap: 1rem;
    }

    .admin-nav {
        flex-direction: row;
        flex-wrap: wrap;
    }

    .admin-main {
        padding: 2rem 1.5rem;
    }
}

@media (max-width: 640px) {
    .hero-card {
        flex-direction: column;
        text-align: center;
    }

    .toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .admin-nav {
        flex-direction: column;
        align-items: stretch;
    }
}

/* Notification animations */
@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOut {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

/* Form enhancements */
.form-grid > div.wide-field,
.form-grid > .wide-field {
    grid-column: span 2;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    align-items: flex-start;
    width: 100%;
}

.wide-field .image-preview-container {
    width: 210px;
    max-width: 210px;
}

.wide-field .image-preview-container + .stat-subtext {
    margin-top: 0.25rem;
}

.gallery-preview-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: 0.5rem;
    width: 100%;
}

.gallery-preview-item {
    position: relative;
    width: 120px;
    height: 90px;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid var(--admin-border);
    background: rgba(255, 255, 255, 0.04);
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.25);
}

.gallery-preview-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.gallery-preview-remove {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: none;
    background: rgba(0, 0, 0, 0.8);
    color: #fff;
    cursor: pointer;
    font-size: 0.7rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.form-grid textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--admin-border);
    border-radius: 6px;
    background: var(--admin-card);
    color: var(--admin-text);
    font-family: inherit;
    font-size: 0.9rem;
    resize: vertical;
    min-height: 80px;
}

.form-grid textarea:focus {
    outline: none;
    border-color: var(--admin-primary);
    box-shadow: 0 0 0 2px rgba(255, 31, 61, 0.2);
}

.form-grid small.stat-subtext {
    display: block;
    margin-top: 0.25rem;
    font-size: 0.75rem;
    color: var(--admin-text-muted);
}

.form-grid input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--admin-primary);
}

/* File Upload Styling */
.file-upload-wrapper {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.file-upload-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border: 1px solid var(--admin-border);
    background: var(--admin-card);
    color: var(--admin-text);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.9rem;
    font-weight: 500;
}

.file-upload-btn:hover {
    border-color: var(--admin-primary);
    background: rgba(255, 31, 61, 0.1);
    color: var(--admin-primary);
}

.file-name-display {
    color: var(--admin-text-muted);
    font-size: 0.9rem;
    font-style: italic;
    flex: 1;
    min-width: 150px;
}

#imagePreview.image-preview-container,
.image-preview-container {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-top: 0.25rem;
    border: 1px solid var(--admin-border);
    border-radius: 6px;
    padding: 0.5rem;
    background: var(--admin-card);
    width: 210px;
    height: 155px;
    overflow: hidden;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.02);
}

#imagePreviewImg.image-preview,
.image-preview {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 4px;
    display: block;
}

.btn-remove-preview {
    position: absolute;
    top: -10px;
    right: -10px;
    background: rgba(0, 0, 0, 0.75);
    color: #fff;
    border: none;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.75rem;
}

.btn-remove-preview:hover {
    background: var(--admin-primary);
    transform: scale(1.1);
}

/* Responsive file upload */
@media (max-width: 768px) {
    .file-upload-wrapper {
        flex-direction: column;
        align-items: stretch;
    }
    
    .file-upload-btn {
        width: 100%;
        justify-content: center;
    }
    
    .file-name-display {
        text-align: center;
    }
    
    .image-preview-container {
        width: 100%;
        max-width: 100%;
        height: auto;
        aspect-ratio: 4 / 3;
    }
}