:root {
    --primary: #1a237e;
    --primary-light: #3949ab;
    --success: #2e7d32;
    --warning: #f57f17;
    --danger: #c62828;
    --bg: #f5f5f5;
    --card-bg: #ffffff;
    --text: #212121;
    --text-light: #757575;
    --border: #e0e0e0;
    --radius: 12px;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    overflow-x: hidden;
}

.hidden { display: none !important; }

/* --- Sayfalar --- */
.page {
    max-width: 480px;
    margin: 0 auto;
    padding: 0 16px;
    min-height: 100vh;
}

/* --- Login --- */
.login-page {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 32px 16px;
}

.login-logo {
    width: 80px;
    height: 80px;
    background: var(--primary);
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 36px;
    color: white;
    margin-bottom: 16px;
}

.login-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 4px;
    text-align: center;
}

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

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

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

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

.form-group input, .form-group select, .form-group textarea {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    font-size: 16px;
    transition: border-color .2s;
    outline: none;
    background: white;
}

.form-group input:focus, .form-group select:focus {
    border-color: var(--primary);
}

.login-error {
    color: var(--danger);
    font-size: 13px;
    margin-bottom: 8px;
    min-height: 18px;
}

/* --- Butonlar --- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 24px;
    border: none;
    border-radius: var(--radius);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: opacity .2s, transform .1s;
    width: 100%;
    gap: 8px;
}

.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-primary { background: var(--primary); color: white; }
.btn-success { background: var(--success); color: white; }
.btn-warning { background: var(--warning); color: white; }
.btn-danger { background: var(--danger); color: white; }
.btn-outline {
    background: transparent;
    color: var(--primary);
    border: 2px solid var(--primary);
}

.btn-sm { padding: 8px 16px; font-size: 14px; width: auto; }
.btn-lg { padding: 16px 24px; font-size: 18px; }

/* --- Header --- */
.app-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 0;
    border-bottom: 1px solid var(--border);
    margin-bottom: 16px;
}

.app-header h1 {
    font-size: 18px;
    color: var(--primary);
}

.header-actions {
    display: flex;
    gap: 12px;
    align-items: center;
}

.notif-btn {
    position: relative;
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    padding: 4px;
}

.notif-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: var(--danger);
    color: white;
    font-size: 10px;
    font-weight: 700;
    min-width: 18px;
    height: 18px;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
}

/* --- User Info --- */
.user-info {
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    border-radius: var(--radius);
    padding: 20px;
    color: white;
    margin-bottom: 16px;
}

.user-info .user-greeting { font-size: 14px; opacity: 0.8; }
.user-info .user-name { font-size: 20px; font-weight: 700; }
.user-info .user-role {
    font-size: 12px;
    background: rgba(255,255,255,0.2);
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    margin-top: 4px;
}

/* --- Action Buttons --- */
.action-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 20px;
}

.action-btn {
    background: var(--card-bg);
    border: 2px solid var(--border);
    border-radius: var(--radius);
    padding: 20px 12px;
    text-align: center;
    cursor: pointer;
    transition: all .2s;
}

.action-btn:active { transform: scale(0.97); }
.action-btn .action-icon { font-size: 32px; margin-bottom: 8px; }
.action-btn .action-label { font-size: 14px; font-weight: 600; }

.action-btn.check-in { border-color: var(--success); }
.action-btn.check-in .action-icon { color: var(--success); }
.action-btn.check-out { border-color: var(--danger); }
.action-btn.check-out .action-icon { color: var(--danger); }

/* --- Today Status --- */
.section-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-light);
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.status-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 14px 16px;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-left: 4px solid var(--border);
}

.status-card.success { border-left-color: var(--success); }
.status-card.warning { border-left-color: var(--warning); }
.status-card.danger { border-left-color: var(--danger); }
.status-card.pending { border-left-color: var(--text-light); }

.status-info strong { display: block; font-size: 15px; }
.status-info span { font-size: 13px; color: var(--text-light); }

/* --- Badge --- */
.badge {
    font-size: 11px;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 6px;
    text-transform: uppercase;
}

.badge.success { background: #e8f5e9; color: var(--success); }
.badge.warning { background: #fff8e1; color: var(--warning); }
.badge.danger { background: #ffebee; color: var(--danger); }

/* --- Menu --- */
.menu-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-top: 20px;
    padding-bottom: 32px;
}

.menu-item {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 16px;
    text-align: center;
    cursor: pointer;
    border: 1px solid var(--border);
    transition: all .2s;
}

.menu-item:active { transform: scale(0.97); }
.menu-item .menu-icon { font-size: 28px; margin-bottom: 6px; }
.menu-item .menu-label { font-size: 13px; font-weight: 600; }

/* --- Scanner --- */
.scanner-page {
    background: #000;
    padding: 0;
    display: flex;
    flex-direction: column;
    max-width: 100%;
}

.scanner-header {
    padding: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: white;
    z-index: 2;
}

.scanner-header h2 { font-size: 16px; }

.scanner-viewport {
    flex: 1;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

#scanner-video {
    width: 100%;
    max-height: 60vh;
    object-fit: cover;
}

#scanner-canvas { display: none; }

.scanner-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 220px;
    height: 220px;
    border: 3px solid rgba(255,255,255,0.6);
    border-radius: 20px;
    z-index: 1;
}

.scan-status {
    text-align: center;
    padding: 16px;
    color: white;
    font-size: 14px;
}

.scan-result {
    margin: 16px;
    padding: 20px;
    border-radius: var(--radius);
    text-align: center;
}

.scan-result.success { background: #e8f5e9; }
.scan-result.warning { background: #fff8e1; }
.scan-result.error { background: #ffebee; }

.result-icon { font-size: 48px; margin-bottom: 8px; }
.result-text { font-size: 16px; font-weight: 600; color: var(--text); }
.result-detail { font-size: 13px; color: var(--text-light); margin-top: 4px; }

.scanner-footer {
    padding: 16px;
    text-align: center;
}

/* --- List Pages --- */
.page-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 0;
    border-bottom: 1px solid var(--border);
    margin-bottom: 16px;
}

.back-btn {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    padding: 4px;
}

.page-header h2 { font-size: 18px; flex: 1; }

/* --- Notification Items --- */
.notif-item {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 14px 16px;
    margin-bottom: 8px;
    border-left: 4px solid transparent;
    cursor: pointer;
}

.notif-item.unread {
    border-left-color: var(--primary);
    background: #e8eaf6;
}

.notif-title { font-weight: 600; font-size: 14px; }
.notif-message { font-size: 13px; color: var(--text-light); margin-top: 4px; }
.notif-time { font-size: 11px; color: var(--text-light); margin-top: 6px; }

/* --- History / Leave / Approval Items --- */
.history-item, .leave-item, .approval-item {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 14px 16px;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.history-info, .leave-info, .approval-info { flex: 1; }
.history-info strong, .leave-info strong, .approval-info strong { display: block; font-size: 14px; }
.history-info span, .leave-info span, .approval-info span { font-size: 13px; color: var(--text-light); }
.leave-info small, .approval-info small { display: block; font-size: 12px; color: var(--text-light); margin-top: 2px; }

.approval-actions { display: flex; gap: 6px; flex-shrink: 0; }

/* --- Leave Balance --- */
.balance-row {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
}

.balance-card {
    flex: 1;
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 12px;
    text-align: center;
    border: 1px solid var(--border);
}

.balance-label { display: block; font-size: 12px; color: var(--text-light); }
.balance-value { display: block; font-size: 18px; font-weight: 700; color: var(--primary); margin-top: 4px; }

/* --- Modal --- */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: flex-end;
    justify-content: center;
    z-index: 100;
}

.modal-content {
    background: white;
    border-radius: var(--radius) var(--radius) 0 0;
    width: 100%;
    max-width: 480px;
    padding: 24px 16px 32px;
    max-height: 90vh;
    overflow-y: auto;
}

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

.modal-header h3 { font-size: 18px; }

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
}

/* --- Utilities --- */
.loading, .empty, .error {
    text-align: center;
    padding: 32px;
    color: var(--text-light);
    font-size: 14px;
}

.error { color: var(--danger); }

.mt-12 { margin-top: 12px; }
.mb-16 { margin-bottom: 16px; }
