/* =========================
   ROOT PAGE
========================= */

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

html,
body {
    width: 100%;
    min-height: 100%;
}

body.root-page {
    min-height: 100vh;
    background: #f4f6fa;
    color: #1f2937;
    font-family: Arial, Helvetica, sans-serif;
}

/* =========================
   ROOT V2 — OWNER İSKELETİ
========================= */

.root-admin-page .sidebar-brand-icon {
    background: linear-gradient(135deg, #ff9d16, #ff7a00);
    box-shadow: 0 10px 24px rgba(255, 133, 0, .28);
}

.root-admin-page .sidebar-link.active {
    background: linear-gradient(135deg, #3478f6, #5368ed);
}

.root-admin-page .sidebar-link.active::before {
    background: #ffad22;
}

.root-admin-page .topbar-right {
    gap: 10px;
}

.root-admin-page .dashboard-stats {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.root-date-status > span {
    font-size: 19px;
}

.root-summary-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
    margin-bottom: 20px;
}

.root-summary-card {
    min-height: 110px;
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 20px;
    border: 1px solid #dce5f1;
    border-top: 4px solid #6d91bf;
    border-radius: 18px;
    background: #fff;
    box-shadow: 0 10px 28px rgba(38, 54, 77, .05);
}

.root-summary-card.green { border-top-color: #62aa75; }
.root-summary-card.orange { border-top-color: #e5a047; }
.root-summary-card.purple { border-top-color: #9175ba; }

.root-summary-card > span {
    width: 52px;
    height: 52px;
    display: grid;
    place-items: center;
    flex: 0 0 52px;
    border-radius: 15px;
    background: #f0f4fa;
    font-size: 24px;
}

.root-summary-card div { display: flex; flex-direction: column; gap: 5px; }
.root-summary-card small { color: #718096; font-size: 12px; font-weight: 800; }
.root-summary-card strong { color: #152033; font-size: 27px; line-height: 1; }

.root-table-title {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.root-table-title strong { color: #273449; }
.root-table-title small,
.root-table-note { display: block; margin-top: 4px; color: #8a96a8; font-size: 11px; }

.root-filter-select {
    min-height: 46px;
    min-width: 190px;
    padding: 0 14px;
    border: 1px solid #dce2eb;
    border-radius: 12px;
    background: #fff;
    color: #48566a;
    font-weight: 700;
}

.root-dealer-table .table-actions-column {
    min-width: 190px;
}

@media (max-width: 1100px) {
    .root-summary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .root-admin-page .dashboard-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 700px) {
    .root-summary-grid { grid-template-columns: 1fr; }
    .root-admin-page .dashboard-stats { grid-template-columns: 1fr; }
    .root-filter-select { width: 100%; }
    .root-date-status { display: none; }
}


/* =========================
   APP LAYOUT
========================= */

.app-layout {
    width: 100%;
    min-height: 100vh;

    display: flex;
}


/* =========================
   SIDEBAR
========================= */

.sidebar {
    width: 270px;
    min-width: 270px;
    height: 100vh;

    position: fixed;
    top: 0;
    left: 0;

    display: flex;
    flex-direction: column;

    padding: 24px 16px;

    background: #18202d;
    color: #ffffff;

    z-index: 100;
}

.sidebar-brand {
    min-height: 78px;

    display: flex;
    align-items: center;
    gap: 12px;

    padding: 0 12px 22px;

    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-brand-icon {
    width: 42px;
    height: 42px;

    display: flex;
    align-items: center;
    justify-content: center;

    border-radius: 12px;

    background: #f59e0b;
    color: #ffffff;

    font-size: 20px;
}

.sidebar-brand-text {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.sidebar-brand-text strong {
    font-size: 19px;
}

.sidebar-brand-text small {
    color: #9ca3af;
    font-size: 11px;
    letter-spacing: 1px;
}

.sidebar-nav {
    flex: 1;

    display: flex;
    flex-direction: column;
    gap: 7px;

    padding-top: 24px;
}

.nav-item {
    width: 100%;
    min-height: 48px;

    display: flex;
    align-items: center;
    gap: 13px;

    padding: 0 14px;

    border-radius: 10px;

    color: #cbd5e1;
    text-decoration: none;

    font-size: 15px;
    font-weight: 600;

    transition: 0.2s ease;
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.07);
    color: #ffffff;
}

.nav-item.active {
    background: #2563eb;
    color: #ffffff;
}

.nav-icon {
    width: 25px;

    display: flex;
    justify-content: center;

    font-size: 18px;
}

.sidebar-footer {
    padding-top: 15px;

    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.nav-item.logout {
    color: #fca5a5;
}

.nav-item.logout:hover {
    background: rgba(239, 68, 68, 0.12);
    color: #ffffff;
}


/* =========================
   MAIN AREA
========================= */

.main-area {
    width: calc(100% - 270px);
    min-height: 100vh;

    margin-left: 270px;
}


/* =========================
   TOPBAR
========================= */

.panel-topbar {
    min-height: 92px;

    display: flex;
    align-items: center;
    justify-content: space-between;

    padding: 20px 30px;

    background: #ffffff;
    border-bottom: 1px solid #e5e7eb;

    position: sticky;
    top: 0;

    z-index: 50;
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.topbar-left h1 {
    margin-bottom: 5px;

    color: #111827;

    font-size: 25px;
}

.topbar-left p {
    color: #6b7280;
    font-size: 14px;
}

.sidebar-toggle {
    display: none;

    width: 42px;
    height: 42px;

    border: 1px solid #e5e7eb;
    border-radius: 10px;

    background: #ffffff;

    font-size: 20px;
    cursor: pointer;
}

.topbar-right {
    display: flex;
    align-items: center;
}

.system-status {
    display: flex;
    align-items: center;
    gap: 10px;

    padding: 10px 14px;

    border: 1px solid #e5e7eb;
    border-radius: 12px;

    background: #f9fafb;
}

.system-status div {
    display: flex;
    flex-direction: column;
}

.system-status small {
    color: #6b7280;
    font-size: 11px;
}

.system-status strong {
    color: #16a34a;
    font-size: 14px;
}

.status-dot {
    width: 10px;
    height: 10px;

    border-radius: 50%;

    background: #22c55e;

    box-shadow: 0 0 0 4px rgba(34, 197, 94, 0.15);
}


/* =========================
   PAGE CONTENT
========================= */

.page-content {
    min-height: calc(100vh - 92px);

    padding: 30px;
}

.empty-page {
    min-height: 380px;

    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;

    padding: 40px;

    border: 1px solid #e5e7eb;
    border-radius: 18px;

    background: #ffffff;

    text-align: center;

    box-shadow: 0 8px 30px rgba(15, 23, 42, 0.05);
}

.empty-page-icon {
    width: 72px;
    height: 72px;

    display: flex;
    align-items: center;
    justify-content: center;

    margin-bottom: 18px;

    border-radius: 20px;

    background: #eff6ff;

    font-size: 34px;
}

.empty-page h2 {
    margin-bottom: 8px;

    color: #111827;

    font-size: 25px;
}

.empty-page p {
    color: #6b7280;
    font-size: 15px;
}


/* =========================
   RESPONSIVE
========================= */

@media (max-width: 900px) {

    .sidebar {
        transform: translateX(-100%);
    }

    .main-area {
        width: 100%;
        margin-left: 0;
    }

    .sidebar-toggle {
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .panel-topbar {
        padding: 16px 20px;
    }

    .page-content {
        padding: 20px;
    }

}

/* =========================================================
   ADMIN PANEL - SIDEBAR VE TOPBAR
========================================================= */


/* =========================
   SAYFA TEMELİ
========================= */

.admin-page{
    min-height:100vh;
    background:#f5f7fb;
    color:#172033;
}

.admin-page .app-layout{
    display:flex;
    min-height:100vh;
}

.admin-page .main-area{
    flex:1;
    min-width:0;
    margin-left:280px;
    transition:margin-left .25s ease;
}

.admin-page .page-content{
    padding:28px;
}


/* =========================
   SIDEBAR
========================= */

.admin-page .sidebar{
    position:fixed;
    top:0;
    left:0;
    bottom:0;

    z-index:1000;

    width:280px;
    height:100vh;

    display:flex;
    flex-direction:column;

    background:
        linear-gradient(
            180deg,
            #172033 0%,
            #111827 55%,
            #0d1424 100%
        );

    color:#fff;

    border-right:1px solid rgba(255,255,255,.06);

    box-shadow:
        12px 0 35px rgba(15,23,42,.12);

    overflow:hidden;
}


/* =========================
   LOGO ALANI
========================= */

.admin-page .sidebar-brand{
    flex:0 0 auto;
    padding:24px 22px 20px;

    border-bottom:
        1px solid rgba(255,255,255,.08);
}

.admin-page .sidebar-brand-link{
    display:flex;
    align-items:center;
    gap:13px;

    color:#fff;
    text-decoration:none;
}

.admin-page .sidebar-brand-icon{
    width:48px;
    height:48px;

    display:flex;
    align-items:center;
    justify-content:center;

    flex:0 0 48px;

    border-radius:15px;

    background:
        linear-gradient(
            135deg,
            #ffb020,
            #ff8a00
        );

    box-shadow:
        0 10px 25px rgba(255,138,0,.28);

    font-size:23px;
}

.admin-page .sidebar-brand-text{
    min-width:0;

    display:flex;
    flex-direction:column;
    gap:3px;
}

.admin-page .sidebar-brand-text strong{
    color:#fff;

    font-size:19px;
    line-height:1.1;
    font-weight:800;
}

.admin-page .sidebar-brand-text span{
    color:#94a3b8;

    font-size:10px;
    font-weight:700;

    letter-spacing:1.5px;
    text-transform:uppercase;
}


/* =========================
   MENÜ KAYDIRMA ALANI
========================= */

.admin-page .sidebar-nav{
    flex:1;
    min-height:0;

    overflow-y:auto;
    overflow-x:hidden;

    padding:18px 14px 24px;

    scrollbar-width:thin;
    scrollbar-color:
        rgba(255,255,255,.20)
        transparent;
}

.admin-page .sidebar-nav::-webkit-scrollbar{
    width:6px;
}

.admin-page .sidebar-nav::-webkit-scrollbar-track{
    background:transparent;
}

.admin-page .sidebar-nav::-webkit-scrollbar-thumb{
    border-radius:20px;
    background:rgba(255,255,255,.18);
}

.admin-page .sidebar-nav::-webkit-scrollbar-thumb:hover{
    background:rgba(255,255,255,.28);
}


/* =========================
   MENÜ BÖLÜMLERİ
========================= */

.admin-page .sidebar-section{
    margin-bottom:22px;
}

.admin-page .sidebar-section:last-child{
    margin-bottom:0;
}

.admin-page .sidebar-section-title{
    display:block;

    margin:0 12px 9px;

    color:#7f8ca3;

    font-size:10px;
    line-height:1;
    font-weight:800;

    letter-spacing:1.3px;
    text-transform:uppercase;
}


/* =========================
   MENÜ BAĞLANTILARI
========================= */

.admin-page .sidebar-link{
    position:relative;

    display:flex;
    align-items:center;
    gap:13px;

    min-height:47px;

    margin-bottom:5px;
    padding:0 14px;

    border:1px solid transparent;
    border-radius:14px;

    color:#c8d1df;

    font-size:14px;
    font-weight:650;

    text-decoration:none;

    transition:
        background .2s ease,
        color .2s ease,
        border-color .2s ease,
        transform .2s ease,
        box-shadow .2s ease;
}

.admin-page .sidebar-link:hover{
    color:#fff;

    background:
        rgba(255,255,255,.07);

    border-color:
        rgba(255,255,255,.06);

    transform:translateX(2px);
}

.admin-page .sidebar-link.active{
    color:#fff;

    background:
        linear-gradient(
            135deg,
            #3578f6,
            #4f67ef
        );

    border-color:
        rgba(255,255,255,.10);

    box-shadow:
        0 10px 24px rgba(37,99,235,.28);
}

.admin-page .sidebar-link.active::before{
    content:"";

    position:absolute;

    left:-14px;
    top:11px;
    bottom:11px;

    width:4px;

    border-radius:0 8px 8px 0;

    background:#ffb020;
}

.admin-page .sidebar-link-icon{
    width:24px;
    height:24px;

    display:flex;
    align-items:center;
    justify-content:center;

    flex:0 0 24px;

    font-size:17px;
}

.admin-page .sidebar-link > span:last-child{
    overflow:hidden;
    text-overflow:ellipsis;
    white-space:nowrap;
}


/* =========================
   SIDEBAR ALT KISIM
========================= */

.admin-page .sidebar-footer{
    flex:0 0 auto;

    padding:15px 16px 18px;

    border-top:
        1px solid rgba(255,255,255,.08);

    background:
        rgba(4,10,22,.28);
}

.admin-page .sidebar-user{
    display:flex;
    align-items:center;
    gap:11px;

    margin-bottom:12px;
    padding:11px;

    border:1px solid rgba(255,255,255,.07);
    border-radius:14px;

    background:
        rgba(255,255,255,.04);
}

.admin-page .sidebar-user-avatar{
    width:40px;
    height:40px;

    display:flex;
    align-items:center;
    justify-content:center;

    flex:0 0 40px;

    border-radius:13px;

    color:#fff;

    background:
        linear-gradient(
            135deg,
            #ffb020,
            #ff8a00
        );

    font-size:15px;
    font-weight:800;
}

.admin-page .sidebar-user-info{
    min-width:0;

    display:flex;
    flex-direction:column;
    gap:3px;
}

.admin-page .sidebar-user-info strong{
    overflow:hidden;
    text-overflow:ellipsis;
    white-space:nowrap;

    color:#fff;

    font-size:13px;
    font-weight:750;
}

.admin-page .sidebar-user-info span{
    overflow:hidden;
    text-overflow:ellipsis;
    white-space:nowrap;

    color:#94a3b8;

    font-size:11px;
}

.admin-page .sidebar-logout{
    display:flex;
    align-items:center;
    justify-content:center;
    gap:9px;

    min-height:43px;

    border:1px solid rgba(248,113,113,.18);
    border-radius:13px;

    color:#fecaca;

    background:
        rgba(239,68,68,.08);

    font-size:13px;
    font-weight:750;

    text-decoration:none;

    transition:
        background .2s ease,
        color .2s ease,
        border-color .2s ease;
}

.admin-page .sidebar-logout:hover{
    color:#fff;

    background:
        rgba(239,68,68,.18);

    border-color:
        rgba(248,113,113,.34);
}


/* =========================
   TOPBAR
========================= */

.admin-page .panel-topbar{
    position:sticky;
    top:0;
    z-index:900;

    min-height:88px;

    display:flex;
    align-items:center;
    justify-content:space-between;
    gap:24px;

    padding:16px 28px;

    border-bottom:
        1px solid rgba(15,23,42,.07);

    background:
        rgba(255,255,255,.94);

    backdrop-filter:blur(14px);

    box-shadow:
        0 8px 25px rgba(15,23,42,.04);
}

.admin-page .topbar-left{
    min-width:0;

    display:flex;
    align-items:center;
    gap:15px;
}

.admin-page .topbar-left > div{
    min-width:0;
}

.admin-page .topbar-left h1{
    margin:0 0 5px;

    color:#172033;

    font-size:24px;
    line-height:1.15;
    font-weight:800;

    letter-spacing:-.4px;
}

.admin-page .topbar-left p{
    margin:0;

    color:#7b879b;

    font-size:13px;
    line-height:1.45;
}

.admin-page .sidebar-toggle{
    display:none;

    width:42px;
    height:42px;

    align-items:center;
    justify-content:center;

    flex:0 0 42px;

    border:1px solid rgba(15,23,42,.09);
    border-radius:12px;

    color:#334155;
    background:#fff;

    cursor:pointer;

    font-size:20px;
}

.admin-page .topbar-right{
    display:flex;
    align-items:center;
    gap:12px;
}

.admin-page .system-status{
    min-width:165px;
    min-height:56px;

    display:flex;
    align-items:center;
    gap:11px;

    padding:10px 14px;

    border:1px solid rgba(15,23,42,.07);
    border-radius:15px;

    background:#fff;

    box-shadow:
        0 6px 18px rgba(15,23,42,.04);
}

.admin-page .system-status .status-dot{
    width:10px;
    height:10px;

    flex:0 0 10px;

    border-radius:50%;

    background:#22c55e;

    box-shadow:
        0 0 0 5px rgba(34,197,94,.10);
}

.admin-page .system-status > div{
    min-width:0;

    display:flex;
    flex-direction:column;
    gap:3px;
}

.admin-page .system-status small{
    color:#94a3b8;

    font-size:10px;
    font-weight:700;

    letter-spacing:.4px;
    text-transform:uppercase;
}

.admin-page .system-status strong{
    overflow:hidden;
    text-overflow:ellipsis;
    white-space:nowrap;

    color:#253047;

    font-size:13px;
    font-weight:800;
}

.topbar-canteen-change{
    display:inline-flex;
    align-items:center;
    justify-content:center;

    min-height:42px;
    padding:0 16px;

    border:1px solid rgba(37,99,235,.16);
    border-radius:12px;

    color:#2563eb;
    background:#eff6ff;

    text-decoration:none;
    font-size:12px;
    font-weight:800;

    white-space:nowrap;

    transition:
        background .2s ease,
        border-color .2s ease,
        transform .2s ease;
}

.topbar-canteen-change:hover{
    background:#dbeafe;
    border-color:rgba(37,99,235,.28);
    transform:translateY(-1px);
}

.active-canteen-status .status-dot{
    background:#22c55e;
    box-shadow:
        0 0 0 4px rgba(34,197,94,.12);
}

@media(max-width:900px){

    .topbar-canteen-change{
        padding:0 12px;
        font-size:11px;
    }

}

/* =========================
   TABLET
========================= */

@media (max-width:1100px){

    .admin-page .sidebar{
        width:250px;
    }

    .admin-page .main-area{
        margin-left:250px;
    }

    .admin-page .system-status{
        min-width:145px;
    }

}


/* =========================
   MOBİL SIDEBAR
========================= */

@media (max-width:850px){

    .admin-page .sidebar{
        width:280px;

        transform:translateX(-100%);

        transition:transform .25s ease;
    }

    .admin-page.sidebar-open .sidebar{
        transform:translateX(0);
    }

    .admin-page .main-area{
        margin-left:0;
    }

    .admin-page .sidebar-toggle{
        display:flex;
    }

    .admin-page .panel-topbar{
        padding:14px 18px;
    }

    .admin-page .page-content{
        padding:20px 16px;
    }

    .admin-page .topbar-right{
        display:none;
    }

    .admin-page .topbar-left h1{
        font-size:21px;
    }

}


/* =========================
   KÜÇÜK EKRAN
========================= */

@media (max-width:520px){

    .admin-page .panel-topbar{
        min-height:78px;
    }

    .admin-page .topbar-left p{
        display:none;
    }

    .admin-page .topbar-left h1{
        margin:0;
        font-size:19px;
    }

}


/* =========================================================
   OWNER + ADMIN SIDEBAR SCROLL KESİN DÜZELTME
========================================================= */

.owner-page .sidebar,
.admin-page .sidebar{
    position:fixed;
    top:0;
    left:0;
    bottom:0;

    width:280px;
    height:100vh;

    display:flex;
    flex-direction:column;

    overflow:hidden !important;
}


/* Logo üstte sabit */
.owner-page .sidebar-brand,
.admin-page .sidebar-brand{
    flex:0 0 auto;
}


/* Asıl menü burada kayacak */
.owner-page .sidebar-nav,
.admin-page .sidebar-nav{
    flex:1 1 auto;
    min-height:0;

    overflow-y:auto !important;
    overflow-x:hidden !important;

    padding-bottom:30px;
    overscroll-behavior:contain;
}


/* Alt kullanıcı ve çıkış alanı sabit */
.owner-page .sidebar-footer,
.admin-page .sidebar-footer{
    flex:0 0 auto;

    position:relative;
    z-index:5;

    background:#111827;
}


/* İnce scrollbar */
.owner-page .sidebar-nav::-webkit-scrollbar,
.admin-page .sidebar-nav::-webkit-scrollbar{
    width:7px;
}

.owner-page .sidebar-nav::-webkit-scrollbar-thumb,
.admin-page .sidebar-nav::-webkit-scrollbar-thumb{
    border-radius:20px;
    background:rgba(255,255,255,.24);
}

.owner-page .sidebar-nav::-webkit-scrollbar-track,
.admin-page .sidebar-nav::-webkit-scrollbar-track{
    background:transparent;
}


/* Firefox */
.owner-page .sidebar-nav,
.admin-page .sidebar-nav{
    scrollbar-width:thin;
    scrollbar-color:rgba(255,255,255,.24) transparent;
}
