@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap');

html {
    scroll-behavior: smooth;
}
body {
    font-family: var(--ct-font-sans);
    background-color: var(--ct-background);
    background-image: var(--ct-gradient-bg);
    background-size: cover;
    background-attachment: fixed;
    color: var(--ct-text-main);
    min-height: 100vh;
    overflow-x: hidden;
}

/* Modern Smooth Page Animations */
@keyframes smoothFadeIn {
    0% { opacity: 0; transform: translateY(15px); }
    100% { opacity: 1; transform: translateY(0); }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.main-content-offset, .auth-container {
    animation: smoothFadeIn 0.55s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}

/* Fixed Sidebar Layout Utilities */
@media (min-width: 768px) {
    .fixed-sidebar-col {
        position: fixed !important;
        left: 0;
        top: 0;
        bottom: 0;
        width: 280px !important;
        z-index: 1030;
        overflow-y: auto;
        border-right: 1px solid var(--ct-border);
    }
    .main-content-offset {
        margin-left: 280px !important;
        width: calc(100% - 280px) !important;
        min-height: 100vh;
        display: flex;
        flex-direction: column;
    }
}

.glassmorphism {
    background: var(--ct-surface);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--ct-border);
    box-shadow: var(--ct-shadow-soft);
    border-radius: var(--ct-radius-xl);
    transition: var(--ct-transition);
}

.glassmorphism:hover {
    transform: translateY(-4px);
    box-shadow: var(--ct-shadow-hover);
}

.btn-primary {
    background: var(--ct-gradient-primary);
    border: none;
    border-radius: var(--ct-radius-lg);
    box-shadow: var(--ct-shadow-btn);
    transition: var(--ct-transition);
    font-weight: 600;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(5, 150, 105, 0.3);
    filter: brightness(1.1);
}

/* Global Bootstrap Overrides */
.btn-outline-primary {
    color: var(--ct-primary) !important;
    border-color: var(--ct-primary) !important;
}

.btn-outline-primary:hover {
    background-color: var(--ct-primary) !important;
    border-color: var(--ct-primary) !important;
    color: #ffffff !important;
}

.text-primary, .page-link {
    color: var(--ct-primary) !important;
}

.page-item.active .page-link {
    background-color: var(--ct-primary) !important;
    border-color: var(--ct-primary) !important;
    color: #ffffff !important;
}

.bg-primary {
    background-color: var(--ct-primary) !important;
}

.border-primary {
    border-color: var(--ct-primary) !important;
}

.navbar {
    background: rgba(5, 150, 105, 0.95) !important;
    backdrop-filter: blur(10px);
    border-bottom: 2px solid var(--ct-accent);
}

h1, h2, h3, h4, h5, h6 {
    color: var(--ct-text-main);
    font-weight: 800;
    letter-spacing: -0.02em;
}

.text-gradient {
    background: var(--ct-gradient-primary);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    display: inline-block;
}

.camera-preview img {
    max-width: 220px;
    max-height: 220px;
    object-fit: cover;
}

.request-ticket {
    max-width: 7.25in;
    margin: 0 auto;
    background: #ffffff;
    color: #1f2937;
}

.ticket-header {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    align-items: flex-start;
    border-bottom: 2px dashed #cbd5e1;
    padding-bottom: 1rem;
    margin-bottom: 1.25rem;
}

.ticket-label {
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--ct-primary);
    margin-bottom: 0.35rem;
}

.ticket-status-wrap {
    text-align: right;
}

.ticket-status {
    font-size: 0.95rem;
}

.ticket-date {
    font-size: 0.82rem;
    margin-top: 0.5rem;
}

.ticket-body {
    display: grid;
    grid-template-columns: 220px minmax(0, 1fr);
    gap: 1.25rem;
    align-items: start;
}

.ticket-qr-panel {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.qr-frame {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 0.75rem;
    border: 1px solid #dbe4f0;
    border-radius: 0.9rem;
    background: #ffffff;
}

.ticket-qr-image {
    width: 100%;
    max-width: 190px;
    height: auto;
    display: block;
    background: #ffffff;
}

.ticket-details {
    min-width: 0;
}

.ticket-detail-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.9rem 1rem;
}

.ticket-detail-item {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.ticket-detail-label {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #64748b;
    margin-bottom: 0.18rem;
}

.ticket-detail-value {
    font-size: 0.98rem;
    font-weight: 500;
    color: #0f172a;
    word-break: break-word;
}

.ticket-description {
    margin-top: 1rem;
    padding-top: 0.9rem;
    border-top: 1px solid #e2e8f0;
}

.admin-sticky-stack {
    position: sticky;
    top: 1rem;
}

.sla-row-warning td {
    background: rgba(255, 193, 7, 0.08);
}

.sla-row-danger td {
    background: rgba(220, 53, 69, 0.08);
}

.action-timeline-list {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.action-timeline-list::before {
    content: '';
    position: absolute;
    top: 0.35rem;
    bottom: 0.35rem;
    left: 0.38rem;
    width: 2px;
    background: linear-gradient(180deg, var(--ct-primary-light) 0%, var(--ct-border) 100%);
}

.action-timeline-item {
    position: relative;
    display: flex;
    gap: 0.85rem;
    align-items: flex-start;
}

.action-timeline-dot {
    width: 0.8rem;
    height: 0.8rem;
    border-radius: 50%;
    background: var(--ct-primary);
    box-shadow: 0 0 0 5px rgba(5, 150, 105, 0.12);
    margin-top: 0.18rem;
    position: relative;
    z-index: 1;
    flex-shrink: 0;
}

.action-timeline-content {
    min-width: 0;
}

@media (max-width: 767.98px) {
    .ticket-header {
        flex-direction: column;
    }

    .ticket-status-wrap {
        text-align: left;
    }

    .ticket-body {
        grid-template-columns: 1fr;
    }

    .ticket-qr-panel {
        align-items: center;
    }

    .ticket-detail-grid {
        grid-template-columns: 1fr;
    }

    .admin-sticky-stack {
        position: static;
    }
}

/* ── Status Tracker ── */
.status-tracker-wrap {
    display: flex;
    align-items: flex-start;
    gap: 0;
    width: 100%;
    overflow-x: auto;
    padding-bottom: 0.5rem;
}

.status-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
    min-width: 80px;
    position: relative;
}

.step-node {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    z-index: 1;
    transition: transform 0.3s ease;
}

.step-done .step-node {
    background: #f0fdf4;
    border: 2px solid var(--ct-primary);
}

.step-active .step-node {
    background: var(--ct-primary);
    border: 2px solid var(--ct-primary);
    animation: active-node-glow 2s ease-in-out infinite;
}

.step-pending .step-node {
    background: #f9fafb;
    border: 2px solid var(--ct-border);
}

@keyframes active-node-glow {
    0%, 100% { box-shadow: 0 0 0 4px rgba(5, 150, 105, 0.2); }
    50%       { box-shadow: 0 0 0 12px rgba(5, 150, 105, 0.08); }
}

/* SVG icon stroke/fill per state */
.step-done   .si-main { stroke: var(--ct-primary); fill: none; }
.step-done   .si-fill { fill: var(--ct-primary); stroke: none; }
.step-active .si-main { stroke: #ffffff; fill: none; }
.step-active .si-fill { fill: #ffffff; stroke: none; }
.step-pending .si-main { stroke: #9ca3af; fill: none; }
.step-pending .si-fill { fill: #9ca3af; stroke: none; }

/* Connector line */
.step-line {
    position: absolute;
    top: 26px;
    left: calc(50% + 26px);
    right: calc(-50% + 26px);
    height: 3px;
    background: #e2e8f0;
    border-radius: 2px;
    overflow: hidden;
    z-index: 0;
}

.step-line-fill {
    height: 100%;
    width: 0%;
    background: var(--ct-primary);
    border-radius: 2px;
}

.step-line-fill.filled {
    animation: line-fill-in 0.9s ease forwards;
}

@keyframes line-fill-in {
    from { width: 0%; }
    to   { width: 100%; }
}

/* Labels */
.step-label {
    font-size: 0.68rem;
    font-weight: 600;
    text-align: center;
    margin-top: 0.5rem;
    line-height: 1.3;
    max-width: 80px;
    word-break: break-word;
    color: #94a3b8;
}

.step-done .step-label   { color: var(--ct-primary); }
.step-active .step-label { color: var(--ct-primary); font-weight: 700; }

/* Pending: clock hand ticks */
@keyframes clock-tick {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}
.si-anim-clock .si-clock-hand {
    animation: clock-tick 4s steps(60, end) infinite;
    transform-box: fill-box;
    transform-origin: center;
}

/* Approved: thumbs-up bounce */
@keyframes thumb-bounce {
    0%, 100% { transform: translateY(0); }
    40%       { transform: translateY(-4px); }
    70%       { transform: translateY(-2px); }
}
.si-anim-thumb { animation: thumb-bounce 1.8s ease-in-out infinite; }

/* In Progress: gear spin */
@keyframes gear-spin {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}
.si-anim-gear .si-gear {
    animation: gear-spin 2s linear infinite;
    transform-box: fill-box;
    transform-origin: center;
}

/* Completed: shield pop */
@keyframes check-pop {
    0%, 100% { transform: scale(1); }
    50%       { transform: scale(1.18); }
}
.si-anim-check { animation: check-pop 2s ease-in-out infinite; }

/* Closed: padlock shake */
@keyframes lock-shake {
    0%, 100% { transform: rotate(0deg); }
    20%       { transform: rotate(-8deg); }
    40%       { transform: rotate(8deg); }
    60%       { transform: rotate(-4deg); }
    80%       { transform: rotate(4deg); }
}
.si-anim-lock { animation: lock-shake 3s ease-in-out infinite; }

/* Cancelled: X pulse-fade */
@keyframes x-fade {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0.35; }
}
.si-anim-cancel { animation: x-fade 2s ease-in-out infinite; }

/* Mobile */
@media (max-width: 575.98px) {
    .status-tracker-wrap { overflow-x: auto; }
    .step-label  { font-size: 0.62rem; max-width: 60px; }
    .step-node   { width: 44px; height: 44px; }
    .step-line   { top: 22px; left: calc(50% + 22px); right: calc(-50% + 22px); }
}

@media print {
    @page {
        margin: 0.25in;
    }

    body {
        background: #ffffff !important;
    }

    .navbar,
    footer,
    .no-print {
        display: none !important;
    }

    .container,
    .row,
    .col-md-9,
    .col-lg-8 {
        width: auto !important;
        max-width: none !important;
        margin: 0 !important;
        padding: 0 !important;
    }

    .glassmorphism {
        background: #ffffff !important;
        border: none !important;
        box-shadow: none !important;
        backdrop-filter: none !important;
    }

    .request-ticket {
        width: 7.25in;
        min-height: 3.5in;
        border: 1px solid #cbd5e1;
        border-radius: 0;
        padding: 0.28in !important;
        page-break-inside: avoid;
    }

    .ticket-qr-image {
        max-width: 1.9in;
    }

    /* Flatten tracker for print */
    .status-tracker-wrap {
        flex-wrap: wrap;
        gap: 0.5rem;
        overflow: visible;
    }

    .step-line { display: none; }

    .step-node {
        width: 36px !important;
        height: 36px !important;
        animation: none !important;
        box-shadow: none !important;
    }

    .step-icon-svg,
    .si-clock-hand,
    .si-gear,
    .si-thumb {
        animation: none !important;
    }

    .step-label { font-size: 0.65rem; }
}

/* Footer Styles */
.footer-skyline {
    width: 100%;
    margin-top: 3rem;
    overflow: hidden;
    position: relative;
    z-index: 10;
}

.footer-body {
    background-color: var(--ct-surface);
    padding: 4rem 0 3rem;
    border-top: 1px solid var(--ct-border);
    position: relative;
    z-index: 11;
}

.footer-seal img {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    object-fit: cover;
    box-shadow: var(--ct-shadow-sm);
}

.footer-col-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--ct-text-main);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 1.25rem;
}

.footer-desc {
    font-size: 0.875rem;
    color: var(--ct-text-muted);
    line-height: 1.6;
}

.footer-link {
    display: inline-block;
    width: 100%;
    font-size: 0.875rem;
    color: var(--ct-text-muted);
    text-decoration: none;
    margin-bottom: 0.5rem;
    transition: var(--ct-transition);
}

.footer-link:hover {
    color: var(--ct-primary);
    transform: translateX(4px);
}

.footer-bottom {
    background-color: var(--ct-primary);
    color: #ffffff;
    text-align: center;
    padding: 1.25rem;
    font-size: 0.875rem;
    font-weight: 500;
    position: relative;
    z-index: 12;
}
