/* =============================================
   ÖDEV TAKİP SİSTEMİ - ANA STİL DOSYASI
   Modern Dark Theme with Glassmorphism
   ============================================= */

/* ===== CSS Variables ===== */
:root {
    /* Primary Colors */
    --primary: #4F46E5;
    --primary-light: #6366F1;
    --primary-dark: #4338CA;
    --secondary: #7C3AED;

    /* Status Colors */
    --success: #10B981;
    --success-light: #34D399;
    --warning: #F59E0B;
    --warning-light: #FBBF24;
    --danger: #EF4444;
    --danger-light: #F87171;
    --info: #3B82F6;

    /* Neutral Colors */
    --bg-dark: #0F172A;
    --bg-darker: #020617;
    --card-bg: #1E293B;
    --card-bg-hover: #334155;
    --border-color: #334155;
    --text-primary: #F8FAFC;
    --text-secondary: #94A3B8;
    --text-muted: #64748B;

    /* Glass Effect */
    --glass-bg: rgba(30, 41, 59, 0.7);
    --glass-border: rgba(255, 255, 255, 0.1);
    --glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);

    /* Gradients */
    --gradient-primary: linear-gradient(135deg, #4F46E5 0%, #7C3AED 100%);
    --gradient-success: linear-gradient(135deg, #10B981 0%, #34D399 100%);
    --gradient-danger: linear-gradient(135deg, #EF4444 0%, #F87171 100%);
    --gradient-card: linear-gradient(145deg, #1E293B 0%, #0F172A 100%);

    /* Typography */
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;

    /* Spacing */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;

    /* Transitions */
    --transition-fast: 0.15s ease;
    --transition-normal: 0.3s ease;
    --transition-slow: 0.5s ease;
}

/* ===== Reset & Base ===== */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
    /* PWA mobile optimizations */
    -webkit-text-size-adjust: 100%;
    -ms-text-size-adjust: 100%;
    touch-action: manipulation;
}

body {
    font-family: var(--font-family);
    background: var(--bg-dark);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    min-height: 100dvh;
    /* Dynamic viewport height for mobile */
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    /* Prevent pull-to-refresh and overscroll */
    overscroll-behavior: none;
    -webkit-overflow-scrolling: touch;
    /* Safe areas for notched phones */
    padding-top: env(safe-area-inset-top);
    padding-left: env(safe-area-inset-left);
    padding-right: env(safe-area-inset-right);
}

a {
    color: var(--primary-light);
    text-decoration: none;
    transition: color var(--transition-fast);
}

a:hover {
    color: var(--primary);
}

/* ===== Scrollbar ===== */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-darker);
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* ===== Glass Card ===== */
.glass-card {
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--glass-shadow);
}

/* ===== LOGIN PAGE ===== */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-darker);
    position: relative;
    overflow: hidden;
}

.login-container {
    width: 100%;
    max-width: 440px;
    padding: 20px;
    position: relative;
    z-index: 10;
}

/* Animated Background */
.bg-animation {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    overflow: hidden;
    pointer-events: none;
}

.floating-shapes span {
    position: absolute;
    display: block;
    width: 80px;
    height: 80px;
    background: var(--gradient-primary);
    opacity: 0.08;
    border-radius: 50%;
    animation: float 25s infinite;
}

.floating-shapes span:nth-child(1) {
    left: 10%;
    width: 120px;
    height: 120px;
    animation-delay: 0s;
}

.floating-shapes span:nth-child(2) {
    left: 25%;
    width: 60px;
    height: 60px;
    animation-delay: 2s;
}

.floating-shapes span:nth-child(3) {
    left: 45%;
    width: 100px;
    height: 100px;
    animation-delay: 4s;
}

.floating-shapes span:nth-child(4) {
    left: 65%;
    width: 80px;
    height: 80px;
    animation-delay: 6s;
}

.floating-shapes span:nth-child(5) {
    left: 80%;
    width: 140px;
    height: 140px;
    animation-delay: 8s;
}

.floating-shapes span:nth-child(6) {
    left: 90%;
    width: 50px;
    height: 50px;
    animation-delay: 10s;
}

@keyframes float {
    0% {
        transform: translateY(100vh) rotate(0deg);
        opacity: 0;
    }

    10% {
        opacity: 0.08;
    }

    90% {
        opacity: 0.08;
    }

    100% {
        transform: translateY(-100vh) rotate(720deg);
        opacity: 0;
    }
}

/* Login Card */
.login-card {
    padding: 40px;
    animation: slideUp 0.6s ease;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.login-header {
    text-align: center;
    margin-bottom: 30px;
}

.logo-icon {
    width: 80px;
    height: 80px;
    background: var(--gradient-primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
    font-size: 36px;
    color: white;
    box-shadow: 0 10px 40px rgba(79, 70, 229, 0.4);
}

.login-header h1 {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 8px;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Login Tabs */
.login-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 30px;
    padding: 6px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: var(--radius-md);
}

.login-tabs .nav-item {
    flex: 1;
}

.login-tabs .nav-link {
    width: 100%;
    padding: 12px;
    color: var(--text-secondary);
    background: transparent;
    border: none;
    border-radius: var(--radius-sm);
    font-weight: 500;
    transition: all var(--transition-normal);
}

.login-tabs .nav-link:hover {
    color: var(--text-primary);
}

.login-tabs .nav-link.active {
    background: var(--gradient-primary);
    color: white;
}

/* Form Styles */
.login-form .form-floating {
    margin-bottom: 16px;
}

.login-form .form-control {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    border-radius: var(--radius-md);
    padding: 16px;
    height: 58px;
    font-size: 1rem;
    transition: all var(--transition-normal);
}

.login-form .form-control:focus {
    background: rgba(0, 0, 0, 0.4);
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.2);
}

.login-form .form-floating label {
    color: var(--text-muted);
    padding: 16px;
}

.login-form .form-floating>.form-control:focus~label,
.login-form .form-floating>.form-control:not(:placeholder-shown)~label {
    color: var(--primary-light);
    transform: scale(0.85) translateY(-0.75rem) translateX(0.15rem);
}

.form-check-input {
    background-color: var(--border-color);
    border-color: var(--border-color);
}

.form-check-input:checked {
    background-color: var(--primary);
    border-color: var(--primary);
}

.form-check-label {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* Login Button */
.btn-login {
    padding: 16px;
    font-size: 1rem;
    font-weight: 600;
    background: var(--gradient-primary);
    border: none;
    border-radius: var(--radius-md);
    transition: all var(--transition-normal);
}

.btn-login:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(79, 70, 229, 0.4);
}

.btn-login:active {
    transform: translateY(0);
}

/* Login Footer */
.login-footer {
    text-align: center;
    margin-top: 30px;
    color: var(--text-muted);
    font-size: 0.85rem;
}

/* Install Banner */
.install-banner {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--gradient-primary);
    color: white;
    padding: 12px 20px;
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    gap: 15px;
    box-shadow: 0 10px 40px rgba(79, 70, 229, 0.5);
    z-index: 1000;
    animation: slideUp 0.5s ease;
}

/* ===== DASHBOARD LAYOUT ===== */
.dashboard-layout {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 280px;
    background: var(--gradient-card);
    border-right: 1px solid var(--border-color);
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    z-index: 100;
    display: flex;
    flex-direction: column;
    transition: transform var(--transition-normal);
}

.sidebar-header {
    padding: 24px;
    border-bottom: 1px solid var(--border-color);
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--text-primary);
    font-weight: 700;
    font-size: 1.25rem;
}

.sidebar-logo i {
    width: 40px;
    height: 40px;
    background: var(--gradient-primary);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
}

.sidebar-nav {
    flex: 1;
    padding: 20px 0;
    overflow-y: auto;
}

.nav-section {
    margin-bottom: 24px;
}

.nav-section-title {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    padding: 0 24px;
    margin-bottom: 8px;
}

.sidebar-nav .nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 24px;
    color: var(--text-secondary);
    font-weight: 500;
    transition: all var(--transition-normal);
    border-left: 3px solid transparent;
}

.sidebar-nav .nav-link:hover {
    color: var(--text-primary);
    background: rgba(79, 70, 229, 0.1);
}

.sidebar-nav .nav-link.active {
    color: var(--primary-light);
    background: rgba(79, 70, 229, 0.15);
    border-left-color: var(--primary);
}

.sidebar-nav .nav-link i {
    width: 20px;
    text-align: center;
}

.sidebar-footer {
    padding: 20px 24px;
    border-top: 1px solid var(--border-color);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-avatar {
    width: 44px;
    height: 44px;
    background: var(--gradient-primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 1.1rem;
}

.user-details h6 {
    font-weight: 600;
    margin-bottom: 2px;
}

.user-details small {
    color: var(--text-muted);
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: 280px;
    min-height: 100vh;
    background: var(--bg-dark);
}

/* Top Header */
.top-header {
    padding: 20px 30px;
    background: var(--card-bg);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 50;
}

.page-title h1 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 4px;
}

.page-title p {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin: 0;
}

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

/* Content Area */
.content-area {
    padding: 30px;
}

/* ===== CARDS ===== */
.stat-card {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    padding: 24px;
    border: 1px solid var(--border-color);
    transition: all var(--transition-normal);
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.stat-card .icon {
    width: 56px;
    height: 56px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    margin-bottom: 16px;
}

.stat-card .icon.primary {
    background: rgba(79, 70, 229, 0.2);
    color: var(--primary-light);
}

.stat-card .icon.success {
    background: rgba(16, 185, 129, 0.2);
    color: var(--success);
}

.stat-card .icon.warning {
    background: rgba(245, 158, 11, 0.2);
    color: var(--warning);
}

.stat-card .icon.danger {
    background: rgba(239, 68, 68, 0.2);
    color: var(--danger);
}

.stat-card .icon.info {
    background: rgba(59, 130, 246, 0.2);
    color: var(--info);
}

.stat-card h3 {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 4px;
}

.stat-card p {
    color: var(--text-muted);
    margin: 0;
}

/* Data Card */
.data-card {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    overflow: hidden;
}

.data-card-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.data-card-header h5 {
    font-weight: 600;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.data-card-body {
    padding: 24px;
}

/* ===== TABLES ===== */
.table-modern {
    width: 100%;
    color: var(--text-primary);
}

.table-modern thead th {
    background: rgba(0, 0, 0, 0.2);
    padding: 14px 16px;
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--text-secondary);
    border: none;
}

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

.table-modern tbody tr:hover {
    background: rgba(79, 70, 229, 0.05);
}

.table-modern tbody tr:last-child td {
    border-bottom: none;
}

/* ===== BADGES ===== */
.badge-status {
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-status.pending {
    background: rgba(245, 158, 11, 0.2);
    color: var(--warning);
}

.badge-status.submitted {
    background: rgba(59, 130, 246, 0.2);
    color: var(--info);
}

.badge-status.graded {
    background: rgba(16, 185, 129, 0.2);
    color: var(--success);
}

.badge-status.late {
    background: rgba(239, 68, 68, 0.2);
    color: var(--danger);
}

.badge-status.returned {
    background: rgba(124, 58, 237, 0.2);
    color: var(--secondary);
}

/* ===== BUTTONS ===== */
.btn {
    font-weight: 500;
    border-radius: var(--radius-sm);
    transition: all var(--transition-normal);
}

.btn-primary {
    background: var(--gradient-primary);
    border: none;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(79, 70, 229, 0.4);
}

.btn-success {
    background: var(--gradient-success);
    border: none;
}

.btn-danger {
    background: var(--gradient-danger);
    border: none;
}

.btn-outline-primary {
    border: 1px solid var(--primary);
    color: var(--primary-light);
}

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

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    border: none;
}

.btn-ghost:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
}

/* ===== FORMS ===== */
.form-control,
.form-select {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    border-radius: var(--radius-sm);
    padding: 12px 16px;
}

.form-control:focus,
.form-select:focus {
    background: rgba(0, 0, 0, 0.4);
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.2);
    color: var(--text-primary);
}

.form-control::placeholder {
    color: var(--text-muted);
}

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

/* ===== MODALS ===== */
.modal-content {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
}

.modal-header {
    border-bottom: 1px solid var(--border-color);
    padding: 20px 24px;
}

.modal-title {
    font-weight: 600;
}

.modal-body {
    padding: 24px;
}

.modal-footer {
    border-top: 1px solid var(--border-color);
    padding: 16px 24px;
}

.btn-close {
    filter: invert(1) grayscale(100%) brightness(200%);
}

/* ===== ALERTS ===== */
.alert {
    border-radius: var(--radius-md);
    border: none;
    padding: 16px 20px;
}

.alert-success {
    background: rgba(16, 185, 129, 0.15);
    color: var(--success);
}

.alert-danger {
    background: rgba(239, 68, 68, 0.15);
    color: var(--danger);
}

.alert-warning {
    background: rgba(245, 158, 11, 0.15);
    color: var(--warning);
}

.alert-info {
    background: rgba(59, 130, 246, 0.15);
    color: var(--info);
}

/* ===== ASSIGNMENT CARDS ===== */
.assignment-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 24px;
    transition: all var(--transition-normal);
    cursor: pointer;
}

.assignment-card:hover {
    transform: translateY(-4px);
    border-color: var(--primary);
    box-shadow: 0 10px 40px rgba(79, 70, 229, 0.2);
}

.assignment-card .subject-tag {
    display: inline-block;
    padding: 4px 12px;
    background: rgba(79, 70, 229, 0.2);
    color: var(--primary-light);
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    margin-bottom: 12px;
}

.assignment-card h5 {
    font-weight: 600;
    margin-bottom: 8px;
}

.assignment-card .description {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 16px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.assignment-card .meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.assignment-card .due-date {
    display: flex;
    align-items: center;
    gap: 6px;
}

.assignment-card .due-date.urgent {
    color: var(--danger);
}

.assignment-card .due-date.warning {
    color: var(--warning);
}

/* ===== EMPTY STATE ===== */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.empty-state i {
    font-size: 4rem;
    margin-bottom: 20px;
    opacity: 0.5;
}

.empty-state h5 {
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-secondary);
}

/* ===== LOADING ===== */
.loading-spinner {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
}

.loading-spinner::after {
    content: '';
    width: 40px;
    height: 40px;
    border: 3px solid var(--border-color);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* ===== MOBILE RESPONSIVE ===== */
@media (max-width: 991px) {
    .sidebar {
        transform: translateX(-100%);
        width: 280px;
        z-index: 1000;
    }

    .sidebar.show {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
    }

    .mobile-menu-btn {
        display: flex !important;
        align-items: center;
        justify-content: center;
        width: 44px;
        height: 44px;
        background: var(--card-bg);
        border: 1px solid var(--border-color);
        border-radius: var(--radius-sm);
        color: var(--text-primary);
        font-size: 1.2rem;
        cursor: pointer;
        -webkit-tap-highlight-color: transparent;
    }

    .top-header {
        gap: 12px;
    }

    .top-header .page-title h1 {
        font-size: 1.25rem;
    }
}

@media (max-width: 768px) {

    /* Login Card */
    .login-card {
        padding: 24px 20px;
        margin: 10px;
        max-width: calc(100% - 20px);
    }

    .login-container {
        padding: 10px;
    }

    /* Content Areas */
    .content-area {
        padding: 16px;
        padding-bottom: calc(16px + env(safe-area-inset-bottom));
    }

    .top-header {
        padding: 12px 16px;
        flex-wrap: wrap;
        gap: 10px;
    }

    .page-title h1 {
        font-size: 1.1rem;
    }

    .page-title p {
        font-size: 0.8rem;
    }

    /* Cards */
    .stat-card {
        padding: 16px;
    }

    .stat-card h3 {
        font-size: 1.5rem;
    }

    .stat-card .icon {
        width: 48px;
        height: 48px;
        font-size: 1.2rem;
    }

    .data-card-body {
        padding: 16px;
    }

    .data-card-header {
        padding: 14px 16px;
        flex-direction: column;
        gap: 10px;
        align-items: flex-start;
    }

    /* Tables - Horizontal scroll */
    .table-modern {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .table-modern thead th,
    .table-modern tbody td {
        white-space: nowrap;
        padding: 12px 10px;
        font-size: 0.85rem;
    }

    /* Modal - Full screen on mobile */
    .modal-dialog {
        margin: 0;
        max-width: 100%;
        min-height: 100vh;
        min-height: 100dvh;
    }

    .modal-content {
        border-radius: 0;
        min-height: 100vh;
        min-height: 100dvh;
        border: none;
    }

    .modal-header {
        position: sticky;
        top: 0;
        z-index: 10;
        background: var(--card-bg);
        padding: 16px 20px;
    }

    .modal-body {
        padding: 20px;
        overflow-y: auto;
        flex: 1;
    }

    .modal-footer {
        position: sticky;
        bottom: 0;
        background: var(--card-bg);
        padding: 16px 20px;
        padding-bottom: calc(16px + env(safe-area-inset-bottom));
    }

    /* Forms - Better touch targets */
    .form-control,
    .form-select {
        font-size: 16px !important;
        /* Prevents zoom on iOS */
        padding: 14px 16px;
        min-height: 50px;
    }

    .form-floating .form-control {
        height: 58px;
    }

    .form-floating label {
        padding: 14px 16px;
    }

    /* Buttons - Larger touch targets */
    .btn {
        min-height: 44px;
        padding: 12px 20px;
        font-size: 0.95rem;
    }

    .btn-sm {
        min-height: 38px;
        padding: 8px 14px;
    }

    .btn-lg {
        min-height: 52px;
        padding: 14px 24px;
    }

    /* Assignment Cards */
    .assignment-card {
        padding: 16px;
    }

    .assignment-card .meta {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    /* Alerts */
    .alert {
        padding: 14px 16px;
        font-size: 0.9rem;
    }

    /* Row columns on mobile */
    .row.g-4 {
        --bs-gutter-x: 0.75rem;
        --bs-gutter-y: 0.75rem;
    }
}

/* ===== PWA SPECIFIC ===== */
@media (display-mode: standalone) {

    /* When running as installed PWA */
    body {
        -webkit-user-select: none;
        user-select: none;
    }

    /* Allow text selection in inputs and textareas */
    input,
    textarea,
    [contenteditable="true"] {
        -webkit-user-select: auto;
        user-select: auto;
    }

    /* Prevent context menu on long press (except inputs) */
    *:not(input):not(textarea) {
        -webkit-touch-callout: none;
    }
}

/* ===== TOUCH OPTIMIZATIONS ===== */
/* Disable double-tap zoom behavior */
button,
a,
.btn,
.nav-link,
.form-check-input,
.form-check-label,
[role="button"] {
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

/* Active state feedback for touch */
.btn:active,
.nav-link:active,
.assignment-card:active {
    transform: scale(0.98);
    opacity: 0.9;
}

/* ===== UTILITIES ===== */
.text-gradient {
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.mobile-menu-btn {
    display: none;
}

.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    z-index: 999;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-normal);
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
}

.overlay.show {
    opacity: 1;
    visibility: visible;
}

/* Prevent body scroll when modal/sidebar is open */
body.modal-open,
body.sidebar-open {
    overflow: hidden;
    position: fixed;
    width: 100%;
    height: 100%;
}

/* iOS keyboard handling */
@supports (-webkit-touch-callout: none) {
    .modal-body {
        padding-bottom: 100px;
        /* Extra space for iOS keyboard */
    }
}

/* ===== BOOTSTRAP DARK MODE OVERRIDES ===== */
/* Text colors */
.text-muted {
    color: var(--text-muted) !important;
}

.text-secondary {
    color: var(--text-secondary) !important;
}

small,
.small {
    color: var(--text-secondary);
}

/* Ensure all text inside cards is visible */
.data-card,
.stat-card,
.assignment-card,
.modal-content {
    color: var(--text-primary);
}

.data-card-body p,
.data-card-body span,
.data-card-body small,
.data-card-body div {
    color: var(--text-secondary);
}

.data-card-body strong {
    color: var(--text-primary);
}

/* Table text */
.table-modern td,
.table-modern th {
    color: var(--text-primary);
}

.table-modern .text-muted,
.table-modern small {
    color: var(--text-muted) !important;
}

/* Empty state text */
.empty-state,
.empty-state p,
.empty-state h5 {
    color: var(--text-muted) !important;
}

/* Code elements */
code {
    color: var(--primary-light);
    background: rgba(79, 70, 229, 0.2);
    padding: 2px 6px;
    border-radius: 4px;
}

/* Border bottom for lists */
.border-bottom {
    border-color: var(--border-color) !important;
}

/* Button tooltips */
.btn[title]:hover::after {
    content: attr(title);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    padding: 4px 8px;
    background: var(--card-bg);
    color: var(--text-primary);
    font-size: 0.75rem;
    border-radius: 4px;
    white-space: nowrap;
    z-index: 1000;
    margin-bottom: 4px;
    border: 1px solid var(--border-color);
}

.btn {
    position: relative;
}

/* Badges */
.badge {
    font-weight: 500;
}

.badge.bg-secondary {
    background: var(--text-muted) !important;
}

/* Lists inside data cards */
.data-card-body .d-flex span,
.data-card-body .d-flex div {
    color: var(--text-primary);
}

/* Fix for academic year and other secondary info */
.table-modern td code,
.table-modern td .text-muted {
    color: var(--text-muted) !important;
}