/* CTB Ticketing System - Main Stylesheet */
/* Color Palette: Deep Forest Green + Gold + Cream */

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

:root {
    --forest-dark: #0f2318;
    --forest-mid: #1a3a2a;
    --forest-light: #2d5a3d;
    --forest-accent: #3d7a52;
    --gold: #c9a84c;
    --gold-light: #e2c06d;
    --gold-pale: #f5e9c8;
    --cream: #faf7f0;
    --white: #ffffff;
    --text-dark: #1a1a1a;
    --text-mid: #444444;
    --text-light: #777777;
    --border: #e0d9c8;
    --shadow-sm: 0 2px 8px rgba(15, 35, 24, 0.08);
    --shadow-md: 0 4px 20px rgba(15, 35, 24, 0.12);
    --shadow-lg: 0 8px 40px rgba(15, 35, 24, 0.16);
    --radius: 12px;
    --radius-sm: 8px;
    --radius-lg: 16px;
}

* { box-sizing: border-box; }

body {
    font-family: 'DM Sans', sans-serif;
    background: var(--cream);
    color: var(--text-dark);
    min-height: 100vh;
}

/* ===== NAVBAR ===== */
.ctb-navbar {
    background: linear-gradient(135deg, var(--forest-dark) 0%, var(--forest-mid) 100%);
    padding: 12px 20px;
    box-shadow: 0 2px 20px rgba(0,0,0,0.3);
    position: sticky;
    top: 0;
    z-index: 1000;
    border-bottom: 2px solid var(--gold);
}

.nav-logo {
    width: 48px;
    height: 48px;
    object-fit: contain;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.3));
}

.brand-text {
    display: flex;
    flex-direction: column;
    line-height: 1.1;
}

.brand-main {
    font-family: 'Playfair Display', serif;
    font-size: 18px;
    font-weight: 700;
    color: var(--gold);
    letter-spacing: 0.5px;
}

.brand-sub {
    font-size: 11px;
    color: rgba(255,255,255,0.6);
    letter-spacing: 0.8px;
    text-transform: uppercase;
}

.nav-welcome {
    color: rgba(255,255,255,0.85);
    font-size: 14px;
    display: flex;
    align-items: center;
}

.nav-welcome strong {
    color: var(--gold-light);
}

.role-badge {
    background: rgba(201, 168, 76, 0.2);
    color: var(--gold-light);
    border: 1px solid rgba(201, 168, 76, 0.4);
    border-radius: 20px;
    padding: 1px 8px;
    font-size: 11px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.btn-outline-gold {
    border: 1.5px solid var(--gold);
    color: var(--gold);
    background: transparent;
    font-size: 13px;
    padding: 6px 14px;
    border-radius: 6px;
    transition: all 0.2s;
}
.btn-outline-gold:hover { background: var(--gold); color: var(--forest-dark); }

.btn-logout {
    background: rgba(220, 53, 69, 0.15);
    border: 1.5px solid rgba(220, 53, 69, 0.5);
    color: #ff6b7a;
    font-size: 13px;
    padding: 6px 14px;
    border-radius: 6px;
    transition: all 0.2s;
}
.btn-logout:hover { background: #dc3545; color: white; border-color: #dc3545; }

/* ===== MAIN LAYOUT ===== */
.page-wrapper {
    min-height: calc(100vh - 74px);
    padding: 30px 0 50px;
}

.page-header {
    background: linear-gradient(135deg, var(--forest-dark), var(--forest-light));
    color: white;
    padding: 40px 0;
    margin-bottom: 35px;
    position: relative;
    overflow: hidden;
}

.page-header::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -10%;
    width: 400px;
    height: 400px;
    border-radius: 50%;
    background: rgba(201, 168, 76, 0.05);
    pointer-events: none;
}

.page-header h1 {
    font-family: 'Playfair Display', serif;
    font-size: 2rem;
    color: var(--gold);
    margin-bottom: 6px;
}

.page-header p {
    color: rgba(255,255,255,0.7);
    font-size: 15px;
    margin: 0;
}

/* ===== CARDS ===== */
.ctb-card {
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
    overflow: hidden;
    transition: box-shadow 0.2s;
}

.ctb-card:hover { box-shadow: var(--shadow-md); }

.ctb-card-header {
    background: linear-gradient(135deg, var(--forest-dark), var(--forest-mid));
    color: white;
    padding: 20px 25px;
    border-bottom: 2px solid var(--gold);
}

.ctb-card-header h5 {
    font-family: 'Playfair Display', serif;
    color: var(--gold);
    margin: 0;
    font-size: 1.1rem;
}

.ctb-card-header p {
    color: rgba(255,255,255,0.65);
    margin: 4px 0 0;
    font-size: 13px;
}

.ctb-card-body { padding: 25px; }

/* ===== STAT CARDS ===== */
.stat-card {
    background: white;
    border-radius: var(--radius-lg);
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
    transition: all 0.25s;
    cursor: default;
}

.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
}

.stat-icon {
    width: 56px;
    height: 56px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    flex-shrink: 0;
}

.stat-icon.green { background: rgba(45, 90, 61, 0.12); color: var(--forest-light); }
.stat-icon.gold { background: rgba(201, 168, 76, 0.15); color: var(--gold); }
.stat-icon.red { background: rgba(220, 53, 69, 0.1); color: #dc3545; }
.stat-icon.blue { background: rgba(13, 110, 253, 0.1); color: #0d6efd; }
.stat-icon.orange { background: rgba(255, 136, 0, 0.1); color: #ff8800; }

.stat-number {
    font-family: 'Times New Roman', Times, serif;
    font-size: 2rem;
    font-weight: 700;
    color: var(--forest-dark);
    line-height: 1;
    margin-bottom: 4px;
}

.stat-label {
    font-size: 13px;
    color: var(--text-light);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ===== FORMS ===== */
.ctb-form .form-label {
    font-weight: 600;
    color: var(--forest-mid);
    font-size: 14px;
    margin-bottom: 6px;
}

.ctb-form .form-control,
.ctb-form .form-select {
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    font-size: 14px;
    transition: all 0.2s;
    background: #fafaf8;
}

.ctb-form .form-control:focus,
.ctb-form .form-select:focus {
    border-color: var(--gold);
    box-shadow: 0 0 0 3px rgba(201, 168, 76, 0.15);
    background: white;
}

.ctb-form .form-control[readonly] {
    background: var(--gold-pale);
    color: var(--text-mid);
}

.required-star { color: #dc3545; }

/* ===== BUTTONS ===== */
.btn-ctb-primary {
    background: linear-gradient(135deg, var(--forest-mid), var(--forest-light));
    color: white;
    border: none;
    padding: 12px 28px;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 15px;
    letter-spacing: 0.3px;
    transition: all 0.25s;
    box-shadow: 0 3px 10px rgba(15, 35, 24, 0.25);
}

.btn-ctb-primary:hover {
    background: linear-gradient(135deg, var(--forest-light), var(--forest-accent));
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(15, 35, 24, 0.3);
    color: white;
}

.btn-gold {
    background: linear-gradient(135deg, var(--gold), var(--gold-light));
    color: var(--forest-dark);
    border: none;
    padding: 10px 22px;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 14px;
    transition: all 0.25s;
}

.btn-gold:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(201, 168, 76, 0.35);
    color: var(--forest-dark);
}

/* ===== TABLES ===== */
.ctb-table-wrapper {
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
}

.ctb-table {
    margin: 0;
    font-size: 14px;
}

.ctb-table thead th {
    background: var(--forest-dark);
    color: var(--gold);
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    padding: 14px 16px;
    border: none;
    white-space: nowrap;
}

.ctb-table tbody tr {
    transition: background 0.15s;
    border-color: var(--border);
}

.ctb-table tbody tr:hover { background: rgba(201, 168, 76, 0.04); }

.ctb-table tbody td {
    padding: 13px 16px;
    vertical-align: middle;
    border-color: #f0ece0;
}

.ticket-num {
    font-family: 'DM Sans', sans-serif;
    font-weight: 700;
    color: var(--forest-mid);
    font-size: 13px;
}

/* ===== BADGES ===== */
.badge { font-size: 11px; font-weight: 600; padding: 5px 10px; border-radius: 20px; }
.badge.bg-danger { background: #dc3545 !important; }
.badge.bg-warning { background: #ff8800 !important; color: white !important; }
.badge.bg-success { background: #28a745 !important; }
.badge.bg-primary { background: #0d6efd !important; }
.badge.bg-secondary { background: #6c757d !important; }

/* Overdue special styling */
.overdue-badge {
    background: linear-gradient(135deg, #dc3545, #b02a37);
    color: white;
    animation: pulse-red 2s infinite;
}

@keyframes pulse-red {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.75; }
}

/* ===== FILTER BAR ===== */
.filter-bar {
    background: white;
    border-radius: var(--radius);
    padding: 20px 24px;
    margin-bottom: 20px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
}

.filter-bar .form-control,
.filter-bar .form-select {
    font-size: 14px;
    border-color: var(--border);
    border-radius: var(--radius-sm);
}

.filter-bar .form-control:focus,
.filter-bar .form-select:focus {
    border-color: var(--gold);
    box-shadow: 0 0 0 3px rgba(201, 168, 76, 0.1);
}

/* ===== CHAT ===== */
.chat-container {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.chat-messages {
    height: 380px;
    overflow-y: auto;
    padding: 20px;
    background: #fafaf8;
    display: flex;
    flex-direction: column;
    gap: 12px;
    scrollbar-width: thin;
    scrollbar-color: var(--gold) transparent;
}

.chat-messages::-webkit-scrollbar { width: 5px; }
.chat-messages::-webkit-scrollbar-track { background: transparent; }
.chat-messages::-webkit-scrollbar-thumb { background: var(--gold); border-radius: 3px; }

.chat-bubble-wrapper {
    display: flex;
    gap: 10px;
    max-width: 75%;
}

.chat-bubble-wrapper.own { align-self: flex-end; flex-direction: row-reverse; }

.chat-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 700;
    flex-shrink: 0;
}

.chat-avatar.it { background: var(--forest-mid); color: var(--gold); }
.chat-avatar.user { background: var(--gold); color: var(--forest-dark); }
.chat-avatar.admin { background: #6c757d; color: white; }

.chat-bubble {
    background: white;
    border: 1px solid var(--border);
    border-radius: 16px 16px 16px 4px;
    padding: 10px 15px;
    font-size: 14px;
    box-shadow: var(--shadow-sm);
}

.chat-bubble-wrapper.own .chat-bubble {
    background: var(--forest-dark);
    color: white;
    border: none;
    border-radius: 16px 16px 4px 16px;
}

.chat-meta {
    font-size: 11px;
    color: var(--text-light);
    margin-top: 4px;
}

.chat-bubble-wrapper.own .chat-meta { text-align: right; color: rgba(255,255,255,0.6); }

.chat-input-area {
    background: white;
    border-top: 1px solid var(--border);
    padding: 15px 20px;
    display: flex;
    gap: 10px;
    align-items: flex-end;
}

.chat-input-area textarea {
    flex: 1;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    font-size: 14px;
    resize: none;
    font-family: 'DM Sans', sans-serif;
    min-height: 42px;
    max-height: 100px;
    transition: border-color 0.2s;
}

.chat-input-area textarea:focus {
    border-color: var(--gold);
    box-shadow: 0 0 0 3px rgba(201, 168, 76, 0.1);
    outline: none;
}

.chat-send-btn {
    background: linear-gradient(135deg, var(--forest-mid), var(--forest-light));
    color: white;
    border: none;
    width: 44px;
    height: 44px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    cursor: pointer;
    transition: all 0.2s;
    flex-shrink: 0;
}

.chat-send-btn:hover {
    transform: scale(1.05);
    background: linear-gradient(135deg, var(--forest-light), var(--forest-accent));
}

/* ===== PRIORITY INDICATORS ===== */
.priority-emergency { color: #dc3545 !important; }
.priority-high { color: #ff8800 !important; }
.priority-normal { color: #28a745 !important; }

.priority-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 6px;
}

.priority-dot.emergency { background: #dc3545; animation: pulse-red 1.5s infinite; }
.priority-dot.high { background: #ff8800; }
.priority-dot.normal { background: #28a745; }

/* ===== MODAL ===== */
.ctb-modal .modal-header {
    background: linear-gradient(135deg, var(--forest-dark), var(--forest-mid));
    color: white;
    border-bottom: 2px solid var(--gold);
}

.ctb-modal .modal-title {
    font-family: 'Playfair Display', serif;
    color: var(--gold);
}

.ctb-modal .btn-close { filter: invert(1); }

/* ===== ALERTS ===== */
.ctb-alert {
    border-radius: var(--radius-sm);
    border: none;
    padding: 14px 18px;
    font-size: 14px;
}

.ctb-alert.success {
    background: rgba(40, 167, 69, 0.1);
    color: #155724;
    border-left: 4px solid #28a745;
}

.ctb-alert.error {
    background: rgba(220, 53, 69, 0.1);
    color: #721c24;
    border-left: 4px solid #dc3545;
}

/* ===== EMPTY STATE ===== */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-light);
}

.empty-state i {
    font-size: 60px;
    color: var(--border);
    margin-bottom: 15px;
}

.empty-state h5 { color: var(--text-mid); font-weight: 600; margin-bottom: 8px; }

/* ===== LOGIN PAGE ===== */
.login-page {
    min-height: 100vh;
    background: linear-gradient(135deg, var(--forest-dark) 0%, var(--forest-mid) 50%, var(--forest-light) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.login-card {
    background: white;
    border-radius: 20px;
    width: 100%;
    max-width: 440px;
    overflow: hidden;
    box-shadow: 0 25px 60px rgba(0,0,0,0.4);
}

.login-header {
    background: linear-gradient(135deg, var(--forest-dark), var(--forest-mid));
    padding: 40px 30px 30px;
    text-align: center;
    border-bottom: 3px solid var(--gold);
}

.login-logo {
    width: 90px;
    height: 90px;
    object-fit: contain;
    filter: drop-shadow(0 4px 8px rgba(0,0,0,0.4));
    margin-bottom: 15px;
}

.login-title {
    font-family: 'Playfair Display', serif;
    color: var(--gold);
    font-size: 1.6rem;
    margin: 0 0 4px;
}

.login-subtitle {
    color: rgba(255,255,255,0.65);
    font-size: 13px;
    margin: 0;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.login-body { padding: 35px 30px; }

.login-body .form-label {
    font-weight: 600;
    color: var(--forest-mid);
    font-size: 14px;
}

.login-body .form-control {
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 11px 14px;
    font-size: 14px;
    transition: all 0.2s;
}

.login-body .form-control:focus {
    border-color: var(--gold);
    box-shadow: 0 0 0 3px rgba(201, 168, 76, 0.15);
}

.btn-login {
    background: linear-gradient(135deg, var(--forest-dark), var(--forest-mid));
    color: white;
    border: none;
    padding: 13px;
    width: 100%;
    border-radius: var(--radius-sm);
    font-size: 15px;
    font-weight: 600;
    letter-spacing: 0.5px;
    transition: all 0.25s;
    box-shadow: 0 4px 15px rgba(15, 35, 24, 0.3);
}

.btn-login:hover {
    background: linear-gradient(135deg, var(--forest-mid), var(--forest-accent));
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(15, 35, 24, 0.35);
    color: white;
}

/* ===== STATUS ACTION BUTTONS ===== */
.btn-status-ongoing {
    background: #0d6efd;
    color: white;
    border: none;
    padding: 5px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-status-ongoing:hover { background: #0b5ed7; }

.btn-status-completed {
    background: #28a745;
    color: white;
    border: none;
    padding: 5px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-status-completed:hover { background: #218838; }

/* ===== QUICK ACTIONS ===== */
.quick-action-card {
    background: white;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 28px 24px;
    text-align: center;
    cursor: pointer;
    transition: all 0.25s;
    text-decoration: none;
    display: block;
    color: inherit;
    box-shadow: var(--shadow-sm);
}

.quick-action-card:hover {
    border-color: var(--gold);
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
    color: inherit;
}

.quick-action-icon {
    width: 64px;
    height: 64px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 26px;
    margin: 0 auto 16px;
}

.quick-action-icon.submit { background: linear-gradient(135deg, var(--forest-mid), var(--forest-light)); color: var(--gold); }
.quick-action-icon.history { background: linear-gradient(135deg, var(--gold), var(--gold-light)); color: var(--forest-dark); }
.quick-action-icon.all-tickets { background: linear-gradient(135deg, #0d6efd, #0b5ed7); color: white; }
.quick-action-icon.reports { background: linear-gradient(135deg, #dc3545, #b02a37); color: white; }

.quick-action-title {
    font-weight: 700;
    color: var(--forest-dark);
    font-size: 16px;
    margin-bottom: 6px;
}

.quick-action-desc {
    font-size: 13px;
    color: var(--text-light);
    margin: 0;
}

/* ===== TABS ===== */
.ctb-tabs .nav-link {
    color: var(--text-mid);
    border-radius: 8px 8px 0 0;
    padding: 10px 22px;
    font-weight: 600;
    font-size: 14px;
    border: 1px solid transparent;
    transition: all 0.2s;
}

.ctb-tabs .nav-link:hover { color: var(--forest-mid); background: rgba(201,168,76,0.05); }

.ctb-tabs .nav-link.active {
    background: var(--forest-dark);
    color: var(--gold);
    border-color: var(--gold) var(--gold) transparent;
}

/* ===== TICKET DETAIL ===== */
.ticket-detail-field {
    margin-bottom: 16px;
}

.ticket-detail-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-light);
    font-weight: 600;
    margin-bottom: 4px;
}

.ticket-detail-value {
    font-size: 15px;
    color: var(--text-dark);
    font-weight: 500;
}

/* ===== FOOTER ===== */
.ctb-footer {
    background: var(--forest-dark);
    color: rgba(255,255,255,0.5);
    text-align: center;
    padding: 20px;
    font-size: 13px;
    border-top: 2px solid var(--gold);
    margin-top: 40px;
}

.ctb-footer span { color: var(--gold); }

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--cream); }
::-webkit-scrollbar-thumb { background: var(--forest-light); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--forest-mid); }

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    .page-header { padding: 25px 0; }
    .page-header h1 { font-size: 1.4rem; }
    .stat-card { padding: 16px; }
    .stat-number { font-size: 1.5rem; }
    .ctb-card-body { padding: 16px; }
    .quick-action-card { padding: 20px 16px; }
    .nav-welcome { display: none !important; }
    .chat-messages { height: 280px; }
    .chat-bubble-wrapper { max-width: 90%; }
}

@media (max-width: 576px) {
    .filter-bar { padding: 15px; }
    .ctb-table { font-size: 13px; }
    .ctb-table thead th, .ctb-table tbody td { padding: 10px 12px; }
}

/* ===== ANIMATIONS ===== */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.fade-in-up { animation: fadeInUp 0.4s ease forwards; }

.delay-1 { animation-delay: 0.1s; }
.delay-2 { animation-delay: 0.2s; }
.delay-3 { animation-delay: 0.3s; }
.delay-4 { animation-delay: 0.4s; }

/* ===== MISC ===== */
.divider-gold {
    border: none;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--gold), transparent);
    margin: 25px 0;
}

.text-gold { color: var(--gold) !important; }
.text-forest { color: var(--forest-mid) !important; }
.bg-forest { background: var(--forest-dark) !important; }

.notification-dot {
    width: 8px;
    height: 8px;
    background: #dc3545;
    border-radius: 50%;
    display: inline-block;
    animation: pulse-red 1.5s infinite;
}

.chat-btn-wrapper {
    position: relative;
}

.unread-badge {
    position: absolute;
    top: -6px;
    right: -6px;
    background: #dc3545;
    color: white;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    font-size: 11px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
}

/* Print styles for PDF */
@media print {
    .ctb-navbar, .ctb-footer, .btn, .filter-bar { display: none !important; }
    .ctb-card { box-shadow: none; border: 1px solid #ccc; }
}
