:root {
    --primary-color: #003366;
    /* Ege Laciverti */
    --primary-hover: #002244;
    --secondary-color: #2e7d32;
    /* Ege Yeşili (Akademik fidanlık) */
    --bg-color: #f1f5f9;
    --sidebar-bg: #001f3f;
    /* Koyu Lacivert */
    --card-bg: #ffffff;
    --text-main: #0f172a;
    --text-muted: #475569;
    --danger: #be123c;
    --success: #15803d;
    --warning: #b45309;
    --border: #cbd5e1;
    --radius: 12px;
    --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1);

    /* Ege Tip Specifics */
    --medical-glow: rgba(0, 51, 102, 0.05);
}

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

body {
    font-family: 'Outfit', 'Inter', sans-serif;
    background-color: var(--bg-color);
    background-image: radial-gradient(var(--math-glow) 1px, transparent 1px);
    background-size: 30px 30px;
    /* Graph paper subtle effect */
    color: var(--text-main);
    line-height: 1.6;
    overflow-x: hidden;
}

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

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* Layout */
.wrapper {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 280px;
    background-color: var(--sidebar-bg);
    color: white;
    padding: 30px 0;
    position: fixed;
    height: 100vh;
    box-shadow: 4px 0 10px rgba(0, 0, 0, 0.1);
    z-index: 100;
}

.sidebar h2 {
    text-align: center;
    margin-bottom: 40px;
    font-size: 20px;
    font-weight: 800;
    letter-spacing: 1px;
    background: linear-gradient(to right, #fbbf24, #f59e0b);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    padding: 0 15px;
    position: relative;
}

.sidebar h2::after {
    content: '∑ ∫ √';
    position: absolute;
    bottom: -20px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 12px;
    color: rgba(251, 191, 36, 0.3);
    letter-spacing: 5px;
}

.sidebar::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.03'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
    pointer-events: none;
}

.sidebar ul {
    list-style: none;
}

.sidebar ul li a {
    display: flex;
    align-items: center;
    padding: 14px 25px;
    color: #94a3b8;
    text-decoration: none;
    transition: all 0.2s ease;
    border-left: 4px solid transparent;
    font-weight: 500;
}

.sidebar ul li a:hover,
.sidebar ul li a.active {
    background-color: rgba(255, 255, 255, 0.05);
    color: white;
    border-left-color: var(--primary-color);
}

.main-content {
    flex: 1;
    margin-left: 280px;
    padding: 40px;
    transition: all 0.3s;
}

.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 40px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border);
}

.top-bar h1 {
    font-size: 26px;
    font-weight: 700;
    color: var(--text-main);
}

.date {
    background: white;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-muted);
    box-shadow: var(--shadow);
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 24px;
    margin-bottom: 40px;
}

.stat-card {
    background: var(--card-bg);
    padding: 30px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    transition: transform 0.2s, box-shadow 0.2s;
    border: 1px solid var(--border);
    position: relative;
    overflow: hidden;
}

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

.stat-card::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    /* Move highlight to top */
    background: linear-gradient(to right, var(--primary-color), var(--secondary-color));
}

.stat-card.chalkboard {
    background: var(--chalkboard-bg);
    color: var(--chalk-text);
    border: 4px solid #3d523e;
    box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.5);
}

.stat-card.chalkboard h3 {
    color: rgba(240, 253, 244, 0.6);
}

.stat-card.chalkboard .value {
    color: var(--chalk-text);
    font-family: 'Inter', cursive;
    /* Fallback to handwritten look if possible */
}

.stat-card h3 {
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    margin-bottom: 12px;
}

.stat-card .value {
    font-size: 32px;
    font-weight: 800;
    color: var(--text-main);
}

/* Sections & Tables */
.section {
    margin-bottom: 40px;
}

.section h2 {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 20px;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 10px;
}

.table-container {
    background: var(--card-bg);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
}

table {
    width: 100%;
    border-collapse: collapse;
}

th {
    background-color: #f8fafc;
    padding: 18px 20px;
    text-align: left;
    font-weight: 600;
    font-size: 13px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.025em;
    border-bottom: 1px solid var(--border);
}

td {
    padding: 16px 20px;
    font-size: 14px;
    color: var(--text-main);
    border-bottom: 1px solid var(--border);
}

tr:last-child td {
    border-bottom: none;
}

tr:hover td {
    background-color: #f8fafc;
}

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 12px;
    border-radius: 9999px;
    font-size: 12px;
    font-weight: 600;
    text-transform: capitalize;
}

.badge-success {
    background: #ecfdf5;
    color: #059669;
}

.badge-warning {
    background: #fffbeb;
    color: #d97706;
}

.badge-danger {
    background: #fef2f2;
    color: #dc2626;
}

/* Buttons */
.btn-add {
    background-color: var(--primary-color);
    color: white;
    padding: 12px 24px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
    font-size: 14px;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 14px 0 rgba(99, 102, 241, 0.39);
}

.btn-add:hover {
    background-color: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 8px 15px rgba(30, 58, 138, 0.2);
}

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

.btn-login {
    width: 100%;
    padding: 14px;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.2s;
}

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

/* Forms */
.input-group {
    margin-bottom: 24px;
}

.input-group label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-main);
    margin-bottom: 8px;
}

.input-group input,
.input-group select,
.input-group textarea {
    width: 100%;
    padding: 12px 16px;
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
    color: var(--text-main);
    transition: all 0.2s;
}

.input-group input:focus,
.input-group select:focus,
.input-group textarea:focus {
    outline: none;
    background: white;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
}

/* Modals */
.modal {
    display: none !important;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.75);
    z-index: 1001;
    overflow-y: auto;
    padding: 0;
    /* Tavana sıfır */
    align-items: flex-start;
    justify-content: center;
}

.modal.active {
    display: flex !important;
}

.modal-content {
    background: white;
    width: 100%;
    max-width: 450px;
    margin: 0 auto;
    /* Tavana yapışık */
    padding: 10px 20px;
    /* İç boşluklar minimumda */
    border-radius: 0 0 12px 12px;
    position: relative;
    box-shadow: var(--shadow-lg);
    animation: slideDown 0.3s ease-out;
}

/* Modal specific compact form */
.modal .input-group {
    margin-bottom: 8px;
    /* Extremely tight margin */
}

.modal .input-group label {
    margin-bottom: 4px;
    /* Reduced label margin */
    font-size: 13px;
    /* Slightly smaller labels */
}

.modal .input-group input,
.modal .input-group select,
.modal .input-group textarea {
    padding: 8px 12px;
    /* Compact inputs */
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }

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

#add-modal,
#edit-modal,
#homework-modal,
#add-lesson-modal,
#add-payment-modal,
#add-note-modal,
#add-card-modal {
    backdrop-filter: blur(4px);
}

.login-body {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
    margin: 0;
}

.login-container {
    width: 100%;
    max-width: 450px;
    padding: 20px;
}

.login-box {
    background: white;
    padding: 40px;
    border-radius: 20px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    animation: slideUp 0.4s ease-out;
}

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

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

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 30px;
}

.pagination a {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: white;
    border: 1px solid var(--border);
    border-radius: 8px;
    text-decoration: none;
    color: var(--text-main);
    font-weight: 500;
    transition: all 0.2s;
}

.pagination a.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.pagination a:hover:not(.active) {
    background: #f8fafc;
    border-color: #cbd5e1;
}

/* Alerts */
.alert {
    padding: 16px 20px;
    border-radius: 8px;
    margin-bottom: 24px;
    font-size: 14px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 12px;
}

.alert-success {
    background: #ecfdf5;
    color: #059669;
    border: 1px solid #10b981;
}

.alert-warning {
    background: #fffbeb;
    color: #d97706;
    border: 1px solid #f59e0b;
}

.alert-danger {
    background: #fef2f2;
    color: #dc2626;
    border: 1px solid #ef4444;
}

/* Dashboard Exclusive */
.action-buttons {
    display: flex;
    gap: 15px;
}

.btn-whatsapp {
    background: #25D366;
    color: white;
    padding: 8px;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.btn-whatsapp:hover {
    background: #128c7e;
    transform: scale(1.1);
}

/* Responsive */
@media (max-width: 1024px) {
    .sidebar {
        width: 80px;
    }

    .sidebar h2,
    .sidebar ul li a span {
        display: none;
    }

    .sidebar ul li a {
        justify-content: center;
        padding: 20px;
    }

    .main-content {
        margin-left: 80px;
    }
}

@media (max-width: 640px) {
    .main-content {
        padding: 20px;
    }

    .top-bar {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }
}

/* Voice Input Components */
.mic-btn {
    background: #f1f5f9;
    border: 2px solid #e2e8f0;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s;
    color: #64748b;
}

.mic-btn:hover {
    background: #e2e8f0;
    color: var(--primary-color);
    border-color: var(--primary-color);
}

.mic-btn.recording {
    background: #ef4444;
    color: white;
    border-color: #dc2626;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4);
    }

    70% {
        transform: scale(1.1);
        box-shadow: 0 0 0 10px rgba(239, 68, 68, 0);
    }

    100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0);
    }
}

.input-label-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    background: rgba(99, 102, 241, 0.05);
    padding: 8px;
    border-radius: 8px;
    border: 1px dashed var(--primary-color);
}

.mic-btn-small {
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s;
    color: #64748b;
}

.mic-btn-small:hover {
    background: #e2e8f0;
    color: #6366f1;
    border-color: #6366f1;
}

.mic-btn-small.recording {
    background: #ef4444;
    color: white;
    border-color: #dc2626;
    animation: pulse-small 1.5s infinite;
}

@keyframes pulse-small {
    0% {
        transform: scale(1);
    }

    70% {
        transform: scale(1.1);
    }

    100% {
        transform: scale(1);
    }
}