/* ── Variables ───────────────────────────────────────── */
:root {
    --accent-red: #c44536;
    --gradient-red: linear-gradient(135deg, #c44536, #d95f4e);
    --dark-bg: #0a0a0a;
    --dark-card: #111111;
    --dark-card-border: rgba(255, 255, 255, 0.07);
    --text-secondary: #a0a0a0;
    --text-muted: #5a5a5a;
}

/* ── Base ────────────────────────────────────────────── */
body {
    font-family: 'Raleway', sans-serif;
    background: var(--dark-bg);
    min-height: 100vh;
    padding: 80px 20px 60px;
}

/* ── Background decorations ──────────────────────────── */
.page-bg-glow {
    position: fixed;
    top: 0;
    right: 0;
    width: 65vw;
    height: 65vh;
    background: radial-gradient(ellipse at 75% 15%, rgba(196, 69, 54, 0.08) 0%, transparent 60%);
    pointer-events: none;
    z-index: 0;
}

.page-bg-grid {
    position: fixed;
    inset: 0;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.02) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.02) 1px, transparent 1px);
    background-size: 50px 50px;
    pointer-events: none;
    z-index: 0;
    -webkit-mask-image: radial-gradient(ellipse at center, black 5%, transparent 75%);
    mask-image: radial-gradient(ellipse at center, black 5%, transparent 75%);
}

/* ── Navbar ──────────────────────────────────────────── */
.navbar {
    background-color: rgba(10, 10, 10, 0.95) !important;
    backdrop-filter: blur(10px);
    padding: 1rem 0;
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.5);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.navbar-brand {
    display: flex;
    align-items: center;
}

.navbar-logo-icon {
    height: 40px;
    width: 40px;
    padding: 5px;
    background: var(--gradient-red);
    border-radius: 10px;
    margin-right: 0.75rem;
    object-fit: contain;
}

.navbar-logo-text {
    height: 40px;
}

/* ── Page container ──────────────────────────────────── */
.history-container {
    max-width: 1200px;
    margin: 0 auto;
    position: relative;
    z-index: 1;
}

/* ── Header ──────────────────────────────────────────── */
.history-header {
    text-align: center;
    margin-bottom: 3rem;
}

.history-eyebrow {
    display: inline-block;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.15em;
    color: var(--accent-red);
    background: rgba(196, 69, 54, 0.1);
    border: 1px solid rgba(196, 69, 54, 0.25);
    border-radius: 20px;
    padding: 0.35rem 1rem;
    margin-bottom: 1rem;
}

.history-title {
    color: #fff;
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 0.75rem;
}

.history-title .gradient-text {
    background: linear-gradient(135deg, #c44536, #e07b6e);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.history-subtitle {
    color: var(--text-secondary);
    font-size: 1rem;
}

/* ── States ──────────────────────────────────────────── */
.loading-state,
.empty-state,
.error-state {
    text-align: center;
    padding: 5rem 2rem;
    color: var(--text-secondary);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.state-icon-wrap {
    width: 80px;
    height: 80px;
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1.5rem;
    font-size: 2rem;
}

.empty-state .state-icon-wrap {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--dark-card-border);
    color: var(--text-muted);
}

.error-state .state-icon-wrap {
    background: rgba(196, 69, 54, 0.1);
    border: 1px solid rgba(196, 69, 54, 0.2);
    color: var(--accent-red);
}

.loading-state .spinner-border {
    width: 48px;
    height: 48px;
    border-width: 3px;
    border-color: rgba(196, 69, 54, 0.2);
    border-top-color: var(--accent-red);
    margin-bottom: 1.5rem;
}

.loading-state h3,
.empty-state h3,
.error-state h3 {
    color: #fff;
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.empty-state p,
.error-state p {
    font-size: 0.9rem;
    max-width: 340px;
}

/* ── Buttons ─────────────────────────────────────────── */
.btn-primary {
    background: var(--gradient-red) !important;
    border: none !important;
    color: white !important;
    font-weight: 600;
    border-radius: 50px;
    padding: 0.65rem 1.5rem;
    box-shadow: 0 4px 16px rgba(196, 69, 54, 0.3);
    transition: all 0.25s;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(196, 69, 54, 0.45);
}

.btn-outline-primary {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: #fff;
    padding: 0.6rem 1.5rem;
    font-weight: 500;
    border-radius: 50px;
    transition: all 0.25s;
}

.btn-outline-primary:hover {
    background: var(--gradient-red);
    border-color: transparent;
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(196, 69, 54, 0.4);
}

/* ── History Grid ────────────────────────────────────── */
.history-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-top: 1rem;
}

.history-card {
    background: var(--dark-card);
    border: 1px solid var(--dark-card-border);
    border-radius: 16px;
    overflow: hidden;
    cursor: pointer;
    transition: border-color 0.2s, transform 0.2s, box-shadow 0.2s;
}

.history-card:hover {
    transform: translateY(-4px);
    border-color: rgba(196, 69, 54, 0.45);
    box-shadow: 0 12px 32px rgba(196, 69, 54, 0.18);
}

.history-card-image {
    width: 100%;
    height: 220px;
    object-fit: cover;
    background: #0a0a0a;
    display: block;
}

.history-card-content {
    padding: 1.25rem 1.5rem;
}

.history-card-id {
    color: var(--text-muted);
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    margin-bottom: 0.4rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.history-card-color {
    color: #fff;
    font-size: 1.05rem;
    font-weight: 600;
    margin-bottom: 0.3rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.history-card-client {
    color: var(--text-secondary, #a0a0b0);
    font-size: 0.82rem;
    font-weight: 500;
    margin-bottom: 0.3rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.history-card-client i {
    font-size: 0.75rem;
    opacity: 0.7;
}

.history-card-type {
    color: var(--text-muted);
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 600;
    margin-bottom: 0.75rem;
}

.history-card-date {
    color: var(--text-secondary);
    font-size: 0.82rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

/* ── Modal ───────────────────────────────────────────── */
.modal-content {
    background: var(--dark-card);
    border: 1px solid rgba(255, 255, 255, 0.09);
    border-radius: 20px;
}

.modal-header {
    border-bottom: 1px solid rgba(255, 255, 255, 0.07);
    padding: 1.25rem 1.5rem;
}

.modal-title {
    color: #fff;
    font-weight: 600;
    font-size: 1rem;
}

.image-toggle-buttons {
    display: flex;
    gap: 0.75rem;
    justify-content: center;
}

.image-toggle-buttons .btn {
    flex: 1;
    max-width: 180px;
    font-size: 0.88rem;
}

.image-toggle-buttons .btn.active {
    background: var(--gradient-red);
    border-color: transparent;
    color: white;
    box-shadow: 0 4px 12px rgba(196, 69, 54, 0.35);
}

.image-viewer {
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid var(--dark-card-border);
    border-radius: 14px;
    padding: 1rem;
    min-height: 360px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.image-viewer img {
    max-height: 480px;
    object-fit: contain;
    border-radius: 8px;
}

.image-details {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--dark-card-border);
    border-radius: 14px;
    padding: 1.5rem;
    height: 100%;
}

.detail-item {
    margin-bottom: 1.25rem;
    padding-bottom: 1.25rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.detail-item:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.detail-label {
    color: var(--text-muted);
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 0.35rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.detail-label i {
    color: var(--accent-red);
}

.detail-value {
    color: #fff;
    font-size: 1rem;
    font-weight: 500;
}

.detail-actions .btn {
    background: var(--gradient-red);
    border: none;
    color: white;
    padding: 0.65rem 1.5rem;
    font-weight: 600;
    border-radius: 50px;
    transition: all 0.25s;
    box-shadow: 0 4px 14px rgba(196, 69, 54, 0.3);
}

.detail-actions .btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(196, 69, 54, 0.45);
}

/* ── Auth Loader ─────────────────────────────────────── */
#authLoader {
    position: fixed;
    inset: 0;
    background: var(--dark-bg);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    transition: opacity 0.3s;
}

#authLoader.fade-out {
    opacity: 0;
    pointer-events: none;
}

.auth-loader-spinner {
    width: 48px;
    height: 48px;
    border: 3px solid rgba(196, 69, 54, 0.15);
    border-top-color: var(--accent-red);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.auth-loader-text {
    color: var(--text-secondary);
    margin-top: 1rem;
    font-size: 0.9rem;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ── Responsive ──────────────────────────────────────── */
@media (max-width: 768px) {
    .navbar-brand {
        position: relative !important;
        left: auto !important;
        transform: none !important;
        margin-left: auto;
    }

    .history-title { font-size: 1.9rem; }

    .history-grid {
        grid-template-columns: 1fr;
    }
}


/* Button Styles */
.btn-primary {
    background: var(--gradient-red) !important;
    border: 1px solid white !important;
    color: white !important;
    font-weight: 500;
    transition: all 0.3s;
    border-radius: 50px;
}

.btn-primary i {
    color: white !important;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(196, 69, 54, 0.4);
}

/* Navbar Styles */
.navbar {
    background-color: rgba(10, 10, 10, 0.95) !important;
    backdrop-filter: blur(10px);
    padding: 1rem 0;
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.5);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.navbar-brand {
    display: flex;
    align-items: center;
}

.navbar-logo-icon {
    height: 40px;
    width: 40px;
    padding: 5px;
    background: linear-gradient(135deg, #c44536, #d95f4e);
    border-radius: 10px;
    margin-right: 0.75rem;
    object-fit: contain;
}

.navbar-logo-text {
    height: 40px;
}

body {
    font-family: 'Raleway', sans-serif;
    background: linear-gradient(135deg, #0a0a0a 0%, #1a1a1a 100%);
    min-height: 100vh;
    padding: 80px 20px 40px;
}

.history-container {
    max-width: 1200px;
    margin: 0 auto;
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: #a0a0a0;
    text-decoration: none;
    margin-bottom: 2rem;
    transition: color 0.3s;
}

.back-link:hover {
    color: #ffffff;
}

.history-header {
    text-align: center;
    margin-bottom: 3rem;
}

.history-title {
    color: #ffffff;
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.history-title i {
    color: #c44536;
}

.history-subtitle {
    color: #a0a0a0;
    font-size: 1.1rem;
}

/* States */
.loading-state,
.empty-state,
.error-state {
    text-align: center;
    padding: 4rem 2rem;
    color: #a0a0a0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.loading-state .spinner-border {
    width: 4rem;
    height: 4rem;
    border-width: 0.4em;
    border-color: #c44536;
    border-right-color: transparent;
}

.loading-state h3 {
    color: #ffffff;
    font-weight: 600;
    margin-top: 1.5rem;
}

.empty-state i,
.error-state i {
    color: #6a6a6a;
}

.error-state i {
    color: #c44536;
}

/* Button Styles - Override Bootstrap */
.btn-outline-primary {
    background: transparent;
    border: 1px solid #2a2a2a;
    color: #ffffff;
    padding: 0.6rem 1.5rem;
    font-weight: 500;
    border-radius: 50px;
    transition: all 0.3s;
}

.btn-outline-primary:hover {
    background: linear-gradient(135deg, #c44536 0%, #d95f4e 100%);
    border-color: white;
    color: white;
    transform: translateY(-2px);
}

/* History Grid */
.history-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 2rem;
    margin-top: 2rem;
}

.history-card {
    background-color: #1a1a1a;
    border: 1px solid #2a2a2a;
    border-radius: 16px;
    overflow: hidden;
    transition: all 0.3s;
    cursor: pointer;
}

.history-card:hover {
    transform: translateY(-5px);
    border-color: #c44536;
    box-shadow: 0 10px 30px rgba(196, 69, 54, 0.3);
}

.history-card-image {
    width: 100%;
    height: 250px;
    object-fit: cover;
    background-color: #0a0a0a;
}

.history-card-content {
    padding: 1.5rem;
}

.history-card-id {
    color: #6a6a6a;
    font-size: 0.85rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.history-card-color {
    color: #c44536;
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.history-card-client {
    color: #a0a0a0;
    font-size: 0.85rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.history-card-type {
    color: #6a6a6a;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 0.75rem;
}

.history-card-date {
    color: #a0a0a0;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Modal Styles */
.modal-content {
    background-color: #1a1a1a;
    border: 1px solid #2a2a2a;
}

.modal-header {
    border-bottom: 1px solid #2a2a2a;
}

.modal-title {
    color: #ffffff;
}

.image-toggle-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
}

.image-toggle-buttons .btn {
    flex: 1;
    max-width: 200px;
}

.image-toggle-buttons .btn.active {
    background: linear-gradient(135deg, #c44536 0%, #d95f4e 100%);
    border-color: white;
    color: white;
}

.image-viewer {
    background-color: #0a0a0a;
    border-radius: 12px;
    padding: 1rem;
    min-height: 400px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.image-viewer img {
    max-height: 500px;
    object-fit: contain;
}

.image-details {
    background-color: #0a0a0a;
    border-radius: 12px;
    padding: 1.5rem;
    height: 100%;
}

.detail-item {
    margin-bottom: 1.5rem;
}

.detail-label {
    color: #6a6a6a;
    font-size: 0.85rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.5rem;
}

.detail-value {
    color: #ffffff;
    font-size: 1.1rem;
    font-weight: 500;
}

.detail-actions .btn {
    background: linear-gradient(135deg, #c44536 0%, #d95f4e 100%);
    border: 1px solid white;
    color: white;
    padding: 0.6rem 1.5rem;
    font-weight: 500;
    border-radius: 50px;
    transition: all 0.3s;
}

.detail-actions .btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(196, 69, 54, 0.4);
}

/* Auth Loader */
#authLoader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #0a0a0a 0%, #1a1a1a 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 1;
    transition: opacity 0.3s ease;
}

#authLoader.fade-out {
    opacity: 0;
    pointer-events: none;
}

.auth-loader-spinner {
    width: 50px;
    height: 50px;
    border: 3px solid #2a2a2a;
    border-top-color: #c44536;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.auth-loader-text {
    color: #a0a0a0;
    margin-top: 1rem;
    font-size: 1rem;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Responsive */
@media (max-width: 768px) {
    .navbar-brand {
        position: relative !important;
        left: auto !important;
        transform: none !important;
        margin-left: auto;
    }
    
    .history-grid {
        grid-template-columns: 1fr;
    }
    
    .history-title {
        font-size: 2rem;
    }
}
