:root {
    --bg: #f6f7f9;
    --surface: #ffffff;
    --surface-soft: #f9fafb;

    --sidebar: #111318;
    --sidebar-soft: #1a1d24;
    --sidebar-text: #aeb4c0;
    --sidebar-active: #ffffff;

    --text: #17191d;
    --text-soft: #68707d;
    --text-muted: #98a0ad;

    --border: #e7e9ed;
    --border-dark: #30343c;

    --primary: #17191d;
    --primary-hover: #2a2d33;

    --success: #198754;
    --success-bg: #edf8f1;

    --danger: #c43d3d;
    --danger-bg: #fff0f0;

    --warning: #a66a00;
    --warning-bg: #fff8e8;

    --radius: 14px;
    --radius-lg: 20px;

    --shadow: 0 8px 30px rgba(20, 24, 32, .045);
    --shadow-lg: 0 18px 50px rgba(20, 24, 32, .09);
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family:
        Inter,
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        Arial,
        sans-serif;
    -webkit-font-smoothing: antialiased;
}

a {
    color: inherit;
}

button,
input,
select,
textarea {
    font: inherit;
}

/* =========================================================
   APP
========================================================= */

.app-shell {
    min-height: 100vh;
}

/* =========================================================
   SIDEBAR
========================================================= */

.sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 100;

    width: 264px;

    display: flex;
    flex-direction: column;

    padding: 22px 14px;

    background: linear-gradient(
        180deg,
        #111318 0%,
        #0d0f13 100%
    );

    color: #fff;
    border-right: 1px solid #252830;

    transition: transform .25s ease;
}

.brand {
    display: flex;
    align-items: center;

    min-height: 48px;
    padding: 5px 13px 28px;

    color: #fff;

    font-size: 21px;
    font-weight: 800;
    letter-spacing: -.4px;
}

.brand span {
    color: #d4b77b;
}

.sidebar nav {
    display: grid;
    gap: 4px;
}

.sidebar a {
    position: relative;

    display: flex;
    align-items: center;
    gap: 12px;

    min-height: 45px;
    padding: 11px 13px;

    border-radius: 11px;

    color: var(--sidebar-text);
    text-decoration: none;

    font-size: 13px;
    font-weight: 600;

    transition:
        background .2s ease,
        color .2s ease,
        transform .2s ease;
}

.sidebar a:hover {
    background: var(--sidebar-soft);
    color: #fff;
    transform: translateX(2px);
}

.sidebar a.active {
    background: #fff;
    color: #16181c;
}

.sidebar a.active::before {
    content: "";

    position: absolute;
    left: -14px;
    top: 10px;
    bottom: 10px;

    width: 3px;

    border-radius: 0 4px 4px 0;
    background: #d4b77b;
}

.sidebar-bottom {
    display: grid;
    gap: 4px;

    margin-top: auto;
    padding-top: 18px;

    border-top: 1px solid #252830;
}

/* =========================================================
   MAIN
========================================================= */

.main-content {
    width: calc(100% - 264px);
    min-height: 100vh;
    margin-left: 264px;
}

/* =========================================================
   TOPBAR
========================================================= */

.topbar {
    position: sticky;
    top: 0;
    z-index: 50;

    min-height: 76px;

    display: flex;
    align-items: center;
    gap: 16px;

    padding: 0 32px;

    background: rgba(255,255,255,.92);
    backdrop-filter: blur(18px);

    border-bottom: 1px solid var(--border);
}

.topbar strong {
    display: block;

    color: var(--text);

    font-size: 18px;
    letter-spacing: -.3px;
}

.topbar small {
    display: block;

    margin-top: 4px;

    color: var(--text-muted);
    font-size: 12px;
}

.menu-toggle {
    display: none;

    width: 40px;
    height: 40px;

    border: 1px solid var(--border);
    border-radius: 10px;

    background: #fff;
    color: var(--text);

    cursor: pointer;
    font-size: 20px;
}

/* =========================================================
   CONTENT
========================================================= */

.content {
    width: 100%;
    max-width: 1500px;

    padding: 30px 32px 60px;
}

/* =========================================================
   STATS
========================================================= */

.stats-grid {
    display: grid;

    grid-template-columns:
        repeat(4, minmax(0, 1fr));

    gap: 16px;
    margin-bottom: 22px;
}

.stat-card {
    position: relative;
    overflow: hidden;

    padding: 21px;

    border: 1px solid var(--border);
    border-radius: var(--radius);

    background: var(--surface);
    box-shadow: var(--shadow);
}

.stat-card::after {
    content: "";

    position: absolute;

    right: -30px;
    top: -30px;

    width: 90px;
    height: 90px;

    border-radius: 50%;
    background: #f5f5f6;
}

.stat-card span {
    position: relative;
    z-index: 1;

    display: block;

    color: var(--text-soft);

    font-size: 12px;
    font-weight: 600;

    text-transform: uppercase;
    letter-spacing: .5px;
}

.stat-card strong {
    position: relative;
    z-index: 1;

    display: block;

    margin: 9px 0 6px;

    color: var(--text);

    font-size: 31px;
    line-height: 1;
    letter-spacing: -1px;
}

.stat-card small {
    position: relative;
    z-index: 1;

    color: var(--text-muted);
    font-size: 12px;
}

/* =========================================================
   PANELS
========================================================= */

.panel {
    margin-bottom: 22px;
    padding: 23px;

    border: 1px solid var(--border);
    border-radius: var(--radius-lg);

    background: var(--surface);
    box-shadow: var(--shadow);
}

.panel h2 {
    margin: 0 0 6px;

    color: var(--text);

    font-size: 18px;
    letter-spacing: -.3px;
}

.panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;

    margin-bottom: 21px;
}

.panel-head p,
.panel p {
    margin: 4px 0 0;

    color: var(--text-muted);
    font-size: 13px;
}

.muted {
    color: var(--text-soft);
}

/* =========================================================
   QUICK CARDS
========================================================= */

.quick-grid {
    display: grid;

    grid-template-columns:
        repeat(4, minmax(0, 1fr));

    gap: 14px;
}

.quick-card {
    display: grid;
    gap: 6px;

    min-height: 110px;
    padding: 18px;

    border: 1px solid var(--border);
    border-radius: 14px;

    background: var(--surface);
    color: var(--text);

    text-decoration: none;

    transition:
        transform .2s ease,
        border-color .2s ease,
        box-shadow .2s ease;
}

.quick-card:hover {
    transform: translateY(-2px);

    border-color: #cfd3d9;
    box-shadow: var(--shadow);
}

.quick-card:first-letter {
    font-size: 21px;
}

.quick-card span {
    color: var(--text-soft);
    font-size: 12px;
}

/* =========================================================
   ALERT
========================================================= */

.alert {
    margin-bottom: 18px;

    padding: 13px 15px;

    border-radius: 11px;

    font-size: 13px;
    font-weight: 600;
}

.success {
    background: var(--success-bg);
    color: var(--success);
}

.error {
    background: var(--danger-bg);
    color: var(--danger);
}

/* =========================================================
   FORMS
========================================================= */

.inline-form {
    display: flex;
    gap: 10px;
}

.form-grid {
    display: grid;

    grid-template-columns:
        repeat(2, minmax(0, 1fr));

    gap: 18px;
}

.form-grid .wide {
    grid-column: 1 / -1;
}

label {
    display: block;

    margin-bottom: 7px;

    color: #363c46;

    font-size: 12px;
    font-weight: 700;
}

input,
select,
textarea {
    width: 100%;

    border: 1px solid #dfe2e7;
    border-radius: 11px;

    padding: 12px 13px;

    outline: none;

    background: #fff;
    color: var(--text);

    transition:
        border-color .2s ease,
        box-shadow .2s ease;
}

input::placeholder,
textarea::placeholder {
    color: #b1b6bf;
}

input:hover,
select:hover,
textarea:hover {
    border-color: #cbd0d7;
}

input:focus,
select:focus,
textarea:focus {
    border-color: #25282e;

    box-shadow:
        0 0 0 3px rgba(23,25,29,.07);
}

textarea {
    resize: vertical;
    min-height: 110px;
}

.form-help {
    display: block;

    margin-top: 6px;

    color: var(--text-muted);
    font-size: 11px;
}

.form-actions {
    display: flex;
    align-items: center;
    gap: 9px;
}

/* =========================================================
   BUTTONS
========================================================= */

.btn {
    display: inline-flex;

    align-items: center;
    justify-content: center;

    min-height: 41px;

    border: 1px solid transparent;
    border-radius: 10px;

    padding: 10px 16px;

    background: #fff;
    color: #333840;

    text-decoration: none;

    font-size: 12px;
    font-weight: 700;

    cursor: pointer;

    transition:
        background .2s ease,
        border-color .2s ease,
        color .2s ease,
        transform .2s ease;
}

.btn:hover {
    transform: translateY(-1px);

    border-color: #d2d5da;
    background: #f8f9fa;
}

.btn.primary {
    background: var(--primary);
    color: #fff;
}

.btn.primary:hover {
    background: var(--primary-hover);
}

.btn.full {
    width: 100%;
    margin-top: 18px;
}

.btn.small {
    min-height: 32px;

    padding: 6px 10px;

    font-size: 11px;
    white-space: nowrap;
}

.btn.danger {
    border-color: #ffd5d5;

    background: var(--danger-bg);
    color: var(--danger);
}

.btn.danger:hover {
    border-color: #ffc1c1;
    background: #ffe6e6;
}

/* =========================================================
   TABLE
========================================================= */

.table-wrap {
    width: 100%;
    overflow-x: auto;

    border: 1px solid var(--border);
    border-radius: 13px;
}

table {
    width: 100%;

    border-collapse: collapse;
    background: #fff;
}

th,
td {
    padding: 13px 14px;

    border-bottom: 1px solid #eef0f3;

    text-align: left;
    vertical-align: middle;

    font-size: 13px;
}

th {
    background: #fafbfc;

    color: #7a828e;

    font-size: 10px;
    font-weight: 800;

    letter-spacing: .8px;
    text-transform: uppercase;
}

tbody tr {
    transition: background .15s ease;
}

tbody tr:hover {
    background: #fafbfc;
}

tbody tr:last-child td {
    border-bottom: 0;
}

td small {
    display: block;

    max-width: 340px;
    margin-top: 4px;

    color: var(--text-muted);

    font-size: 11px;
    line-height: 1.5;

    white-space: normal;
}

/* =========================================================
   BADGES
========================================================= */

.badge {
    display: inline-flex;
    align-items: center;

    padding: 4px 8px;

    border-radius: 999px;

    background: #f1f3f5;
    color: #626a75;

    font-size: 10px;
    font-weight: 800;
}

.badge.green {
    background: var(--success-bg);
    color: var(--success);
}

/* =========================================================
   EMPTY
========================================================= */

.empty {
    padding: 45px 20px;

    color: var(--text-muted);
    text-align: center;
}

/* =========================================================
   NOTICE
========================================================= */

.notice {
    padding: 14px 16px;

    border: 1px solid #e7e0f7;
    border-radius: 11px;

    background: #faf8ff;
    color: #66509a;

    font-size: 12px;
}

/* =========================================================
   ÜRÜN YÖNETİMİ
========================================================= */

/* Ürün ekleme/düzenleme formu */
.product-management-form {
    width: 100%;
}

/* ---------------------------------------------------------
   ÜRÜN RESMİ - ÖNİZLEME
   Küçük ve sabit tutulur.
--------------------------------------------------------- */

.image-preview {
    width: 80px !important;
    height: 80px !important;

    max-width: 80px !important;
    max-height: 80px !important;

    min-width: 80px !important;
    min-height: 80px !important;

    display: block;

    overflow: hidden;

    border: 1px dashed #d5d9df;
    border-radius: 10px;

    background: #f8f9fa;
}

.image-preview img {
    display: block !important;

    width: 80px !important;
    height: 80px !important;

    max-width: 80px !important;
    max-height: 80px !important;

    min-width: 80px !important;
    min-height: 80px !important;

    object-fit: cover !important;
}

/* ---------------------------------------------------------
   ÜRÜN LİSTESİ RESMİ
--------------------------------------------------------- */

.product-thumb {
    display: block !important;

    width: 42px !important;
    height: 42px !important;

    min-width: 42px !important;
    min-height: 42px !important;

    max-width: 42px !important;
    max-height: 42px !important;

    padding: 0 !important;
    margin: 0 !important;

    object-fit: cover !important;

    border: 1px solid #e5e7eb;
    border-radius: 8px;

    background: #f4f5f7;
}

.product-thumb.no-image {
    display: grid !important;
    place-items: center;

    width: 42px !important;
    height: 42px !important;

    min-width: 42px !important;
    min-height: 42px !important;

    max-width: 42px !important;
    max-height: 42px !important;

    color: #9ca3af;
    font-size: 14px;
}

/* Herhangi bir global img CSS'i ürünü büyütmesin */
.product-list-table img,
.product-list-panel img {
    max-width: 42px !important;
    max-height: 42px !important;
}

/* Önizleme alanı için istisna */
.product-list-panel .image-preview,
.product-management-form .image-preview {
    max-width: 80px !important;
    max-height: 80px !important;
}

/* ---------------------------------------------------------
   ÜRÜN TABLOSU
--------------------------------------------------------- */

.product-list-panel {
    padding: 18px;
}

.product-list-panel .table-wrap {
    border-radius: 10px;
}

.product-list-table {
    width: 100%;
    table-layout: auto;
}

.product-list-table th,
.product-list-table td {
    padding: 9px 11px;
    vertical-align: middle;
}

.product-list-table th {
    font-size: 10px;
}

.product-list-table td {
    font-size: 12px;
}

.product-list-table td b {
    font-size: 13px;
    font-weight: 700;
}

.product-list-table td small {
    max-width: 240px;

    margin-top: 3px;

    font-size: 10px;
    line-height: 1.35;
}

.product-list-table .product-price {
    font-size: 13px;
    font-weight: 700;

    white-space: nowrap;
}

/* ---------------------------------------------------------
   İŞLEM BUTONLARI
--------------------------------------------------------- */

.action-buttons {
    display: flex;

    align-items: center;
    gap: 5px;

    flex-wrap: nowrap;
}

.action-buttons .btn.small {
    min-height: 30px;

    padding: 5px 8px;

    border-radius: 7px;

    font-size: 10px;
}

/* ---------------------------------------------------------
   FORM
--------------------------------------------------------- */

.product-management-form .form-grid {
    gap: 14px;
}

.product-management-form input,
.product-management-form select,
.product-management-form textarea {
    padding: 10px 11px;

    border-radius: 9px;
    font-size: 13px;
}

.product-management-form textarea {
    min-height: 90px;
}

.product-management-form .form-help {
    margin-top: 5px;
    font-size: 10px;
}

.product-management-form .form-actions .btn {
    min-height: 37px;

    padding: 8px 13px;

    font-size: 11px;
}

/* =========================================================
   LOGIN
========================================================= */

.login-page {
    min-height: 100vh;

    display: grid;
    place-items: center;

    padding: 20px;

    background:
        radial-gradient(
            circle at 50% 0%,
            #ffffff 0,
            #f6f7f9 45%,
            #eef0f3 100%
        );
}

.login-card {
    width: min(420px, 100%);

    padding: 35px;

    border: 1px solid var(--border);
    border-radius: 22px;

    background: #fff;

    box-shadow: var(--shadow-lg);
}

.login-brand {
    padding-bottom: 12px;

    color: #17191d;

    text-align: center;

    font-size: 22px;
    font-weight: 800;
}

.login-brand span {
    color: #b08d4f;
}

.login-card h1 {
    margin: 8px 0 6px;

    text-align: center;

    font-size: 24px;
    letter-spacing: -.5px;
}

.login-card > p {
    margin: 0 0 27px;

    color: var(--text-muted);

    text-align: center;

    font-size: 13px;
}

.login-card form {
    display: grid;
    gap: 10px;
}

.login-card label {
    margin-top: 5px;
}

/* =========================================================
   MOBILE OVERLAY
========================================================= */

.sidebar-overlay {
    display: none;

    position: fixed;
    inset: 0;

    z-index: 90;

    background: rgba(0,0,0,.45);

    backdrop-filter: blur(3px);
}

/* =========================================================
   TABLET
========================================================= */

@media (max-width: 1100px) {

    .stats-grid {
        grid-template-columns:
            repeat(2, minmax(0, 1fr));
    }

    .quick-grid {
        grid-template-columns:
            repeat(2, minmax(0, 1fr));
    }
}

/* =========================================================
   MOBILE ADMIN
========================================================= */

@media (max-width: 900px) {

    .sidebar {
        transform: translateX(-100%);

        box-shadow:
            20px 0 50px rgba(0,0,0,.18);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .sidebar.open + .sidebar-overlay {
        display: block;
    }

    .main-content {
        width: 100%;
        margin-left: 0;
    }

    .menu-toggle {
        display: inline-flex;

        align-items: center;
        justify-content: center;
    }

    .topbar {
        min-height: 68px;
        padding: 0 18px;
    }

    .content {
        padding: 20px 18px 45px;
    }

    .form-grid {
        grid-template-columns: 1fr;
    }

    .form-grid .wide {
        grid-column: auto;
    }

    /* Mobilde de küçük kalacak */
    .image-preview {
        width: 80px !important;
        height: 80px !important;

        min-width: 80px !important;
        min-height: 80px !important;

        max-width: 80px !important;
        max-height: 80px !important;
    }

    .image-preview img {
        width: 80px !important;
        height: 80px !important;

        min-width: 80px !important;
        min-height: 80px !important;

        max-width: 80px !important;
        max-height: 80px !important;
    }

    .product-thumb,
    .product-thumb.no-image {
        width: 40px !important;
        height: 40px !important;

        min-width: 40px !important;
        min-height: 40px !important;

        max-width: 40px !important;
        max-height: 40px !important;
    }

    .action-buttons {
        flex-wrap: wrap;
    }
}

/* =========================================================
   SMALL MOBILE
========================================================= */

@media (max-width: 600px) {

    .stats-grid,
    .quick-grid {
        grid-template-columns: 1fr;
    }

    .panel {
        padding: 17px;
        border-radius: 15px;
    }

    .panel-head {
        align-items: flex-start;
        flex-direction: column;
        gap: 12px;
    }

    .inline-form {
        flex-direction: column;
    }

    .form-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .form-actions .btn {
        width: 100%;
    }

    .topbar strong {
        font-size: 16px;
    }

    .topbar small {
        font-size: 10px;
    }

    .table-wrap {
        margin-right: -2px;
    }

    th,
    td {
        padding: 10px 9px;
        font-size: 12px;
    }

    .action-buttons {
        flex-direction: column;
        align-items: stretch;
    }

    .action-buttons .btn,
    .action-buttons form {
        width: 100%;
    }

    .action-buttons .btn {
        text-align: center;
    }

    /* Küçük ekranda ürün resmi daha da kompakt */
    .product-thumb,
    .product-thumb.no-image {
        width: 38px !important;
        height: 38px !important;

        min-width: 38px !important;
        min-height: 38px !important;

        max-width: 38px !important;
        max-height: 38px !important;
    }

    .image-preview {
        width: 70px !important;
        height: 70px !important;

        min-width: 70px !important;
        min-height: 70px !important;

        max-width: 70px !important;
        max-height: 70px !important;
    }

    .image-preview img {
        width: 70px !important;
        height: 70px !important;

        min-width: 70px !important;
        min-height: 70px !important;

        max-width: 70px !important;
        max-height: 70px !important;
    }

    .product-list-table th,
    .product-list-table td {
        padding: 8px;
    }
}

/* =========================================================
   EXTRA SMALL
========================================================= */

@media (max-width: 380px) {

    .content {
        padding: 15px 12px 35px;
    }

    .panel {
        padding: 14px;
    }

    .login-card {
        padding: 25px 20px;
    }
}