:root {
    --bg-main: #e2e8f0; /* slate-200 */
    --bg-card: rgba(255, 255, 255, 0.95);
    --bg-card-solid: #ffffff;
    --text-main: #0f172a; /* slate-900 */
    --text-muted: #64748b; /* slate-500 */
    --text-dark: #1e293b;
    
    --primary: #6366f1; /* indigo-500 */
    --primary-hover: #4f46e5; /* indigo-600 */
    --primary-light: rgba(99, 102, 241, 0.1);
    
    --success: #10b981;
    --success-light: rgba(16, 185, 129, 0.15);
    
    --danger: #ef4444;
    --danger-light: rgba(239, 68, 68, 0.15);
    
    --warning: #f59e0b;
    --warning-light: rgba(245, 158, 11, 0.15);
    
    --border: #e2e8f0; /* slate-200 */
    --border-hover: #cbd5e1; /* slate-300 */
    
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    
    --glass-blur: blur(12px);
    
    --font-kanit: 'Kanit', sans-serif;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-kanit);
    background-color: var(--bg-main);
    color: var(--text-main);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
    padding-bottom: 80px; /* space for bottom nav */
}

/* Typography */
h1, h2, h3, h4 { font-weight: 600; color: var(--text-dark); }
.text-sm { font-size: 0.875rem; }
.text-xs { font-size: 0.75rem; }
.text-muted { color: var(--text-muted); }
.font-medium { font-weight: 500; }
.text-center { text-align: center; }

/* Layout & Containers */
.container {
    max-width: 600px;
    margin: 0 auto;
    padding: 12px;
}

/* Glassmorphism Utilities */
.glass {
    background: var(--bg-card);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 20px;
    border-radius: var(--radius-sm);
    font-family: var(--font-kanit);
    font-weight: 500;
    font-size: 0.9rem;
    cursor: pointer;
    border: none;
    transition: all 0.2s ease;
}

.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-hover); transform: translateY(-1px); box-shadow: var(--shadow); }
.btn-success { background: var(--success); color: white; }
.btn-danger { background: var(--danger); color: white; }
.btn-outline { background: white; border: 1px solid var(--border); color: var(--text-main); }
.btn-outline:hover { background: var(--bg-main); }

/* Header & Tabs */
.header {
    position: sticky;
    top: 0;
    z-index: 50;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--shadow-sm);
}

.tabs-container {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding: 12px 16px 8px;
    scrollbar-width: none;
}
.tabs-container::-webkit-scrollbar { display: none; }

.tab {
    padding: 6px 14px;
    border-radius: 20px;
    background: white;
    color: var(--text-muted);
    border: 1px solid var(--border);
    white-space: nowrap;
    cursor: pointer;
    font-weight: 500;
    font-size: 0.85rem;
    transition: all 0.2s;
    box-shadow: var(--shadow-sm);
}

.tab.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
    box-shadow: var(--shadow);
}

/* Compact Candidate Card (Horizontal) */
.candidate-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.card-compact {
    border-radius: var(--radius-md);
    overflow: hidden;
    transition: transform 0.2s;
    position: relative;
    display: flex;
    flex-direction: column;
}

.graduated-card {
    background-color: #f0fdf4 !important; /* emerald-50 */
    border: 2px solid #22c55e !important; /* emerald-500 */
}

.graduated-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: #16a34a;
    color: white;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.7rem;
    font-weight: 600;
    margin-bottom: 4px;
    width: fit-content;
}

.card-compact-header {
    display: flex;
    padding: 12px;
    gap: 12px;
    align-items: stretch;
}

.card-photo-wrapper {
    flex-shrink: 0;
    width: 80px;
    height: 100px;
    border-radius: var(--radius-sm);
    overflow: hidden;
    background: var(--border);
    position: relative;
}

.card-photo {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.card-info {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.card-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 2px;
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--text-dark);
}

.age-badge {
    background: var(--primary-light);
    color: var(--primary);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
}

.info-line {
    font-size: 0.85rem;
    color: var(--text-muted);
    display: flex;
    align-items: flex-start;
    gap: 6px;
    margin-bottom: 4px;
}
.info-line i { 
    color: var(--primary); 
    margin-top: 3px; /* จัดไอคอนให้ตรงกับบรรทัดแรกของข้อความ */
}

.note-badge-btn {
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid var(--border);
    background: white;
    color: var(--text-muted);
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 4px;
    font-family: var(--font-kanit);
}
.note-badge-btn:hover { background: var(--bg-main); }
.note-badge-btn.has-note { background: #fef3c7; color: #b45309; border-color: #f59e0b; }

.card-actions-compact {
    display: flex;
    border-top: 1px solid var(--border);
}

.action-btn {
    flex: 1;
    padding: 10px;
    border: none;
    background: transparent;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s;
    font-family: var(--font-kanit);
}

.action-btn:not(:last-child) { border-right: 1px solid var(--border); }

.action-pass { color: var(--success); }
.action-pass:hover, .action-pass.active { background: var(--success); color: white; }

.action-reject { color: var(--danger); }
.action-reject:hover, .action-reject.active { background: var(--danger); color: white; }

.action-note { color: var(--text-muted); }
.action-note:hover { background: var(--border); color: var(--text-dark); }
.action-note.has-note { color: var(--primary); }

/* Filters & Toolbars */
.toolbar {
    display: flex;
    gap: 8px;
    padding: 0 0 12px 0;
}

.filter-btn {
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    border: 1px solid var(--border);
    background: white;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s;
}
.filter-btn.active {
    background: var(--primary-light);
    color: var(--primary);
    border-color: var(--primary);
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(2px);
    z-index: 100;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.modal-overlay.show { display: flex; }

.modal-content {
    background: var(--bg-card-solid);
    width: 100%;
    max-width: 400px;
    border-radius: var(--radius-lg);
    padding: 20px;
    box-shadow: var(--shadow-lg);
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}
.modal-title { font-size: 1.1rem; color: var(--text-dark); }
.close-btn { background: transparent; border: none; color: var(--text-muted); cursor: pointer; font-size: 1.5rem; }

textarea.note-input {
    width: 100%;
    height: 100px;
    background: var(--bg-main);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 12px;
    color: var(--text-main);
    font-family: var(--font-kanit);
    resize: none;
    margin-bottom: 12px;
}
textarea.note-input:focus {
    outline: none;
    border-color: var(--primary);
}

/* Bottom Navigation */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: #1e293b; /* slate-800 */
    display: flex;
    justify-content: space-around;
    padding: 10px 0;
    z-index: 50;
    padding-bottom: calc(10px + env(safe-area-inset-bottom));
    box-shadow: 0 -4px 15px rgba(0, 0, 0, 0.2);
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    color: #64748b; /* slate-500 */
    text-decoration: none;
    font-size: 0.65rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    flex: 1;
    padding: 8px 4px;
    margin: 0 4px;
    border-radius: 12px;
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.05);
}

.nav-item.active { 
    color: #38bdf8; /* sky-400 */
    background: rgba(56, 189, 248, 0.15);
}
.nav-item.active i {
    text-shadow: 0 0 15px rgba(56, 189, 248, 0.8);
    transform: scale(1.1);
}
.nav-item i { 
    font-size: 1.4rem; 
    transition: transform 0.2s ease;
}

/* Note Display inside Card */
.note-display {
    background: #fffbeb; /* amber-50 */
    border-left: 3px solid var(--warning);
    padding: 8px 12px;
    margin: 0 12px 12px 12px;
    font-size: 0.8rem;
    color: #92400e; /* amber-900 */
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
}
.note-capsule {
    display: inline-block;
    background: #fde68a; /* amber-200 */
    color: #b45309; /* amber-700 */
    padding: 2px 8px;
    border-radius: 12px;
    font-weight: 700;
    font-size: 0.75rem;
    margin: 0 2px;
    border: 1px solid #fcd34d;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}
.empty-state i {
    font-size: 48px;
    margin-bottom: 12px;
    color: var(--border-hover);
}

/* Image Modal */
.image-modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.9);
    z-index: 200;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    cursor: zoom-out;
}
.image-modal-overlay.show { display: flex; }
.image-modal-content {
    max-width: 100%;
    max-height: 90vh;
    border-radius: var(--radius-sm);
    box-shadow: 0 0 20px rgba(0,0,0,0.5);
    animation: zoomIn 0.2s ease;
}

@keyframes zoomIn {
    from { transform: scale(0.95); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

/* Note Tags */
.tags-container {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 12px;
}
.tag-pill {
    background: var(--bg-main);
    color: var(--text-dark);
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    cursor: pointer;
    border: 1px solid var(--border);
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}
.tag-pill:hover {
    background: var(--border);
}
.tag-pill.tag-action-btn {
    background: white;
    border: 1px dashed var(--text-muted);
    color: var(--text-main);
}
.tag-pill.tag-action-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
}
.tag-delete-icon {
    color: var(--danger);
    font-weight: bold;
    padding-left: 4px;
    border-left: 1px solid var(--border);
    margin-left: 2px;
}
.tag-delete-icon:hover {
    color: #b91c1c; /* darker red */
}

/* Detail Modal Text */
.detail-row {
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px dashed var(--border);
}
.detail-row:last-child { border-bottom: none; }
.detail-label {
    font-size: 0.75rem;
    color: var(--text-muted);
}
.detail-value {
    font-size: 0.95rem;
    color: var(--text-dark);
    word-break: break-word;
}

.details-modal-content {
    max-height: 95vh;
    height: 95vh;
    max-width: 600px;
    width: 100%;
    margin: 0;
    border-radius: var(--radius-lg);
    overflow-y: auto;
}
