/* PIGEON - Category Appointment Portal */
:root {
    --primary: #667eea;
    --primary-dark: #764ba2;
    --success: #4caf50;
    --warning: #ff9800;
    --danger: #f44336;
    --info: #2196F3;
    --bg: #f0f2f6;
    --card-bg: #ffffff;
    --text: #333;
    --text-muted: #666;
    --border: #e6e9ef;
    --radius: 8px;
    --sidebar-width: 240px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; background: var(--bg); color: var(--text); line-height: 1.6; }

/* ===== SIDEBAR LAYOUT ===== */
.app-layout { display: flex; min-height: 100vh; }
.sidebar { width: var(--sidebar-width); background: var(--card-bg); border-right: 1px solid var(--border); position: fixed; top: 0; left: 0; height: 100vh; overflow-y: auto; padding: 16px; z-index: 200; }
.main-area { margin-left: var(--sidebar-width); flex: 1; display: flex; flex-direction: column; min-height: 100vh; }

/* Sidebar brand */
.sidebar-brand { display: flex; align-items: center; gap: 10px; padding-bottom: 16px; border-bottom: 1px solid var(--border); margin-bottom: 16px; }
.sidebar-logo { font-size: 28px; }
.sidebar-title { font-size: 16px; font-weight: 700; color: var(--primary); }
.sidebar-tagline { font-size: 10px; color: var(--text-muted); }

/* Sidebar sections */
.sidebar-section { margin-bottom: 20px; }
.sidebar-heading { font-size: 12px; text-transform: uppercase; color: var(--text-muted); margin-bottom: 8px; letter-spacing: 0.5px; }

/* Sidebar nav */
.sidebar-nav { display: flex; flex-direction: column; gap: 2px; }
.sidebar-link { display: block; padding: 8px 12px; border-radius: 6px; text-decoration: none; color: var(--text); font-size: 13px; transition: background 0.2s; }
.sidebar-link:hover { background: #f0f0ff; color: var(--primary); }

/* Sidebar notifications */
.sidebar-notifications { max-height: 200px; overflow-y: auto; }
.sidebar-notif { display: flex; flex-direction: column; padding: 6px 8px; border-radius: 4px; margin-bottom: 4px; font-size: 11px; background: #f9f9f9; border-left: 3px solid var(--info); }
.sidebar-notif.success { border-left-color: var(--success); }
.sidebar-notif.warning { border-left-color: var(--warning); }
.sidebar-notif.error { border-left-color: var(--danger); }
.notif-msg { color: var(--text); line-height: 1.3; }
.notif-time { color: var(--text-muted); font-size: 10px; margin-top: 2px; }
.notif-icon { margin-right: 4px; }

/* Sidebar stats */
.stat-item { display: flex; justify-content: space-between; align-items: center; padding: 8px 0; border-bottom: 1px solid #f0f0f0; }
.stat-val { font-size: 18px; font-weight: 700; color: var(--primary); }
.stat-lbl { font-size: 11px; color: var(--text-muted); }

/* ===== TOP HEADER ===== */
.top-header { padding: 0; }
.header-banner { background: linear-gradient(135deg, var(--primary), var(--primary-dark)); color: white; padding: 20px 24px; }
.header-banner h1 { font-size: 20px; font-weight: 600; }
.header-banner p { font-size: 12px; opacity: 0.85; margin-top: 4px; }
.header-meta { display: flex; align-items: center; gap: 20px; padding: 10px 24px; background: var(--card-bg); border-bottom: 1px solid var(--border); font-size: 13px; }
.btn-logout { background: var(--danger); color: white; padding: 4px 12px; border-radius: 4px; text-decoration: none; font-size: 12px; margin-left: auto; }
.btn-logout:hover { opacity: 0.9; }

/* ===== CONTENT ===== */
.content { flex: 1; padding: 24px; }

/* ===== ALERTS ===== */
.alert { padding: 12px 16px; border-radius: var(--radius); margin-bottom: 16px; font-size: 14px; }
.alert-success { background: #e8f5e9; border-left: 4px solid var(--success); color: #2e7d32; }
.alert-danger { background: #fce4ec; border-left: 4px solid var(--danger); color: #c62828; }
.alert-warning { background: #fff3e0; border-left: 4px solid var(--warning); color: #e65100; }
.alert-info { background: #e3f2fd; border-left: 4px solid var(--info); color: #1565c0; }

/* ===== PAGE HEADER ===== */
.page-header { display: flex; align-items: center; gap: 16px; margin-bottom: 24px; }
.page-header h2 { font-size: 22px; }

/* ===== SECTIONS ===== */
.section { margin-bottom: 28px; }
.section h3 { font-size: 16px; margin-bottom: 12px; color: var(--text); }

/* ===== METRICS ===== */
.metrics-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 16px; }
.metrics-5 { grid-template-columns: repeat(5, 1fr); }
.metrics-4 { grid-template-columns: repeat(4, 1fr); }
.metric-card { background: var(--card-bg); padding: 16px; border-radius: var(--radius); border: 1px solid var(--border); text-align: center; box-shadow: 0 2px 4px rgba(0,0,0,0.04); }
.metric-value { font-size: 26px; font-weight: 700; color: var(--primary); }
.metric-label { font-size: 11px; color: var(--text-muted); margin-top: 4px; text-transform: uppercase; letter-spacing: 0.3px; }
.metric-pending .metric-value { color: var(--warning); }
.metric-wip .metric-value { color: var(--info); }
.metric-executed .metric-value { color: var(--success); }
.metric-rejected .metric-value { color: var(--danger); }

/* ===== CHARTS ===== */
.charts-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 16px; }
.chart-container { background: var(--card-bg); border-radius: var(--radius); border: 1px solid var(--border); padding: 12px; box-shadow: 0 2px 4px rgba(0,0,0,0.04); }

/* ===== DOWNLOAD ===== */
.download-buttons { display: flex; gap: 12px; flex-wrap: wrap; }
.btn-download { background: var(--primary); color: white; padding: 10px 20px; border-radius: var(--radius); text-decoration: none; font-size: 13px; display: inline-flex; align-items: center; gap: 6px; }
.btn-download:hover { background: var(--primary-dark); }

/* ===== FORMS ===== */
.form-card { background: var(--card-bg); padding: 24px; border-radius: var(--radius); border: 1px solid var(--border); }
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 16px; }
.form-group { display: flex; flex-direction: column; gap: 4px; }
.form-group label { font-size: 13px; font-weight: 500; color: var(--text); }
.form-group input, .form-group select, .form-group textarea { padding: 10px 12px; border: 1px solid var(--border); border-radius: 6px; font-size: 14px; transition: border-color 0.2s; }
.form-group input:focus, .form-group select:focus, .form-group textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(102,126,234,0.1); }

/* ===== BUTTONS ===== */
.btn { padding: 10px 20px; border: none; border-radius: 6px; font-size: 14px; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; gap: 6px; transition: opacity 0.2s; }
.btn:hover { opacity: 0.9; }
.btn-primary { background: var(--primary); color: white; }
.btn-full { width: 100%; justify-content: center; }
.btn-sm { padding: 4px 12px; font-size: 12px; }
.btn-outline { border: 1px solid white; background: transparent; color: white; }

/* ===== TABLES ===== */
.table-container { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; background: var(--card-bg); border-radius: var(--radius); overflow: hidden; font-size: 13px; }
th { background: #f5f6fa; padding: 10px 12px; text-align: left; font-weight: 600; color: var(--text-muted); text-transform: uppercase; font-size: 11px; letter-spacing: 0.3px; }
td { padding: 10px 12px; border-top: 1px solid var(--border); }
tr:hover { background: #f9f9ff; }

/* Status badges */
.status { padding: 3px 10px; border-radius: 12px; font-size: 11px; font-weight: 600; display: inline-block; }
.status-pending { background: #fff3e0; color: #e65100; }
.status-wip { background: #e3f2fd; color: #1565c0; }
.status-executed { background: #e8f5e9; color: #2e7d32; }
.status-rejected { background: #fce4ec; color: #c62828; }

/* ===== LOGIN PAGE ===== */
.login-body { background: var(--bg); min-height: 100vh; display: flex; flex-direction: column; }
.login-hero { background: linear-gradient(135deg, var(--primary), var(--primary-dark)); color: white; padding: 40px 32px; border-radius: 0 0 12px 12px; margin: 16px 24px 0; }
.hero-title { font-size: 36px; }
.login-hero h2 { font-size: 20px; font-weight: 400; margin-top: 8px; }
.login-hero p { font-size: 13px; opacity: 0.85; margin-top: 8px; }

.login-about { margin: 20px 24px; padding: 16px 20px; border-left: 4px solid var(--primary); background: var(--card-bg); border-radius: 0 var(--radius) var(--radius) 0; font-size: 13px; line-height: 1.7; color: var(--text-muted); }

.login-wrapper { max-width: 600px; margin: 20px auto; padding: 0 24px; width: 100%; }
.login-portal-header { background: linear-gradient(135deg, var(--primary-dark), var(--primary)); color: white; padding: 24px; border-radius: var(--radius) var(--radius) 0 0; text-align: center; }
.login-portal-header h2 { font-size: 20px; }
.login-portal-header p { font-size: 12px; opacity: 0.8; margin-top: 4px; }

.login-form { background: var(--card-bg); padding: 24px; border-radius: 0 0 var(--radius) var(--radius); border: 1px solid var(--border); border-top: none; }
.login-form .form-group { margin-bottom: 16px; }
.login-form input { width: 100%; padding: 12px; border: 1px solid var(--border); border-radius: 6px; font-size: 14px; }
.login-form input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(102,126,234,0.1); }

.password-field { position: relative; }
.password-field input { padding-right: 40px; }
.toggle-pw { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); background: none; border: none; cursor: pointer; font-size: 16px; }

.login-buttons { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 20px; }
.btn-login { background: var(--danger); color: white; padding: 12px; border: none; border-radius: 6px; font-size: 14px; cursor: pointer; text-align: center; }
.btn-reset { background: var(--primary-dark); color: white; padding: 12px; border: none; border-radius: 6px; font-size: 14px; cursor: pointer; text-align: center; }

.login-footer { text-align: center; padding: 20px; margin-top: auto; color: var(--text-muted); font-size: 12px; }

/* ===== NOTIFICATIONS ===== */
.notification-list { display: flex; flex-direction: column; gap: 8px; }
.notification-item { display: flex; align-items: center; gap: 8px; padding: 10px 12px; background: var(--card-bg); border-radius: 6px; border: 1px solid var(--border); font-size: 13px; }

/* ===== FOOTER ===== */
.footer { text-align: center; padding: 16px; color: var(--text-muted); font-size: 12px; border-top: 1px solid var(--border); margin-top: auto; }

/* ===== CHAT ===== */
.chat-container { max-width: 100%; }
.chat-messages { background: var(--card-bg); border-radius: var(--radius); padding: 20px; min-height: 500px; max-height: 65vh; overflow-y: auto; margin-bottom: 0; }
.chat-welcome { text-align: center; padding: 20px; color: var(--text-muted); }
.chat-welcome p { margin: 8px 0; font-size: 14px; }
.chat-suggestions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 16px; }
.suggestion-btn { background: #f0f0ff; border: 1px solid var(--primary); color: var(--primary); padding: 8px 12px; border-radius: 20px; font-size: 12px; cursor: pointer; transition: background 0.2s; }
.suggestion-btn:hover { background: var(--primary); color: white; }
.chat-msg { display: flex; gap: 10px; margin-bottom: 12px; align-items: flex-start; }
.chat-user { flex-direction: row-reverse; }
.chat-avatar { font-size: 20px; }
.chat-bubble { background: #f5f6fa; padding: 10px 14px; border-radius: 12px; font-size: 14px; line-height: 1.5; max-width: 80%; white-space: pre-wrap; }
.chat-user .chat-bubble { background: #e8eaf6; }
.chat-input-form { display: flex; gap: 8px; }
.chat-input-form input { flex: 1; padding: 12px; border: 1px solid var(--border); border-radius: var(--radius); font-size: 14px; }
.chat-input-form input:focus { outline: none; border-color: var(--primary); }

/* ===== DATA CLASSIFICATION ===== */
.data-classification { background: #d32f2f; color: white; text-align: center; padding: 4px; font-size: 11px; font-weight: 700; letter-spacing: 1px; }
body.dark .data-classification { background: #b71c1c; }

/* ===== ANNOUNCEMENT BANNER ===== */
.announce-banner { background:linear-gradient(135deg, #667eea, #764ba2); color:white; padding:10px 16px; border-radius:6px; margin-bottom:16px; display:flex; justify-content:space-between; align-items:center; font-size:13px; }
.announce-banner a { color:#ffd700; }

/* ===== BREADCRUMB ===== */
.breadcrumb { font-size: 12px; color: var(--text-muted); margin-bottom: 16px; }
.breadcrumb a { color: var(--primary); text-decoration: none; }
.breadcrumb span { margin: 0 4px; }

/* ===== STATUS DOT ===== */
.status-dot { display: inline-block; width: 8px; height: 8px; background: var(--success); border-radius: 50%; margin-right: 4px; animation: pulse 2s infinite; }
@keyframes pulse { 0%,100% { opacity:1; } 50% { opacity:0.5; } }

/* ===== POWERED BADGE ===== */
.powered-badge { background: linear-gradient(135deg, #232f3e, #37475a); color: #ff9900; padding: 4px 12px; border-radius: 4px; font-size: 11px; font-weight: 600; letter-spacing: 0.3px; }

/* ===== MODAL OVERLAY ===== */
.modal-overlay { position:fixed; top:0; left:0; width:100%; height:100%; background:rgba(0,0,0,0.5); z-index:1000; display:flex; align-items:center; justify-content:center; }
.modal-content { background:var(--card-bg); padding:28px; border-radius:12px; max-width:450px; width:90%; box-shadow:0 20px 60px rgba(0,0,0,0.3); }
body.dark .modal-content { background:#16213e; }

/* ===== KBD KEYS ===== */
kbd { background: #f0f0f0; border: 1px solid #ccc; border-radius: 3px; padding: 2px 6px; font-size: 12px; font-family: monospace; }
body.dark kbd { background: #2a2a4a; border-color: #444; color: #eee; }

/* ===== PRINT FRIENDLY ===== */
@media print { .sidebar, .top-header, .footer, .breadcrumb, .btn, .session-warning { display: none !important; } .main-area { margin-left: 0 !important; } .content { padding: 0 !important; } }

/* ===== TABLE RESIZE ===== */
.data-table th { resize: horizontal; overflow: hidden; min-width: 60px; }

/* ===== SESSION WARNING ===== */
.session-warning { position:fixed; bottom:20px; right:20px; background:#fff3e0; border:1px solid #ff9800; border-radius:8px; padding:12px 16px; z-index:999; box-shadow:0 4px 12px rgba(0,0,0,0.15); font-size:13px; }
body.dark .session-warning { background:#2a2a4a; border-color:#ff9800; color:#eee; }

/* ===== DARK MODE ===== */
body.dark { --bg: #1a1a2e; --card-bg: #16213e; --text: #eee; --text-muted: #aaa; --border: #2a2a4a; }
body.dark .sidebar { background: #16213e; border-color: #2a2a4a; }
body.dark .metric-card { background: #16213e; border-color: #2a2a4a; }
body.dark .chart-container { background: #16213e; border-color: #2a2a4a; }
body.dark .form-card { background: #16213e; border-color: #2a2a4a; }
body.dark .header-meta { background: #16213e; border-color: #2a2a4a; }
body.dark table { background: #16213e; }
body.dark th { background: #1a1a2e; }
body.dark .form-group input, body.dark .form-group select, body.dark .form-group textarea { background: #1a1a2e; color: #eee; border-color: #2a2a4a; }
body.dark .alert { background: #16213e; }

/* ===== LOADING INDICATOR ===== */
.loading { display: inline-block; width: 16px; height: 16px; border: 2px solid var(--border); border-top-color: var(--primary); border-radius: 50%; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== UTILITIES ===== */
.text-muted { color: var(--text-muted); }
.text-sm { font-size: 12px; }

/* ===== RESPONSIVE ===== */
.sidebar-toggle { display: none; background: none; border: none; font-size: 24px; cursor: pointer; color: white; margin-right: 12px; }

@media (max-width: 768px) {
    .sidebar-toggle { display: inline-block; }
    .sidebar { display: none; width: 100%; }
    .sidebar.open { display: block; position: fixed; z-index: 300; }
    .main-area { margin-left: 0; }
    .metrics-5, .metrics-4 { grid-template-columns: repeat(2, 1fr); }
    .charts-grid { grid-template-columns: 1fr; }
    .login-buttons { grid-template-columns: 1fr; }
}

/* ===== PREMIUM ENHANCEMENTS ===== */

/* Animated transitions */
.sidebar-link, .btn, .metric-card, .appointment-card, .chart-container {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.metric-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.12);
}
.appointment-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.1);
}
.nav-highlight:hover {
    transform: translateX(4px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}
.btn:hover {
    transform: translateY(-1px);
}
.btn:active {
    transform: translateY(0);
}

/* Page content fade-in */
.main-content {
    animation: fadeIn 0.3s ease;
}
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* KPI trend indicators */
.metric-trend {
    font-size: 11px;
    margin-top: 4px;
    font-weight: 600;
}
.metric-trend.up { color: #28a745; }
.metric-trend.down { color: #dc3545; }
.metric-trend.neutral { color: var(--text-muted); }

/* Enhanced empty states */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    background: var(--card-bg);
    border-radius: 12px;
    border: 2px dashed var(--border);
}
.empty-state-icon {
    font-size: 64px;
    margin-bottom: 16px;
    display: block;
}
.empty-state h3 {
    margin: 0 0 8px;
    color: var(--text-primary);
}
.empty-state p {
    color: var(--text-muted);
    font-size: 14px;
    margin: 0 0 20px;
}
.empty-state .btn {
    padding: 10px 24px;
    font-size: 14px;
}

/* Smooth scroll */
html { scroll-behavior: smooth; }

/* Card shimmer loading effect */
@keyframes shimmer {
    0% { background-position: -200px 0; }
    100% { background-position: calc(200px + 100%) 0; }
}
.loading-shimmer {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200px 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 8px;
}

/* Print view */
@media print {
    .sidebar, .page-header .btn, .filter-bar, .action-buttons, 
    .chat-input-form, .data-classification, .session-warning,
    .nav-highlight, #sidebarNotifications, .sidebar-brand { display: none !important; }
    .main-area { margin-left: 0 !important; padding: 0 !important; }
    .appointment-card { break-inside: avoid; box-shadow: none; border: 1px solid #ccc; margin-bottom: 12px; }
    .metric-card { box-shadow: none; border: 1px solid #ccc; }
    body { background: white !important; }
    .main-content { max-width: 100% !important; }
    @page { margin: 1cm; }
}

/* Toast notification */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.toast {
    padding: 12px 20px;
    border-radius: 8px;
    color: white;
    font-size: 13px;
    font-weight: 500;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    animation: slideIn 0.3s ease, fadeOut 0.3s ease 3.7s forwards;
    max-width: 320px;
}
.toast-success { background: #28a745; }
.toast-warning { background: #fd7e14; }
.toast-danger { background: #dc3545; }
.toast-info { background: #007bff; }
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
@keyframes fadeOut { from { opacity: 1; } to { opacity: 0; } }

/* Button loading spinner */
.btn-loading {
    position: relative;
    pointer-events: none;
    opacity: 0.7;
}
.btn-loading::after {
    content: '';
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}
@keyframes spin { to { transform: translateY(-50%) rotate(360deg); } }

/* Mobile responsive enhancements */
@media (max-width: 768px) {
    .nav-highlight {
        padding: 8px 10px !important;
        font-size: 13px !important;
        margin: 2px 0 !important;
    }
    .page-header h2 { font-size: 18px; }
    .metric-card { padding: 12px; }
    .metric-value { font-size: 20px; }
    .chat-suggestions { gap: 6px; }
    .suggestion-btn { padding: 6px 10px; font-size: 11px; }
    .filter-bar { flex-direction: column; align-items: stretch; }
}

/* Accessibility: Respect reduced motion preferences */
@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    .main-content { animation: none; }
    .sidebar-link, .btn, .metric-card, .appointment-card, .chart-container {
        transition: none;
    }
    .toast { animation: none; }
    .loading-shimmer { animation: none; }
    .typing-dots span { animation: none; }
    .btn-loading::after { animation: none; }
    .nav-highlight:hover { transform: none; }
    .metric-card:hover, .appointment-card:hover { transform: none; }
}

/* Broadcast banner slide-down */
@keyframes slideDown { from { transform: translateY(-100%); } to { transform: translateY(0); } }

