:root {
    --sidebar-width: 260px;
    --sidebar-bg: #111827;
    --sidebar-text: #9ca3af;
    --sidebar-active: #ef4444;
    --app-bg: #f3f4f6;
}

html, body {
    height: 100%;
}

body {
    background: var(--app-bg);
    font-size: 0.95rem;
}

/* ========== Layout ========== */

.app-wrapper {
    display: flex;
    min-height: 100vh;
}

.app-sidebar {
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    overflow-y: auto;
    z-index: 1030;
    transition: transform .2s ease;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: .6rem;
    padding: 1.2rem 1.4rem;
    color: #fff;
    font-weight: 700;
    font-size: 1.15rem;
    text-decoration: none;
    border-bottom: 1px solid rgba(255,255,255,.06);
}

.sidebar-brand i {
    color: var(--sidebar-active);
    font-size: 1.5rem;
}

.sidebar-nav {
    padding: .8rem .7rem;
}

.sidebar-nav .nav-section {
    text-transform: uppercase;
    font-size: .7rem;
    letter-spacing: .08em;
    color: #6b7280;
    padding: 1rem .8rem .4rem;
}

.sidebar-nav .nav-link {
    display: flex;
    align-items: center;
    gap: .7rem;
    color: var(--sidebar-text);
    padding: .55rem .8rem;
    border-radius: .5rem;
    margin-bottom: 2px;
}

.sidebar-nav .nav-link:hover {
    background: rgba(255,255,255,.06);
    color: #fff;
}

.sidebar-nav .nav-link.active {
    background: rgba(239,68,68,.15);
    color: #fff;
}

.sidebar-nav .nav-link.active i {
    color: var(--sidebar-active);
}

.sidebar-nav .nav-link.disabled {
    opacity: .45;
}

.app-main {
    flex: 1;
    margin-left: var(--sidebar-width);
    min-width: 0;
}

.app-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    background: #fff;
    padding: .8rem 1.5rem;
    border-bottom: 1px solid #e5e7eb;
    position: sticky;
    top: 0;
    z-index: 1020;
}

.app-content {
    padding: 1.5rem;
}

@media (max-width: 991.98px) {
    .app-sidebar {
        transform: translateX(-100%);
    }

    .app-sidebar.show {
        transform: translateX(0);
    }

    .app-main {
        margin-left: 0;
    }

    .app-content {
        padding: 1rem;
    }
}

/* ========== Kartlar ========== */

.card {
    border: 0;
    border-radius: .8rem;
    box-shadow: 0 1px 3px rgba(0,0,0,.06);
}

.card-header {
    background: transparent;
    border-bottom: 1px solid #f0f0f0;
    font-weight: 600;
}

.stat-card .stat-icon {
    width: 48px;
    height: 48px;
    border-radius: .7rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
}

.stat-card .stat-value {
    font-size: 1.7rem;
    font-weight: 700;
    line-height: 1;
}

.stat-card a {
    color: inherit;
    text-decoration: none;
}

.category-card {
    transition: transform .15s ease, box-shadow .15s ease;
    height: 100%;
}

.category-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(0,0,0,.08);
}

.category-card .category-icon {
    width: 46px;
    height: 46px;
    border-radius: .7rem;
    background: rgba(239,68,68,.1);
    color: #ef4444;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
}

.category-card.inactive {
    opacity: .55;
}

/* ========== Video ========== */

.video-thumb {
    width: 96px;
    height: 54px;
    object-fit: cover;
    border-radius: .35rem;
    background: #e5e7eb;
}

.video-thumb.vertical {
    width: 40px;
    height: 70px;
}

.video-player-wrapper {
    background: #000;
    border-radius: .7rem;
    overflow: hidden;
    display: flex;
    justify-content: center;
}

.video-player-wrapper video {
    width: 100%;
    max-height: 72vh;
}

.video-player-wrapper.vertical video {
    max-width: 380px;
}

.video-placeholder {
    aspect-ratio: 16/9;
    background: linear-gradient(135deg, #1f2937, #111827);
    color: #9ca3af;
    border-radius: .7rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: .6rem;
    text-align: center;
    padding: 1rem;
}

.video-placeholder.vertical {
    aspect-ratio: 9/16;
    max-width: 340px;
    margin: 0 auto;
}

.scene-item {
    border: 1px solid #eef0f3;
    border-radius: .6rem;
    padding: .9rem;
    margin-bottom: .8rem;
    background: #fff;
}

.scene-item .scene-no {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: #111827;
    color: #fff;
    font-weight: 700;
    font-size: .8rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.scene-media {
    width: 100%;
    max-height: 150px;
    object-fit: cover;
    border-radius: .4rem;
    background: #e5e7eb;
}

.scene-media-empty {
    height: 110px;
    border-radius: .4rem;
    background: #f3f4f6;
    color: #9ca3af;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .8rem;
    text-align: center;
}

.comment-item {
    border-left: 3px solid #e5e7eb;
    padding: .3rem 0 .3rem .8rem;
    margin-bottom: .8rem;
}

.comment-item.type-2 {
    border-left-color: #f59e0b;
}

.comment-item.type-3 {
    border-left-color: #ef4444;
}

.action-bar {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
}

.log-list {
    max-height: 420px;
    overflow-y: auto;
    font-size: .85rem;
}

.mode-option {
    cursor: pointer;
    border: 2px solid #e5e7eb;
    border-radius: .7rem;
    padding: 1rem;
    height: 100%;
    transition: border-color .15s ease;
}

.mode-option:hover {
    border-color: #fca5a5;
}

.mode-option.selected {
    border-color: #ef4444;
    background: rgba(239,68,68,.04);
}

/* ========== Auth ========== */

.auth-body {
    background: linear-gradient(135deg, #111827 0%, #7f1d1d 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.auth-card {
    width: 100%;
    max-width: 430px;
    border-radius: 1rem;
}

.auth-logo {
    width: 64px;
    height: 64px;
    border-radius: 1rem;
    margin: 0 auto;
    background: #ef4444;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
}

/* ========== DataTables ========== */

table.dataTable tbody td {
    vertical-align: middle;
}

table.dataTable tbody tr {
    cursor: pointer;
}

/* ========== Mobil ========== */

/* Tablolar sayfayi yana kaydirmaz; genis tablo kendi kutusu icinde kaydirilir */
.dt-container .dt-layout-table > div,
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* Son guvenlik: bir sey yine tasarsa sayfa yana kaymaz (clip, acilir menuleri kirpmaz) */
.app-main {
    overflow-x: clip;
}

.video-topic {
    max-width: 420px;
}

.col-thumb {
    width: 110px;
}

/* Menu acikken arkadaki karartma (dokununca menu kapanir) */
.sidebar-backdrop {
    display: none;
}

@media (max-width: 991.98px) {
    .sidebar-backdrop.show {
        display: block;
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,.45);
        z-index: 1025;
    }
}

@media (max-width: 767.98px) {
    .app-header {
        padding: .6rem .75rem;
        gap: .5rem;
    }

    .app-header .page-title {
        font-size: 1rem;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        min-width: 0;
    }

    .app-content {
        padding: .75rem;
    }

    .card-body {
        padding: .85rem;
    }

    .card-header.d-flex {
        flex-wrap: wrap;
        gap: .5rem;
    }

    /* Sekmeler tasmasin, yana kaydirilsin */
    .nav-tabs {
        flex-wrap: nowrap;
        overflow-x: auto;
        overflow-y: hidden;
        -webkit-overflow-scrolling: touch;
    }

    .nav-tabs .nav-link {
        white-space: nowrap;
    }

    /* Aksiyon butonlari tam satir, parmakla rahat basilsin */
    .action-bar {
        width: 100%;
    }

    .action-bar .btn {
        flex: 1 1 auto;
    }

    .video-topic {
        max-width: 45vw;
    }

    .col-thumb {
        width: 56px;
    }

    .video-thumb {
        width: 56px;
        height: 32px;
    }

    .video-thumb.vertical {
        width: 34px;
        height: 60px;
    }

    table.dataTable > thead > tr > th,
    table.dataTable > tbody > tr > td {
        padding-left: .35rem;
        padding-right: .35rem;
    }

    .video-player-wrapper.vertical video {
        max-width: 100%;
        max-height: 70vh;
    }

    /* DataTables kontrolleri alt alta, ortali */
    .dt-container > .row:not(.dt-layout-table) > div {
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
        gap: .5rem;
    }

    .dt-container .dt-paging .pagination {
        flex-wrap: wrap;
        justify-content: center;
    }

    .dt-container .dt-info {
        font-size: .8rem;
    }

    .stat-card .stat-value {
        font-size: 1.4rem;
    }
}

@media (max-width: 575.98px) {
    /* iPhone'da yazi kutusuna dokununca sayfanin yakinlasmasi engellenir */
    .form-control,
    .form-select {
        font-size: 16px;
    }

    .swal2-popup {
        font-size: .9rem;
    }
}
