/* =====================================================
   Yoklama & Akıllı Tahta Kilit Sistemi - Custom CSS
   ===================================================== */

/* --- CSS Variables / Design Tokens --- */
:root {
    /* Primary palette - Soft school colors */
    --primary: #4A6FA5;
    --primary-light: #6B8FBF;
    --primary-dark: #345080;
    --primary-50: rgba(74, 111, 165, 0.05);
    --primary-100: rgba(74, 111, 165, 0.1);
    --primary-200: rgba(74, 111, 165, 0.2);

    /* Accent */
    --accent: #7CB4B8;
    --accent-light: #A3D5D8;

    /* Status colors */
    --success: #4CAF7D;
    --danger: #E06469;
    --warning: #F0A855;
    --info: #5B9BD5;

    /* Neutrals */
    --bg-body: #F0F2F5;
    --bg-card: #FFFFFF;
    --bg-sidebar: #1E2A3A;
    --bg-sidebar-hover: #2A3B50;
    --bg-sidebar-active: #345080;

    --text-primary: #1A1D23;
    --text-secondary: #5A6170;
    --text-muted: #8B92A0;
    --text-sidebar: #B8C4D4;
    --text-sidebar-active: #FFFFFF;

    --border: #E2E6ED;
    --border-light: #F0F2F5;

    /* Shadows */
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.06);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
    --shadow-lg: 0 8px 24px rgba(0,0,0,0.12);
    --shadow-glow: 0 0 20px rgba(74, 111, 165, 0.15);

    /* Layout */
    --sidebar-width: 220px;
    --topbar-height: 56px;
    --radius: 12px;
    --radius-sm: 8px;
    --radius-xs: 6px;

    /* Transitions */
    --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* --- Base --- */
* { box-sizing: border-box; }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-body);
    color: var(--text-primary);
    min-height: 100vh;
    margin: 0;
    -webkit-font-smoothing: antialiased;
}

/* --- Sidebar --- */
.sidebar {
    position: fixed;
    left: 0; top: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--bg-sidebar);
    display: flex;
    flex-direction: column;
    z-index: 1040;
    transition: transform 0.3s ease;
    overflow: hidden;
}

.sidebar-header {
    padding: 20px 16px 16px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    position: relative;
    flex-shrink: 0;
}

.sidebar-logo {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    color: #fff;
    font-weight: 700;
    font-size: 13px;
    text-align: center;
}

.sidebar-logo img {
    height: 52px;
    max-width: 160px;
    object-fit: contain;
    border-radius: 6px;
}

.sidebar-logo i {
    font-size: 32px;
    color: var(--accent);
}

.sidebar-logo span {
    line-height: 1.3;
    opacity: 0.9;
}

.sidebar-toggle {
    background: none;
    border: none;
    color: var(--text-sidebar);
    font-size: 18px;
    cursor: pointer;
    position: absolute;
    top: 16px;
    right: 12px;
}

.sidebar-nav {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 12px 10px;
}

.sidebar-nav::-webkit-scrollbar { width: 4px; }
.sidebar-nav::-webkit-scrollbar-track { background: transparent; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); border-radius: 4px; }

.nav-group-label {
    color: var(--text-muted);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 1.2px;
    padding: 16px 14px 6px;
    text-transform: uppercase;
}

.sidebar-nav .nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    color: var(--text-sidebar);
    text-decoration: none;
    font-size: 13.5px;
    font-weight: 500;
    border-radius: var(--radius-sm);
    transition: var(--transition);
    margin-bottom: 2px;
}

.sidebar-nav .nav-link:hover {
    background: var(--bg-sidebar-hover);
    color: #fff;
}

.sidebar-nav .nav-link.active {
    background: var(--bg-sidebar-active);
    color: var(--text-sidebar-active);
    box-shadow: inset 3px 0 0 var(--accent);
}

.sidebar-nav .nav-link i {
    width: 20px;
    text-align: center;
    font-size: 14px;
    opacity: 0.8;
}

.sidebar-nav .nav-link.active i { opacity: 1; }

.sidebar-footer {
    padding: 16px;
    border-top: 1px solid rgba(255,255,255,0.08);
    flex-shrink: 0;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-sidebar);
    font-size: 13px;
    font-weight: 500;
}

.user-info i { font-size: 20px; color: var(--accent); }

/* --- Topbar (mobile) --- */
.topbar {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0;
    height: var(--topbar-height);
    background: var(--bg-sidebar);
    z-index: 1030;
    padding: 0 16px;
    align-items: center;
    justify-content: space-between;
}

.topbar-title {
    color: #fff;
    font-weight: 600;
    font-size: 15px;
}

/* --- Main Content --- */
.main-content {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    padding: 24px;
    transition: margin 0.3s ease;
}

/* --- Cards --- */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
}

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

.card-header {
    background: transparent;
    border-bottom: 1px solid var(--border-light);
    padding: 16px 20px;
    font-weight: 600;
    font-size: 15px;
}

.card-body { padding: 20px; }

/* --- Stat Cards --- */
.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0;
    width: 4px; height: 100%;
}

.stat-card.stat-primary::before { background: var(--primary); }
.stat-card.stat-success::before { background: var(--success); }
.stat-card.stat-danger::before { background: var(--danger); }
.stat-card.stat-warning::before { background: var(--warning); }
.stat-card.stat-info::before { background: var(--info); }

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

.stat-icon {
    width: 48px; height: 48px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

.stat-primary .stat-icon { background: var(--primary-100); color: var(--primary); }
.stat-success .stat-icon { background: rgba(76,175,125,0.1); color: var(--success); }
.stat-danger .stat-icon { background: rgba(224,100,105,0.1); color: var(--danger); }
.stat-warning .stat-icon { background: rgba(240,168,85,0.1); color: var(--warning); }
.stat-info .stat-icon { background: rgba(91,155,213,0.1); color: var(--info); }

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

.stat-info-text .stat-value {
    font-size: 24px;
    font-weight: 700;
    line-height: 1.2;
}

/* --- Tables --- */
.table {
    font-size: 13.5px;
}

.table thead th {
    background: var(--bg-body);
    border-bottom: 2px solid var(--border);
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    padding: 12px 16px;
}

.table tbody td {
    padding: 12px 16px;
    vertical-align: middle;
    border-bottom: 1px solid var(--border-light);
}

.table tbody tr:hover {
    background: var(--primary-50);
}

/* --- Badges --- */
.badge-status {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.badge-geldi { background: rgba(76,175,125,0.12); color: var(--success); }
.badge-gelmedi { background: rgba(224,100,105,0.12); color: var(--danger); }
.badge-gec { background: rgba(240,168,85,0.12); color: var(--warning); }

/* --- Buttons --- */
.btn {
    font-weight: 500;
    font-size: 13.5px;
    border-radius: var(--radius-xs);
    padding: 8px 16px;
    transition: var(--transition);
}

.btn-primary {
    background: var(--primary);
    border-color: var(--primary);
}
.btn-primary:hover {
    background: var(--primary-dark);
    border-color: var(--primary-dark);
    box-shadow: var(--shadow-glow);
}

.btn-success { background: var(--success); border-color: var(--success); }
.btn-danger { background: var(--danger); border-color: var(--danger); }
.btn-warning { background: var(--warning); border-color: var(--warning); color: #fff; }

/* --- Forms --- */
.form-control, .form-select {
    border-radius: var(--radius-xs);
    border-color: var(--border);
    font-size: 13.5px;
    padding: 8px 12px;
    transition: var(--transition);
}

.form-control:focus, .form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-100);
}

.form-label {
    font-weight: 500;
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

/* --- Login Page --- */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1E2A3A 0%, #345080 50%, #4A6FA5 100%);
    padding: 20px;
}

.login-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    padding: 40px;
    width: 100%;
    max-width: 420px;
    animation: fadeInUp 0.6s ease;
}

.login-card .login-logo {
    text-align: center;
    margin-bottom: 32px;
}

.login-card .login-logo i {
    font-size: 48px;
    color: var(--primary);
    margin-bottom: 12px;
    display: block;
}

.login-card .login-logo h1 {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}

.login-card .login-logo p {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 4px;
}

/* --- Yoklama Grid (Dokunmatik) --- */
.attendance-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 12px;
    padding: 16px 0;
}

.student-card {
    background: var(--bg-card);
    border: 2px solid var(--success);
    border-radius: var(--radius);
    padding: 12px;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    user-select: none;
    -webkit-user-select: none;
    touch-action: manipulation;
}

.student-card:active { transform: scale(0.96); }

.student-card.status-geldi { border-color: var(--success); background: rgba(76,175,125,0.05); }
.student-card.status-gelmedi { border-color: var(--danger); background: rgba(224,100,105,0.08); }
.student-card.status-gec { border-color: var(--warning); background: rgba(240,168,85,0.08); }

.student-card .student-photo {
    width: 64px; height: 64px;
    border-radius: 50%;
    object-fit: cover;
    margin: 0 auto 8px;
    border: 3px solid currentColor;
    display: block;
}

.student-card.status-geldi .student-photo { border-color: var(--success); }
.student-card.status-gelmedi .student-photo { border-color: var(--danger); }
.student-card.status-gec .student-photo { border-color: var(--warning); }

.student-card .student-name {
    font-size: 12px;
    font-weight: 600;
    line-height: 1.3;
    margin-bottom: 6px;
}

.student-card .student-status {
    font-size: 18px;
    line-height: 1;
}

/* --- Warning cards --- */
.warning-card {
    border-left: 4px solid var(--warning);
    border-radius: var(--radius-sm);
    background: rgba(240,168,85,0.06);
    padding: 12px 16px;
    margin-bottom: 8px;
}

.warning-card.severity-danger {
    border-left-color: var(--danger);
    background: rgba(224,100,105,0.06);
}

.warning-card.severity-info {
    border-left-color: var(--info);
    background: rgba(91,155,213,0.06);
}

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

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

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

/* --- Responsive --- */
@media (max-width: 991.98px) {
    .sidebar {
        transform: translateX(-100%);
    }
    .sidebar.open {
        transform: translateX(0);
    }
    .sidebar-overlay {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,0.5);
        z-index: 1035;
    }
    .sidebar-overlay.active {
        display: block;
    }
    .topbar { display: flex; }
    .main-content {
        margin-left: 0;
        padding-top: calc(var(--topbar-height) + 16px);
    }
}

/* --- Scrollbar --- */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* --- Utilities --- */
.text-primary-custom { color: var(--primary) !important; }
.text-success-custom { color: var(--success) !important; }
.text-danger-custom { color: var(--danger) !important; }
.text-warning-custom { color: var(--warning) !important; }
.bg-gradient-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
}

/* iOS input zoom fix — 16px altında Safari otomatik zoom yapar */
@supports (-webkit-touch-callout: none) {
    input, select, textarea, .form-control, .form-select {
        font-size: 16px !important;
    }
}

/* --- Print Styles (Global) --- */
@media print {
    .sidebar, #sidebar, .topbar, .sidebar-overlay, .sidebarOverlay { display: none !important; }
    .main-content { margin-left: 0 !important; padding: 0 !important; width: 100% !important; }
    .container-fluid { max-width: 100% !important; padding: 0 !important; }
    body { background: #fff !important; }
}

