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

:root {
    --navy: #0A1628;
    --navy-light: #0F2137;
    --navy-lighter: #162844;
    --red: #EF4444;
    --red-hover: #DC2626;
    --red-light: rgba(239, 68, 68, 0.1);
    --text-white: #F8FAFC;
    --text-muted: #94A3B8;
    --text-dim: #64748B;
    --border: rgba(255, 255, 255, 0.08);
    --green: #22C55E;
    --yellow: #F59E0B;
    --blue: #3B82F6;
    --safe-top: env(safe-area-inset-top, 0px);
    --safe-bottom: env(safe-area-inset-bottom, 0px);
    --tab-height: 60px;
}

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

body {
    font-family: 'Inter', -apple-system, system-ui, sans-serif;
    background: var(--navy);
    color: var(--text-white);
    line-height: 1.5;
    min-height: 100vh;
    min-height: 100dvh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    padding-top: var(--safe-top);
    padding-bottom: calc(var(--tab-height) + var(--safe-bottom));
}

/* ========================================
   TOP BAR
   ======================================== */

.top-bar {
    position: sticky;
    top: 0;
    z-index: 100;
    background: linear-gradient(180deg, var(--navy) 0%, rgba(10, 22, 40, 0.98) 100%);
    border-bottom: 1px solid var(--border);
    padding: 14px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.top-bar-logo {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-white);
    letter-spacing: -0.3px;
}

.top-bar-logo span { color: var(--red); }

.top-bar-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.top-bar-avatar {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, var(--red) 0%, #B91C1C 100%);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 12px;
    color: var(--text-white);
    cursor: pointer;
}

.top-bar-page {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-white);
}

/* ========================================
   BOTTOM TAB BAR
   ======================================== */

.tab-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: calc(var(--tab-height) + var(--safe-bottom));
    padding-bottom: var(--safe-bottom);
    background: linear-gradient(180deg, rgba(10, 22, 40, 0.98) 0%, var(--navy) 100%);
    border-top: 1px solid var(--border);
    display: flex;
    z-index: 100;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.tab-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    color: var(--text-dim);
    font-size: 10px;
    font-weight: 500;
    cursor: pointer;
    transition: color 0.2s;
    text-decoration: none;
    padding: 6px 0;
    -webkit-tap-highlight-color: transparent;
}

.tab-item.active {
    color: var(--red);
}

.tab-item svg {
    width: 22px;
    height: 22px;
}

.tab-badge {
    position: absolute;
    top: 4px;
    right: calc(50% - 18px);
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    background: var(--red);
    border-radius: 8px;
    font-size: 9px;
    font-weight: 700;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ========================================
   PAGES / VIEWS
   ======================================== */

.page {
    display: none;
    padding: 16px;
    animation: fadeIn 0.2s ease;
}

.page.active {
    display: block;
}

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

/* ========================================
   LOGIN
   ======================================== */

.login-page {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    min-height: 100dvh;
    padding: 24px;
}

.login-logo {
    font-size: 28px;
    font-weight: 800;
    margin-bottom: 8px;
    letter-spacing: -0.5px;
}

.login-logo span { color: var(--red); }

.login-sub {
    color: var(--text-muted);
    font-size: 14px;
    margin-bottom: 32px;
}

.login-form {
    width: 100%;
    max-width: 360px;
}

.login-form .form-group {
    margin-bottom: 16px;
}

.form-label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-muted);
    margin-bottom: 6px;
}

.form-input {
    width: 100%;
    padding: 14px 16px;
    background: var(--navy-lighter);
    border: 1px solid var(--border);
    border-radius: 10px;
    font-size: 16px;
    color: var(--text-white);
    font-family: inherit;
    transition: border-color 0.2s;
    -webkit-appearance: none;
}

.form-input:focus {
    outline: none;
    border-color: var(--red);
    box-shadow: 0 0 0 3px var(--red-light);
}

.form-input::placeholder { color: var(--text-dim); }

.btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 14px;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    font-family: inherit;
    transition: all 0.2s;
    -webkit-tap-highlight-color: transparent;
    min-height: 48px;
}

.btn-primary {
    background: var(--red);
    color: white;
}

.btn-primary:active {
    background: var(--red-hover);
    transform: scale(0.98);
}

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-secondary {
    background: var(--navy-lighter);
    color: var(--text-white);
    border: 1px solid var(--border);
}

.login-error {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.2);
    color: var(--red);
    padding: 12px 16px;
    border-radius: 10px;
    font-size: 13px;
    margin-bottom: 16px;
    display: none;
}

/* 2FA */
.twofa-section {
    display: none;
    text-align: center;
}

.twofa-section .twofa-desc {
    color: var(--text-muted);
    font-size: 14px;
    margin-bottom: 20px;
}

.twofa-input {
    text-align: center;
    font-size: 24px;
    font-weight: 700;
    letter-spacing: 8px;
    padding: 16px;
}

/* ========================================
   CARDS
   ======================================== */

.card {
    background: var(--navy-light);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 14px 16px;
    margin-bottom: 10px;
    cursor: pointer;
    transition: transform 0.15s;
    -webkit-tap-highlight-color: transparent;
}

.card:active {
    transform: scale(0.98);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 6px;
}

.card-name {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-white);
}

.card-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 12px;
    font-size: 12px;
    color: var(--text-muted);
}

.card-meta a {
    color: var(--blue);
    text-decoration: none;
}

.card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 8px;
}

/* ========================================
   BADGES
   ======================================== */

.badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
}

.badge-red { background: rgba(239, 68, 68, 0.15); color: #F87171; }
.badge-green { background: rgba(34, 197, 94, 0.15); color: #22C55E; }
.badge-yellow { background: rgba(245, 158, 11, 0.15); color: #F59E0B; }
.badge-blue { background: rgba(59, 130, 246, 0.15); color: #60A5FA; }
.badge-purple { background: rgba(168, 85, 247, 0.15); color: #A855F7; }
.badge-gray { background: rgba(148, 163, 184, 0.1); color: var(--text-muted); }
.badge-cyan { background: rgba(6, 182, 212, 0.15); color: #06B6D4; }

/* Klant tag */
.klant-tag {
    font-size: 11px;
    color: var(--text-dim);
    background: rgba(255, 255, 255, 0.05);
    padding: 2px 8px;
    border-radius: 4px;
}

/* ========================================
   FASE SELECT
   ======================================== */

.fase-select {
    padding: 6px 28px 6px 10px;
    font-size: 12px;
    font-weight: 600;
    border-radius: 14px;
    border: none;
    cursor: pointer;
    font-family: 'Inter', sans-serif;
    appearance: none;
    -webkit-appearance: none;
    background-repeat: no-repeat;
    background-position: right 8px center;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 24 24' fill='none' stroke='%23666' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    min-height: 32px;
}

/* Fase colors */
.fase-gesolliciteerd { background: rgba(100,116,139,0.25); color: #94A3B8; }
.fase-wachten-op-antwoord { background: rgba(245,158,11,0.2); color: #F59E0B; }
.fase-terugbellen { background: rgba(59,130,246,0.2); color: #3B82F6; }
.fase-wachten-op-cv { background: rgba(168,85,247,0.2); color: #A855F7; }
.fase-cv-ontvangen { background: rgba(14,165,233,0.2); color: #0EA5E9; }
.fase-voorgesteld { background: rgba(6,182,212,0.2); color: #06B6D4; }
.fase-op-gesprek { background: rgba(14,165,233,0.15); color: #0EA5E9; }
.fase-aangenomen { background: rgba(34,197,94,0.2); color: #22C55E; }
.fase-afgewezen { background: rgba(239,68,68,0.2); color: #EF4444; }
.fase-neemt-niet-op { background: rgba(245,158,11,0.2); color: #F59E0B; }

/* ========================================
   DAGEN BADGE
   ======================================== */

.dagen-badge {
    font-size: 11px;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 10px;
    white-space: nowrap;
}

.dagen-green { background: rgba(34,197,94,0.15); color: #22C55E; }
.dagen-yellow { background: rgba(245,158,11,0.15); color: #F59E0B; }
.dagen-red { background: rgba(239,68,68,0.15); color: #EF4444; }

/* ========================================
   CARD DETAIL (expanded)
   ======================================== */

.card-detail {
    display: none;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid var(--border);
}

.card.expanded .card-detail {
    display: block;
}

.detail-section {
    margin-bottom: 12px;
}

.detail-label {
    font-size: 10px;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
    margin-bottom: 4px;
}

.detail-value {
    font-size: 13px;
    color: #CBD5E1;
    line-height: 1.5;
    white-space: pre-wrap;
    word-break: break-word;
}

/* ========================================
   NOTE FORM
   ======================================== */

.note-form {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 8px;
}

.note-input {
    width: 100%;
    padding: 10px 12px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-white);
    font-size: 13px;
    font-family: inherit;
    resize: vertical;
    min-height: 44px;
}

.note-input:focus { outline: none; border-color: var(--red); }
.note-input::placeholder { color: var(--text-dim); }

.btn-note {
    align-self: flex-end;
    padding: 8px 16px;
    background: var(--red-light);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: 8px;
    color: var(--red);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    min-height: 36px;
}

.btn-note:disabled { opacity: 0.5; }

/* ========================================
   STAT PILLS (horizontal scroll)
   ======================================== */

.stat-pills {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding: 0 0 12px;
    margin: 0 -16px;
    padding-left: 16px;
    padding-right: 16px;
    scrollbar-width: none;
}

.stat-pills::-webkit-scrollbar { display: none; }

.stat-pill {
    flex-shrink: 0;
    background: var(--navy-light);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 10px 14px;
    text-align: center;
    min-width: 90px;
    cursor: pointer;
    transition: all 0.2s;
    -webkit-tap-highlight-color: transparent;
}

.stat-pill.active {
    border-color: rgba(239, 68, 68, 0.4);
    background: rgba(239, 68, 68, 0.08);
}

.stat-pill .stat-num {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-white);
    line-height: 1;
}

.stat-pill.urgent .stat-num { color: var(--red); }

.stat-pill .stat-label {
    font-size: 9px;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 4px;
}

/* ========================================
   FILTER BAR
   ======================================== */

.filter-bar {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.filter-select {
    flex: 1;
    min-width: 0;
    padding: 10px 30px 10px 12px;
    background: var(--navy-lighter);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-white);
    font-size: 13px;
    font-family: inherit;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2394A3B8' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
}

.filter-select:focus { outline: none; border-color: var(--red); }

.filter-search {
    width: 100%;
    padding: 10px 12px 10px 36px;
    background: var(--navy-lighter);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-white);
    font-size: 13px;
    font-family: inherit;
    -webkit-appearance: none;
}

.filter-search:focus { outline: none; border-color: var(--red); }
.filter-search::placeholder { color: var(--text-dim); }

.search-wrap {
    position: relative;
    width: 100%;
}

.search-wrap svg {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    color: var(--text-dim);
}

/* ========================================
   PULL TO REFRESH
   ======================================== */

.pull-indicator {
    text-align: center;
    padding: 12px;
    color: var(--text-dim);
    font-size: 12px;
    display: none;
}

/* ========================================
   TOAST
   ======================================== */

.toast {
    position: fixed;
    bottom: calc(var(--tab-height) + var(--safe-bottom) + 12px);
    left: 12px;
    right: 12px;
    padding: 12px 16px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 500;
    color: white;
    z-index: 9999;
    opacity: 0;
    transform: translateY(10px);
    transition: all 0.3s;
    pointer-events: none;
    text-align: center;
}

.toast.show { opacity: 1; transform: translateY(0); }
.toast.success { background: #16A34A; }
.toast.error { background: #DC2626; }

/* ========================================
   LOADING / EMPTY
   ======================================== */

.loading-screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    color: var(--text-dim);
    font-size: 13px;
    gap: 12px;
}

.spinner {
    width: 32px;
    height: 32px;
    border: 3px solid var(--border);
    border-top-color: var(--red);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-dim);
    font-size: 14px;
}

/* ========================================
   SECTION HEADER
   ======================================== */

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.section-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-white);
}

.section-count {
    font-size: 12px;
    color: var(--text-dim);
}

/* ========================================
   VIEW TOGGLE
   ======================================== */

.view-toggle {
    display: flex;
    gap: 4px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 8px;
    padding: 3px;
    margin-bottom: 12px;
}

.view-btn {
    flex: 1;
    padding: 8px 12px;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-dim);
    background: none;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-family: inherit;
    text-align: center;
    transition: all 0.2s;
    -webkit-tap-highlight-color: transparent;
}

.view-btn.active {
    color: var(--text-white);
    background: var(--red-light);
    font-weight: 600;
}

/* ========================================
   ADMIN TABS (horizontal scroll)
   ======================================== */

.admin-tabs {
    display: flex;
    gap: 4px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding: 0 0 12px;
    margin: 0 -16px;
    padding-left: 16px;
    padding-right: 16px;
    scrollbar-width: none;
}

.admin-tabs::-webkit-scrollbar { display: none; }

.admin-tab {
    flex-shrink: 0;
    padding: 8px 14px;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-dim);
    background: none;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-family: inherit;
    white-space: nowrap;
    transition: all 0.2s;
    -webkit-tap-highlight-color: transparent;
}

.admin-tab.active {
    color: var(--red);
    background: var(--red-light);
    font-weight: 600;
}

/* ========================================
   PROFILE / SETTINGS
   ======================================== */

.profile-header {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 20px 0;
}

.profile-avatar {
    width: 56px;
    height: 56px;
    background: linear-gradient(135deg, var(--red) 0%, #B91C1C 100%);
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 20px;
    color: white;
    flex-shrink: 0;
}

.profile-name {
    font-size: 18px;
    font-weight: 600;
}

.profile-company {
    font-size: 13px;
    color: var(--text-muted);
}

.settings-group {
    margin-bottom: 24px;
}

.settings-title {
    font-size: 11px;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
    margin-bottom: 8px;
    padding-left: 4px;
}

.settings-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    background: var(--navy-light);
    border: 1px solid var(--border);
    cursor: pointer;
    transition: background 0.15s;
    -webkit-tap-highlight-color: transparent;
}

.settings-item:first-child { border-radius: 10px 10px 0 0; }
.settings-item:last-child { border-radius: 0 0 10px 10px; }
.settings-item:only-child { border-radius: 10px; }
.settings-item + .settings-item { border-top: none; }

.settings-item:active { background: var(--navy-lighter); }

.settings-item-label {
    font-size: 14px;
    color: var(--text-white);
}

.settings-item-value {
    font-size: 13px;
    color: var(--text-muted);
}

.settings-item .arrow {
    color: var(--text-dim);
    font-size: 18px;
}

.btn-logout {
    width: 100%;
    padding: 14px;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.2);
    border-radius: 10px;
    color: var(--red);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    margin-top: 24px;
    -webkit-tap-highlight-color: transparent;
}

/* ========================================
   SCROLLBAR
   ======================================== */

::-webkit-scrollbar { width: 0; height: 0; }
