/* ============================================= */
/*        DERS NOTLARI SAYFASI STİLLERİ v10      */
/*  Mobil Kart Ortalama & Pagination Responsive  */
/* ============================================= */

/* ---- GLOBAL MOBİL TAŞMA FİX VE TEMEL AYARLAR ---- */
html,
body {
    max-width: 100%;
    overflow-x: hidden;
    position: relative; /* Pozisyonlandırma için temel */
}

/* Garantiye almak için tüm elemanların kutu modelini düzeltiyoruz.
   Bu, padding ve border'ların genişliğe dahil edilmesini sağlar. */
*,
*::before,
*::after {
    box-sizing: border-box;
    max-inline-size: 100%; /* Genişlik taşmalarını engeller */
    min-width: 0; /* Flex/Grid elemanlarının küçülmesini sağlar */
}

/* --------- GLOBAL DEĞİŞKENLER (LIGHT MODE) --------- */
:root {
    /* Glass + vars (kulüp stili) */
    --glass-bg: rgba(255, 255, 255, 0.42);
    --glass-border: rgba(255, 255, 255, 0.55);
    --glass-shadow: 0 12px 28px rgba(31, 38, 135, 0.12);
    --placeholder-color: rgba(0, 0, 0, 0.45);
    --border-color: #e6e9ef;
    --hero-bg-h: clamp(420px, 48vw, 640px);

    --f1: #eaf4ff;
    --f2: #ffffff;

    /* brand / text tokens */
    --text: #0f172a;
    --muted: #6b7280;
    --bg-page: #f8fafc;
    --surface: #ffffff;

    --brand-cta: #ffa631;
    --brand-cta-hover: #ff8a00;

    /* cards / shadows */
    --card-bg: #ffffff;
    --card-shadow: 0 6px 15px rgba(60, 60, 100, 0.07);
    --card-shadow-hover: 0 8px 28px rgba(60, 60, 100, 0.12);

    /* extra shadows for dropdown etc */
    --shadow-lg: 0 24px 48px rgba(15, 23, 42, 0.08);

    /* footer-ish bg steps */
    --shadow: 0 14px 34px rgba(31, 38, 135, 0.14);
    --shadow-soft: 0 20px 44px rgba(31, 38, 135, 0.18);
}

/* --------- GLOBAL DEĞİŞKENLER (DARK MODE) --------- */
body.dark {
    --glass-bg: rgba(16, 16, 16, 0.65);
    --glass-border: rgba(255, 255, 255, 0.1);
    --glass-shadow: 0 10px 26px rgba(0, 0, 0, 0.35);
    --placeholder-color: rgba(255, 255, 255, 0.45);

    --border-color: #2a2a2a;

    --f1: #0f1216;
    --f2: #0b0c0d;

    --text: #f8fafc;
    --muted: #94a3b8;

    /* koyu düz arka plan */
    --bg-page: #1f1f1f;
    --surface: #1c1c1e;

    --card-bg: #1c1c1e;
    --card-shadow: 0 6px 20px rgba(0, 0, 0, 0.6);
    --card-shadow-hover: 0 8px 30px rgba(0, 0, 0, 0.8);

    --shadow-lg: 0 24px 48px rgba(0, 0, 0, 0.8);

    --shadow: 0 18px 42px rgba(0, 0, 0, 0.7);
    --shadow-soft: 0 24px 54px rgba(0, 0, 0, 0.8);
}

/* --------- BODY / ARKA PLAN --------- */
body {
    background: var(--bg-page);
    color: var(--text);
}

/* LIGHT MODE blob */
body::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    width: 100%;
    height: var(--hero-bg-h);
    z-index: -1;
    pointer-events: none;
    background: radial-gradient(
            ellipse 55% 55% at 25% 20%,
            #f4a48a90,
            transparent
        ),
        radial-gradient(ellipse 50% 50% at 66% 12%, #c2a5f780, transparent),
        radial-gradient(ellipse 50% 50% at 90% 38%, #abebff80, transparent);
    opacity: 0.95;
    mask-image: linear-gradient(to bottom, black 70%, transparent 100%);
    -webkit-mask-image: linear-gradient(to bottom, black 70%, transparent 100%);
}

/* DARK MODE blob */
body.dark::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    width: 100%;
    height: var(--hero-bg-h);
    z-index: -1;
    pointer-events: none;
    background: radial-gradient(
            ellipse 55% 55% at 25% 20%,
            #8e44ad80,
            transparent
        ),
        radial-gradient(ellipse 50% 50% at 66% 12%, #2980b980, transparent),
        radial-gradient(ellipse 50% 50% at 90% 38%, #16a08580, transparent);
    opacity: 0.6;
    mask-image: linear-gradient(to bottom, black 70%, transparent 100%);
    -webkit-mask-image: linear-gradient(to bottom, black 70%, transparent 100%);
}

.page-lecture-index {
    position: relative;
    z-index: 1;
    background: transparent;
    width: 100%;
}

.container {
    max-width: 1140px;
    margin-left: auto;
    margin-right: auto;
    padding-left: 16px;
    padding-right: 16px;
    width: 100%;
}

/* ===== HERO ===== */
.page-hero {
    padding: clamp(56px, 9vw, 84px) 0 24px;
    text-align: center;
    color: var(--text);
    position: relative;
    z-index: 1;
}

.page-title {
    font-weight: 800;
    font-size: clamp(2.2rem, 4.4vw, 3rem);
    margin: 0 0 24px;
    letter-spacing: 0.2px;
    text-shadow: 0 2px 18px rgba(0, 0, 0, 0.08);
    color: var(--text);
}

/* modal z-index fix */
.modal {
    z-index: 1900;
}
.modal-backdrop {
    z-index: 900;
}

/* ===== FİLTRE BAR (GLASS CAPSULE) ===== */
.filter-container {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    box-shadow: var(--glass-shadow);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    padding: 16px;
    max-width: 900px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 1fr 1fr auto;
    gap: 12px;
    align-items: center;
    position: relative;
    z-index: 2;
}

.search-field,
.filter-field {
    position: relative;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    box-shadow: var(--glass-shadow);
    border-radius: 18px;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.filter-container .search-field:focus-within,
.filter-container .filter-field:focus-within {
    box-shadow: 0 0 0 3px rgba(255, 166, 49, 0.28), var(--glass-shadow);
    border-color: var(--brand-cta);
}

.search-field input,
.filter-field input,
.filter-field select {
    width: 100%;
    height: 58px;
    background: transparent;
    border: none;
    border-radius: 16px;
    outline: 0;
    color: var(--text);
    font-weight: 600;
    font-size: 1rem;
    padding: 0 1rem;
}

.search-icon {
    position: absolute;
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
    width: 22px;
    height: 22px;
    color: var(--muted);
    opacity: 0.7;
    pointer-events: none;
}
.search-icon svg {
    width: 100%;
    height: 100%;
}
.search-field input {
    padding-left: 60px;
}

.filter-field .form-select,
.filter-field select {
    padding: 0 2.5rem 0 1rem;
    appearance: none;
    -webkit-appearance: none;
    background-repeat: no-repeat;
    background-size: 1.1em;
    background-position: right 1rem center;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
}

body.dark .filter-field .form-select,
body.dark .filter-field select {
    color-scheme: dark;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%23a9b4c2' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
}

input::placeholder {
    color: var(--placeholder-color);
}
select:has(option[disabled][selected]) {
    color: var(--placeholder-color);
}
body.dark select:has(option[disabled][selected]) {
    color: var(--placeholder-color);
}

/* ===== NOT LİSTESİ BÖLÜMÜ ===== */
.lecture-notes-section {
    padding: 24px 0 64px;
    position: relative;
    z-index: 1;
}

/* MOBİL KAYMA & ORTALAMA FİX: Kartlar için grid yapısı */
.lecture-notes-section .row {
    display: grid;
    /* Kartların min genişliği en dar ekranlara göre ayarlandı, taşma yapmaz. */
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 24px;
    /* Kartlar satırda ortalanır, boşluklar estetik görünür. */
    justify-content: center;
}

.lecture-notes-section .row > [class*="col-"] {
    width: auto;
    max-width: 100%;
    padding: 0;
    margin: 0;
    flex: none;
}

/* ===== NOT KARTI ===== */
.note-card {
    background: var(--surface);
    border-radius: 24px;
    box-shadow: var(--card-shadow);
    border: 1px solid var(--border-color);
    padding: 24px;
    position: relative;
    display: flex;
    flex-direction: column;
    text-align: center;
    transition: transform 0.22s ease, box-shadow 0.22s ease;
    color: var(--text);
    min-height: 240px;
    height: 100%;
}
.note-card:hover {
    transform: translateY(-6px);
    box-shadow: var(--card-shadow-hover);
}

.note-card-header-info {
    position: absolute;
    top: 8px;
    right: 16px;
    text-align: right;
    font-size: 0.75rem;
    color: var(--muted);
    line-height: 1.3;
}

.note-card .card-body {
    padding: 0;
    flex-grow: 1;
    margin-top: 20px;
    display: flex;
    flex-direction: column;
}
.note-university {
    font-size: 0.8rem;
    color: var(--muted);
    margin-bottom: 4px;
}
.note-title {
    font-weight: 800;
    font-size: 1.2rem;
    color: var(--text);
    margin-bottom: 4px;
    word-break: break-word;
    flex-grow: 1;
}
.note-code {
    font-size: 0.85rem;
    color: var(--brand-cta);
    font-weight: 600;
    margin-bottom: 16px;
}

.note-card .card-footer {
    padding: 0;
    border: 0;
    background: transparent;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    margin-top: auto;
}
.note-stats {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    row-gap: 0.5rem;
    column-gap: 1rem;
    color: var(--muted);
    font-size: 0.9rem;
    font-weight: 500;
    text-align: left;
}
.note-stats span {
    display: flex;
    align-items: center;
    gap: 5px;
}
.note-stats i {
    font-size: 1.1rem;
}

.like-action {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--muted);
    padding: 0;
}
.like-action.liked {
    color: var(--brand-cta);
}

.btn-download {
    padding: 10px 24px;
    border-radius: 12px;
    font-weight: 800;
    text-decoration: none;
    background: var(--brand-cta);
    color: #fff !important;
    border: 0;
    box-shadow: 0 10px 24px rgba(255, 166, 49, 0.28);
    transition: transform 0.2s, background-color 0.2s;
    white-space: nowrap;
    margin-left: auto;
    flex-shrink: 0;
}
.btn-download:hover {
    background: var(--brand-cta-hover);
    transform: translateY(-2px);
}

/* "Yeni Ders Notu Ekle" kartı */
.note-card-add {
    border: 2px dashed var(--border-color);
    background: transparent;
    box-shadow: none;
    align-items: center;
    justify-content: center;
    padding: 24px;
    color: var(--muted);
    min-height: 240px;
    border-radius: 24px;
    display: flex;
    flex-direction: column;
    text-align: center;
    height: 100%;
    transition: border-color 0.2s, background-color 0.2s, color 0.2s;
}
.note-card-add:hover {
    border-color: var(--brand-cta);
    background: rgba(255, 166, 49, 0.05);
}
.add-note-link {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    color: var(--muted);
    text-align: center;
    transition: color 0.2s;
    width: 100%;
    height: 100%;
}
.note-card-add:hover .add-note-link {
    color: var(--brand-cta);
}
.add-note-icon {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background-color: rgba(255, 166, 49, 0.15);
    color: var(--brand-cta);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    font-weight: 400;
    line-height: 1;
    margin-bottom: 0.75rem;
}
.add-note-text {
    font-weight: 600;
}

/* ===== MODAL (form alanları) ===== */
.modal-content {
    background: var(--surface);
    color: var(--text);
    border: none;
    border-radius: 1rem;
}
.modal-header,
.modal-footer {
    border-color: var(--border-color);
    color: var(--text);
}
.form-group-note {
    margin-bottom: 1rem;
}
.form-label {
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text);
}
.form-control,
.form-select {
    background-color: var(--bg-page);
    color: var(--text);
    border: 1px solid var(--border-color);
}
.form-control:focus,
.form-select:focus {
    border-color: var(--brand-cta);
    box-shadow: 0 0 0 0.25rem rgba(255, 166, 49, 0.28);
    background-color: var(--surface);
    color: var(--text);
}

/* autocomplete dropdown */
.autocomplete-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    max-height: 220px;
    overflow-y: auto;
    background: var(--surface);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    box-shadow: var(--shadow-lg);
    z-index: 1050;
}
.autocomplete-dropdown a {
    display: block;
    padding: 8px 12px;
    font-size: 0.9rem;
    color: var(--text);
    text-decoration: none;
}
.autocomplete-dropdown a:hover {
    background: var(--bg-page);
}

/* ===== PAGINATION (TEMAYA UYUMLU) ===== */
.pagination {
    justify-content: center;
    gap: 8px;
    margin-top: 32px;
}
.page-item .page-link {
    background-color: var(--surface);
    color: var(--muted);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    font-weight: 700;
    padding: 0.6rem 1rem;
    transition: transform 0.2s ease, box-shadow 0.2s ease,
        background-color 0.2s ease;
    box-shadow: var(--card-shadow);
    position: relative;
    text-decoration: none;
}
.page-item:not(:first-child) .page-link,
.page-item:first-child .page-link,
.page-item:last-child .page-link {
    margin-left: 0;
    border-radius: 12px !important;
}
.page-link:hover {
    transform: translateY(-3px);
    box-shadow: var(--card-shadow-hover);
    background-color: var(--bg-page);
    border-color: var(--border-color);
    color: var(--text);
    z-index: 2;
}
.page-item.active .page-link {
    background-color: var(--brand-cta);
    color: #fff;
    border-color: var(--brand-cta);
    box-shadow: 0 8px 16px rgba(255, 166, 49, 0.28);
    transform: translateY(-3px);
    z-index: 3;
}
.page-item.disabled .page-link {
    background-color: transparent;
    border-color: var(--border-color);
    color: var(--muted);
    opacity: 0.6;
    pointer-events: none;
    box-shadow: none;
    transform: none;
}

/* ============================================= */
/*           FOOTER GEÇİŞİ VE FOOTER             */
/* ============================================= */
.footer-arc-bg {
    background: linear-gradient(180deg, var(--bg-page) 0%, var(--f1) 100%);
    height: clamp(80px, 12vw, 150px);
    width: 100%;
    position: relative;
    z-index: 1;
    clip-path: ellipse(100% 100% at 50% 100%);
}
.site-footer {
    background: linear-gradient(180deg, var(--f1) 0%, var(--f2) 100%);
    color: var(--text);
    padding: 26px 0 8px;
    position: relative;
    z-index: 0;
    margin-top: -1px;
}
.sf-wrap {
    max-width: 1140px;
    margin: 0 auto;
    padding: 0 16px;
    display: grid;
    grid-template-columns: 1.2fr 1fr 1fr 1fr;
    gap: 28px;
    width: 100%;
}
.sf-logo {
    height: 46px;
    max-width: 100%;
}
.sf-col h4 {
    margin: 0 0 10px;
    font-weight: 800;
}
.sf-col p {
    font-size: 14px;
    line-height: 1.6;
    opacity: 0.9;
    word-break: break-word;
}
.sf-links a {
    display: block;
    font-size: 14px;
    margin: 6px 0;
    color: var(--text);
    text-decoration: none;
    word-break: break-word;
}
.sf-links a:hover {
    color: #ffa631;
}
.sf-social {
    display: flex;
    gap: 12px;
    margin-top: 10px;
    flex-wrap: wrap;
}
.sf-social img {
    width: 22px;
    height: 22px;
    transition: transform 0.2s;
}
.sf-social img:hover {
    transform: scale(1.08);
}
.sf-bottom {
    max-width: 1140px;
    margin: 14px auto 0;
    padding: 10px 16px 0;
    text-align: center;
    opacity: 0.75;
    border-top: 1px solid rgba(0, 0, 0, 0.08);
    word-break: break-word;
}
body.dark .sf-bottom {
    border-top-color: rgba(255, 255, 255, 0.08);
}

/* ===== RESPONSIVE DÜZENLEMELER ===== */
@media (max-width: 900px) {
    .sf-wrap {
        grid-template-columns: 1fr 1fr;
    }
}
@media (max-width: 768px) {
    .container {
        padding-left: 24px;
        padding-right: 24px;
        margin-left: 5px;
    }
    .page-title {
        font-size: clamp(1.8rem, 7vw, 2.2rem);
        text-align: left;
    }
    .filter-container {
        grid-template-columns: 1fr;
        border-radius: 20px;
        padding: 12px;
    }
    .search-field,
    .filter-field {
        border-radius: 16px;
    }
    .search-field input,
    .filter-field input,
    .filter-field select {
        height: 54px;
        border-radius: 15px;
    }
    .search-icon {
        left: 16px;
    }
    .search-field input {
        padding-left: 52px;
    }
    .filter-field select {
        padding-left: 1rem;
    }
}

@media (max-width: 576px) {
    /* PAGINATION MOBİL UYUM FİX */
    .pagination {
        gap: 4px;
    }
    .page-item .page-link {
        font-size: 0.9rem;
        padding: 0.5rem 0.8rem;
        border-radius: 10px;
    }
    /* "Önceki" ve "Sonraki" butonlarını ikonlara dönüştür */
    .page-item:first-child .page-link,
    .page-item:last-child .page-link {
        font-size: 0; /* Yazıyı gizle */
        width: 40px;
        height: 40px;
        padding: 0;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    .page-item:first-child .page-link::before {
        content: "<";
        font-size: 1rem;
    }
    .page-item:last-child .page-link::after {
        content: ">";
        font-size: 1rem;
    }
}

@media (max-width: 560px) {
    .sf-wrap {
        grid-template-columns: 1fr;
        text-align: center;
    }
    .sf-social {
        justify-content: center;
    }
    .sf-bottom {
        font-size: 13px;
    }
}

@media (max-width: 576px) {
    /* Pagination satırı daha dar, ortada */
    .pagination {
        gap: 6px;
        flex-wrap: nowrap;
        justify-content: center;
    }

    /* Tüm page-link'ler kompakt kare gibi olsun */
    .page-item .page-link {
        font-size: 0.9rem;
        min-width: 40px;
        height: 40px;
        padding: 0;
        line-height: 40px;
        text-align: center;
        border-radius: 10px;
        display: flex;
        align-items: center;
        justify-content: center;

        /* biraz daha yumuşak gölge */
        box-shadow: var(--card-shadow);
    }

    /* Önceki / Sonraki butonlarını simgeleştir (sen zaten başlatmıştın, biraz rafine edelim) */
    .page-item:first-child .page-link,
    .page-item:last-child .page-link {
        font-size: 0; /* metni gizle */
    }
    .page-item:first-child .page-link::before {
        content: "‹";
        font-size: 1rem;
        line-height: 1;
        font-weight: 600;
        color: inherit;
    }
    .page-item:last-child .page-link::after {
        content: "›";
        font-size: 1rem;
        line-height: 1;
        font-weight: 600;
        color: inherit;
    }

    /* 1) Hepsini gizle... */
    .pagination .page-item {
        display: none;
    }

    /* 2) ...ama Prev (ilk), aktif sayfa (.active) ve Next (son) göster */
    .pagination .page-item:first-child,
    .pagination .page-item.active,
    .pagination .page-item:last-child {
        display: flex;
    }

    /* active buton hala vurgulu kalsın */
    .page-item.active .page-link {
        background-color: var(--brand-cta);
        color: #fff;
        border-color: var(--brand-cta);
        box-shadow: 0 8px 16px rgba(255, 166, 49, 0.28);
        transform: translateY(-3px);
        z-index: 3;
    }

    /* disabled olan prev/next (mesela sayfa 1'deyken prev) daha soluk görünsün */
    .page-item.disabled {
        opacity: 0.4;
    }
    .page-item.disabled .page-link {
        box-shadow: none;
        transform: none;
    }
}
