/* ========================================
   Okul İzin Yönetim Sistemi - Ana CSS
   ======================================== */

:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --secondary: #64748b;
    --success: #22c55e;
    --danger: #ef4444;
    --warning: #f59e0b;
    --info: #3b82f6;
    --light: #f8fafc;
    --dark: #1e293b;
    --white: #ffffff;
    --gray-100: #f1f5f9;
    --gray-200: #e2e8f0;
    --gray-300: #cbd5e1;
    --gray-400: #94a3b8;
    --gray-500: #64748b;
    --gray-600: #475569;
    --sidebar-width: 260px;
    --header-height: 60px;
    --border-radius: 8px;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--gray-100);
    color: var(--dark);
    line-height: 1.6;
}

a {
    color: var(--primary);
    text-decoration: none;
}

a:hover {
    color: var(--primary-dark);
}

/* App Container */
.app-container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background: var(--dark);
    color: var(--white);
    position: fixed;
    height: 100vh;
    overflow-y: auto;
    transition: transform 0.3s ease;
    z-index: 1000;
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-header h2 {
    font-size: 1.25rem;
    font-weight: 600;
}

.sidebar-header i {
    margin-right: 10px;
    color: var(--primary);
}

.sidebar-nav ul {
    list-style: none;
    padding: 10px 0;
}

.sidebar-nav li a {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    color: var(--gray-300);
    transition: all 0.2s;
}

.sidebar-nav li a:hover,
.sidebar-nav li a.active {
    background: rgba(255, 255, 255, 0.1);
    color: var(--white);
}

.sidebar-nav li a.active {
    border-left: 3px solid var(--primary);
}

.sidebar-nav li a i {
    width: 24px;
    margin-right: 10px;
}

.sidebar-nav .nav-section {
    padding: 15px 20px 5px;
    font-size: 0.75rem;
    text-transform: uppercase;
    color: var(--gray-500);
    letter-spacing: 1px;
}

.sidebar-nav .badge {
    background: var(--danger);
    color: var(--white);
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.75rem;
    margin-left: auto;
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    min-height: 100vh;
}

/* Top Header */
.top-header {
    height: var(--header-height);
    background: var(--white);
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    position: sticky;
    top: 0;
    z-index: 100;
}

.sidebar-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 1.25rem;
    cursor: pointer;
    color: var(--gray-600);
}

/* SAĞA YASLAMA DÜZELTMESİ */
.header-right {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-left: auto;
    /* Bu satır sağa yaslamayı garanti eder */
}

.user-info {
    text-align: right;
}

.user-name {
    display: block;
    font-weight: 600;
    color: var(--dark);
}

.user-role {
    font-size: 0.8rem;
    color: var(--gray-500);
}

/* Dropdown */
.dropdown {
    position: relative;
}

.dropdown-toggle {
    background: none;
    border: none;
    font-size: 1.75rem;
    cursor: pointer;
    color: var(--gray-500);
}

.dropdown-menu {
    position: absolute;
    right: 0;
    top: 100%;
    background: var(--white);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-md);
    min-width: 180px;
    display: none;
    z-index: 1000;
}

.dropdown:hover .dropdown-menu {
    display: block;
}

.dropdown-menu a {
    display: block;
    padding: 10px 16px;
    color: var(--gray-600);
}

.dropdown-menu a:hover {
    background: var(--gray-100);
}

.dropdown-menu hr {
    border: none;
    border-top: 1px solid var(--gray-200);
    margin: 5px 0;
}

/* Page Content */
.page-content {
    padding: 24px;
}

.page-header {
    margin-bottom: 24px;
}

.page-header h1 {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--dark);
}

.page-header p {
    color: var(--gray-500);
    margin-top: 4px;
}

/* Cards */
.card {
    background: var(--white);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    margin-bottom: 24px;
}

.card-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-header h3 {
    font-size: 1rem;
    font-weight: 600;
}

.card-body {
    padding: 20px;
}

/* Stats Cards */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--white);
    border-radius: var(--border-radius);
    padding: 20px;
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    gap: 16px;
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
}

.stat-icon.primary {
    background: rgba(37, 99, 235, 0.1);
    color: var(--primary);
}

.stat-icon.success {
    background: rgba(34, 197, 94, 0.1);
    color: var(--success);
}

.stat-icon.warning {
    background: rgba(245, 158, 11, 0.1);
    color: var(--warning);
}

.stat-icon.danger {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
}

.stat-content h4 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--dark);
}

.stat-content p {
    font-size: 0.875rem;
    color: var(--gray-500);
}

/* Tables */
.table-responsive {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

table th,
table td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid var(--gray-200);
}

table th {
    background: var(--gray-100);
    font-weight: 600;
    color: var(--gray-600);
    font-size: 0.875rem;
}

table tbody tr:hover {
    background: var(--gray-50);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: var(--border-radius);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.8rem;
}

.btn-primary {
    background: var(--primary);
    color: var(--white);
}

.btn-primary:hover {
    background: var(--primary-dark);
    color: var(--white);
}

.btn-success {
    background: var(--success);
    color: var(--white);
}

.btn-danger {
    background: var(--danger);
    color: var(--white);
}

.btn-secondary {
    background: var(--gray-200);
    color: var(--gray-700);
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--gray-300);
    color: var(--gray-600);
}

.btn-outline:hover {
    background: var(--gray-100);
}

/* Forms */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    color: var(--gray-700);
}

.form-control {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--gray-300);
    border-radius: var(--border-radius);
    font-size: 0.95rem;
    transition: border-color 0.2s;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
}

select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%23475569' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10l-5 5z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right -2px center;
    padding-right: 36px;
}

textarea.form-control {
    min-height: 100px;
    resize: vertical;
}

/* Alerts */
.alert {
    padding: 14px 20px;
    border-radius: var(--border-radius);
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.alert-success {
    background: rgba(34, 197, 94, 0.1);
    color: #166534;
    border: 1px solid rgba(34, 197, 94, 0.2);
}

.alert-danger {
    background: rgba(239, 68, 68, 0.1);
    color: #991b1b;
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.alert-warning {
    background: rgba(245, 158, 11, 0.1);
    color: #92400e;
    border: 1px solid rgba(245, 158, 11, 0.2);
}

.alert-info {
    background: rgba(59, 130, 246, 0.1);
    color: #1e40af;
    border: 1px solid rgba(59, 130, 246, 0.2);
}

/* Status Badges */
.status {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
}

.status-beklemede {
    background: rgba(245, 158, 11, 0.1);
    color: #92400e;
}

.status-onaylandi {
    background: rgba(34, 197, 94, 0.1);
    color: #166534;
}

.status-reddedildi {
    background: rgba(239, 68, 68, 0.1);
    color: #991b1b;
}

.status-iptal {
    background: rgba(100, 116, 139, 0.1);
    color: #475569;
}

/* Badge */
.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 500;
}

/* Login Page */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    padding: 20px;
}

.login-box {
    background: var(--white);
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
    width: 100%;
    max-width: 420px;
    padding: 40px;
}

.login-header {
    text-align: center;
    margin-bottom: 32px;
}

.login-header h1 {
    font-size: 1.75rem;
    color: var(--dark);
    margin-bottom: 8px;
}

.login-header p {
    color: var(--gray-500);
}

.login-logo {
    font-size: 3rem;
    color: var(--primary);
    margin-bottom: 16px;
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: var(--white);
    border-radius: var(--border-radius);
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    font-size: 1.1rem;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--gray-400);
}

.modal-body {
    padding: 20px;
}

.modal-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--gray-200);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* Pagination */
.pagination {
    display: flex;
    gap: 8px;
    justify-content: center;
    margin-top: 20px;
}

.pagination a,
.pagination span {
    padding: 8px 14px;
    border-radius: var(--border-radius);
    border: 1px solid var(--gray-300);
    color: var(--gray-600);
}

.pagination a:hover {
    background: var(--gray-100);
}

.pagination .active {
    background: var(--primary);
    color: var(--white);
    border-color: var(--primary);
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--gray-500);
}

.empty-state i {
    font-size: 4rem;
    color: var(--gray-300);
    margin-bottom: 20px;
}

.empty-state h3 {
    color: var(--gray-600);
    margin-bottom: 8px;
}

/* Print Styles */
@media print {

    .sidebar,
    .top-header,
    .btn,
    .no-print {
        display: none !important;
    }

    .main-content {
        margin-left: 0 !important;
    }

    .page-content {
        padding: 0 !important;
    }

    .card {
        box-shadow: none !important;
        border: 1px solid #ddd !important;
    }
}

/* =========================================
   GÖRÜNÜRLÜK SINIFLARI (HTML AYRIMI İÇİN)
   ========================================= */
.mobile-view {
    display: none !important;
}

.desktop-view {
    display: block !important;
}

/* Responsive BREAKPOINT: 992px */
@media (max-width: 992px) {
    .mobile-view {
        display: block !important;
    }

    .desktop-view {
        display: none !important;
    }

    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.active {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0 !important;
        width: 100% !important;
        padding: 10px !important;
        /* max-width: 100vw !important;  <-- KALDIRILDI */
        /* overflow-x: hidden !important; <-- KALDIRILDI: İçerik taşarsa scroll çıksın */
    }

    .sidebar-toggle {
        display: block;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    /* Force word break to prevent overflow */
    .table-responsive td,
    .table-responsive th {
        word-break: break-word;
        white-space: normal;
    }

    /* =================================================================
       MOBILE LAYOUT FIXES (Moved from dashboard.php)
       ================================================================= */
    .app-container {
        display: block;
        /* Disable flex on mobile to prevent squashing */
        position: relative;
        overflow-x: hidden;
        width: 100%;
    }

    .sidebar {
        position: fixed;
        left: -280px;
        /* Hide off-screen */
        top: 0;
        height: 100vh;
        z-index: 9999;
        transition: left 0.3s ease;
        width: 260px;
        transform: none;
        /* Reset transform based logic if conflicts */
    }

    .sidebar.active {
        left: 0;
        /* Slide in */
        transform: none;
    }

    html,
    body {
        width: 100%;
        margin: 0;
        padding: 0;
        /* overflow-x: hidden;  <-- BU SATIR KALDIRILDI: Kaydırmayı engelliyordu */
    }

    .main-content {
        width: 100%;
        margin-left: 0;
        padding: 0;
        max-width: 100vw;
    }

    .top-header {
        width: 100%;
        padding: 10px 15px;
    }

    .page-content {
        padding: 15px;
    }

    /* =================================================================
       RESPONSIVE TABLE (CARD VIEW)
       ================================================================= */

    /* Force tables to not be like tables anymore */
    /* Force tables to not be like tables anymore */
    .table-responsive table,
    .table-responsive thead,
    .table-responsive tbody,
    .table-responsive th,
    .table-responsive td,
    .table-responsive tr {
        display: block !important;
    }

    /* Hide table headers (but not display: none;, for accessibility) */
    .table-responsive thead tr {
        position: absolute;
        top: -9999px;
        left: -9999px;
    }

    .table-responsive tr {
        border: 1px solid var(--gray-200);
        margin-bottom: 15px;
        border-radius: 12px;
        background: var(--white);
        padding: 15px;
        box-shadow: var(--shadow);
    }

    .table-responsive td {
        border: none;
        border-bottom: 1px solid var(--gray-100);
        position: relative;
        padding: 12px 0;
        display: flex;
        justify-content: space-between;
        align-items: center;
        text-align: right;
        font-size: 0.9rem;
    }

    .table-responsive td:last-child {
        border-bottom: 0;
    }

    .table-responsive td:before {
        content: attr(data-label);
        font-weight: 700;
        color: var(--gray-600);
        text-align: left;
        flex-shrink: 0;
        margin-right: 15px;
        max-width: 40%;
    }

    /* Special handling for Year Summary Table */
    .year-summary-table tr {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }

    .year-summary-table td {
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        text-align: center;
        border: none;
        background: var(--gray-50);
        border-radius: 8px;
        padding: 10px;
        height: 100%;
    }

    .year-summary-table td:before {
        display: block;
        text-align: center;
        margin-bottom: 5px;
        margin-right: 0;
        max-width: 100%;
        color: var(--gray-500);
        font-size: 0.75rem;
        text-transform: uppercase;
        letter-spacing: 0.5px;
    }
}