﻿@import url('https://fonts.googleapis.com/css2?family=Tajawal:wght@400;500;700;800&display=swap');

:root {
    /* --- Professional Palette --- */
    --primary-900: #0f172a;
    --primary-800: #1e293b;
    --primary-700: #334155;
    --accent-color: #2563eb;
    --accent-hover: #1d4ed8;
    --accent-light: #eff6ff;
    --bg-body: #f1f5f9;
    --bg-surface: #ffffff;
    --bg-card: #ffffff;
    --text-main: #0f172a;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    --border-light: #e2e8f0;
    --border-focus: #2563eb;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --sidebar-width: 280px;
    --header-height: 64px;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
}

body {
    font-family: 'Tajawal', sans-serif;
    background-color: var(--bg-body);
    color: var(--text-main);
    overflow-x: hidden;
}

/* ------------------- Sidebar Overlay ------------------- */
.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(15, 23, 42, 0.5); /* Hafif Saydam Karanlık */
    backdrop-filter: blur(2px);
    z-index: 999;
    opacity: 0;
    visibility: hidden;
    transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

    .sidebar-overlay.show {
        opacity: 1;
        visibility: visible;
    }

/* ------------------- Sidebar ------------------- */
.admin-sidebar {
    width: var(--sidebar-width);
    height: 100vh;
    position: fixed;
    right: 0;
    top: 0;
    background: var(--primary-900);
    color: white;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-lg);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar-header {
    height: 80px;
    display: flex;
    align-items: center;
    padding: 0 1.5rem;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    background: rgba(0,0,0,0.1);
}

.brand-icon {
    width: 40px;
    height: 40px;
    background: var(--accent-color);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    margin-left: 12px;
}

.brand-name {
    font-weight: 700;
    margin: 0;
    font-size: 1.1rem;
    letter-spacing: -0.5px;
}

.brand-subtitle {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.btn-close-sidebar {
    background: transparent;
    border: none;
    color: #cbd5e1;
    font-size: 1.5rem;
    padding: 0;
    cursor: pointer;
    transition: 0.2s;
}

    .btn-close-sidebar:hover {
        color: white;
        transform: rotate(90deg);
    }

.sidebar-content {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem 0;
    scrollbar-width: thin;
    scrollbar-color: var(--primary-700) transparent;
}

.nav-section-title {
    display: block;
    padding: 0 1.5rem;
    margin-bottom: 0.75rem;
    font-size: 0.7rem;
    text-transform: uppercase;
    color: var(--text-muted);
    font-weight: 700;
    letter-spacing: 0.5px;
}

.nav-list {
    list-style: none;
    padding: 0;
    margin: 0 0 2rem 0;
}

.nav-link {
    display: flex;
    align-items: center;
    padding: 12px 1.5rem;
    color: var(--text-secondary);
    text-decoration: none;
    transition: all 0.2s;
    border-right: 3px solid transparent;
    color: #94a3b8;
}

    .nav-link i {
        font-size: 1.2rem;
        margin-left: 12px;
        width: 24px;
        text-align: center;
    }

    .nav-link:hover {
        background: rgba(255,255,255,0.05);
        color: white;
    }

    .nav-link.active {
        background: rgba(37, 99, 235, 0.1);
        color: var(--accent-color);
        border-right-color: var(--accent-color);
    }

    .nav-link.disabled {
        opacity: 0.5;
        pointer-events: none;
    }

.badge-coming-soon {
    margin-right: auto;
    font-size: 0.6rem;
    background: rgba(255,255,255,0.1);
    padding: 2px 6px;
    border-radius: 4px;
    color: #cbd5e1;
}

/* ------------------- Tree View ------------------- */
.tree-view-wrapper {
    padding: 0 1rem;
}

.tree-list {
    list-style: none;
    padding: 0;
}

.folder-item {
    margin-bottom: 4px;
}

.folder-row {
    display: flex;
    align-items: center;
    padding: 8px 10px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    color: #cbd5e1;
    font-size: 0.9rem;
}

    .folder-row:hover {
        background: rgba(255,255,255,0.05);
        color: white;
    }

    .folder-row.active {
        background: var(--accent-color);
        color: white;
        font-weight: 600;
    }

.arrow-icon {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    margin-left: 8px;
    transition: all 0.2s;
    color: #64748b;
}

    .arrow-icon:hover {
        background: rgba(255,255,255,0.1);
        color: white;
    }

.folder-row.active .arrow-icon {
    color: rgba(255,255,255,0.8);
}

.arrow-icon i {
    transition: transform 0.2s;
    display: inline-block;
}

.sub-group.expanded + .folder-row .arrow-icon i,
.arrow-icon.open i {
    transform: rotate(-90deg);
}

.arrow-icon i {
    transform: rotate(0deg);
}

.sub-group {
    list-style: none;
    padding-right: 28px;
    display: none;
    margin-top: 2px;
}

    .sub-group.expanded {
        display: block;
        animation: fadeIn 0.3s;
    }

.sub-link {
    display: block;
    padding: 6px 10px;
    color: #94a3b8;
    text-decoration: none;
    font-size: 0.85rem;
    border-radius: 6px;
    transition: 0.2s;
    margin-bottom: 2px;
    position: relative;
}

    .sub-link::before {
        content: '';
        position: absolute;
        right: -14px;
        top: 50%;
        width: 10px;
        height: 1px;
        background: #475569;
    }

    .sub-link:hover, .sub-link.active {
        color: white;
        background: rgba(255,255,255,0.05);
    }

.btn-refresh-cat {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1rem;
    cursor: pointer;
    transition: 0.3s;
}

    .btn-refresh-cat:hover {
        color: white;
        transform: rotate(180deg);
    }

/* ------------------- Main Content ------------------- */
.main-content {
    margin-right: var(--sidebar-width);
    min-height: 100vh;
    transition: margin 0.3s;
}

.top-bar {
    height: var(--header-height);
    background: var(--bg-surface);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 90;
}

.btn-toggle-sidebar {
    background: transparent;
    border: none;
    color: var(--text-main);
    font-size: 1.7rem;
    cursor: pointer;
    padding: 0;
    margin-left: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: 0.2s;
}

    .btn-toggle-sidebar:focus {
        outline: none;
    }

#tableDragContainer {
    width: 100%;
}

.page-title {
    font-weight: 700;
    font-size: 1.25rem;
    color: var(--text-main);
    margin: 0;
    display: flex;
    align-items: center;
}

.btn-custom {
    padding: 0.6rem 1.2rem;
    border-radius: 8px;
    border: none;
    font-weight: 600;
    font-size: 0.9rem;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.btn-primary-custom {
    background: var(--accent-color);
    color: white;
    box-shadow: 0 2px 4px rgba(37, 99, 235, 0.3);
}

    .btn-primary-custom:hover {
        background: var(--accent-hover);
        transform: translateY(-1px);
    }

.btn-secondary-custom {
    background: white;
    border: 1px solid var(--border-light);
    color: var(--text-secondary);
}

    .btn-secondary-custom:hover {
        background: #f8fafc;
        color: var(--text-main);
    }

/* ------------------- Content & Filter ------------------- */
.content-wrapper {
    padding: 2rem;
}

.filter-card {
    background: var(--bg-surface);
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: var(--shadow-sm);
    margin-bottom: 1.5rem;
    border: 1px solid var(--border-light);
}

.search-input-wrapper {
    position: relative;
}

    .search-input-wrapper i {
        position: absolute;
        right: 12px;
        top: 50%;
        transform: translateY(-50%);
        color: var(--text-muted);
    }

.custom-input {
    width: 100%;
    padding: 10px 40px 10px 12px;
    border: 1px solid var(--border-light);
    border-radius: 8px;
    background: #f8fafc;
    transition: all 0.2s;
    font-size: 0.9rem;
}

    .custom-input:focus {
        outline: none;
        border-color: var(--border-focus);
        background: white;
        box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
    }

    .custom-input.lg {
        font-size: 1.1rem;
        padding: 12px;
        font-weight: 600;
    }

.custom-select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border-light);
    border-radius: 8px;
    background-color: white;
    font-size: 0.9rem;
}

.stat-pill {
    display: inline-flex;
    align-items: center;
    background: var(--accent-light);
    color: var(--accent-color);
    padding: 6px 16px;
    border-radius: 30px;
    font-weight: 600;
    font-size: 0.9rem;
}

    .stat-pill .label {
        opacity: 0.8;
        margin-left: 6px;
        font-weight: 400;
    }

/* ------------------- Table ------------------- */
.table-card {
    background: var(--bg-surface);
    border-radius: 12px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-light);
    overflow: hidden;
    position: relative;
    width: 100%;
}

.top-scrollbar {
    overflow-x: auto;
    overflow-y: hidden;
    height: 12px;
    background: transparent;
    margin-bottom: 4px;
}

    .top-scrollbar::-webkit-scrollbar {
        height: 8px;
    }

    .top-scrollbar::-webkit-scrollbar-track {
        background: var(--border-light);
        border-radius: 10px;
    }

    .top-scrollbar::-webkit-scrollbar-thumb {
        background: var(--accent-color);
        border-radius: 10px;
    }

        .top-scrollbar::-webkit-scrollbar-thumb:hover {
            background: var(--accent-hover);
        }

.top-scrollbar-inner {
    height: 1px;
    visibility: hidden;
}

.drag-scroll {
    cursor: grab;
    overflow-x: auto;
    white-space: nowrap;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: var(--accent-color) var(--border-light);
    transition: all 0.2s;
    user-select: none;
}

    .drag-scroll:active {
        cursor: grabbing;
    }

    .drag-scroll::-webkit-scrollbar {
        height: 6px;
    }

    .drag-scroll::-webkit-scrollbar-track {
        background: var(--border-light);
        border-radius: 10px;
    }

    .drag-scroll::-webkit-scrollbar-thumb {
        background: var(--accent-color);
        border-radius: 10px;
    }

        .drag-scroll::-webkit-scrollbar-thumb:hover {
            background: var(--accent-hover);
        }

.custom-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    min-width: 1200px;
}

    .custom-table th {
        background: #f8fafc;
        padding: 12px 10px;
        text-align: right;
        font-weight: 600;
        color: var(--text-secondary);
        border-bottom: 1px solid var(--border-light);
        font-size: 0.85rem;
        text-transform: uppercase;
        white-space: nowrap;
    }

    .custom-table td {
        padding: 10px 10px;
        border-bottom: 1px solid var(--border-light);
        vertical-align: middle;
        white-space: nowrap;
        font-size: 0.85rem;
    }

    .custom-table tr:hover {
        background: #fcfcfc;
    }

.product-img {
    width: 40px;
    height: 40px;
    border-radius: 6px;
    object-fit: cover;
    border: 1px solid var(--border-light);
    padding: 2px;
    background: white;
}

.status-badge {
    padding: 3px 8px;
    border-radius: 6px;
    font-size: 0.7rem;
    font-weight: 700;
    display: inline-block;
    white-space: nowrap;
}

.status-0 {
    background: #f1f5f9;
    color: #475569;
}

.status-1 {
    background: #dcfce7;
    color: #166534;
}

.status-2 {
    background: #fff7ed;
    color: #9a3412;
}

.status-3 {
    background: #fee2e2;
    color: #991b1b;
}

/* Tree View Image Icons */
.cat-tree-icon {
    width: 24px;
    height: 24px;
    border-radius: 6px;
    object-fit: cover;
    margin-left: 10px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    background: #fff;
    flex-shrink: 0;
}

    .cat-tree-icon.sm {
        width: 18px;
        height: 18px;
        margin-left: 8px;
    }

/* Hover Action Buttons in Tree */
.cat-actions {
    display: none;
    margin-right: auto;
    padding-right: 5px;
}

.folder-row:hover .cat-actions,
.sub-link:hover .cat-actions {
    display: flex;
    gap: 4px;
}

.btn-cat-action {
    width: 24px;
    height: 24px;
    border-radius: 4px;
    border: none;
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    transition: all 0.2s;
}

    .btn-cat-action.edit:hover {
        background: var(--accent-color);
    }

    .btn-cat-action.delete:hover {
        background: var(--danger);
    }

/* Active State for Parent Folders */
.folder-row.active-parent {
    border-right: 3px solid var(--accent-color);
    background: rgba(255, 255, 255, 0.03);
}

.sub-link {
    display: flex;
    align-items: center;
    text-decoration: none;
}

.btn-icon {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    border: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-left: 4px;
    transition: 0.2s;
    cursor: pointer;
}

    .btn-icon.edit {
        background: #eff6ff;
        color: var(--accent-color);
    }

        .btn-icon.edit:hover {
            background: var(--accent-color);
            color: white;
        }

    .btn-icon.delete {
        background: #fef2f2;
        color: var(--danger);
    }

        .btn-icon.delete:hover {
            background: var(--danger);
            color: white;
        }

/* ------------------- Pagination Styles ------------------- */
.pagination-wrapper {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    background: #ffffff;
    border-top: 1px solid var(--border-light);
    margin-top: auto; /* Tablonun en altına yapıştırır */
    flex-wrap: wrap;
    gap: 1rem;
}

.pagination-container {
    display: flex;
    gap: 6px;
    align-items: center;
    direction: ltr; /* Sayıların düzgün dizilmesi için */
}

.pagination-btn {
    min-width: 40px;
    height: 40px;
    border-radius: 10px;
    border: 1px solid var(--border-light);
    background: #fff;
    color: var(--text-secondary);
    font-weight: 600;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
}

    .pagination-btn:hover:not(.disabled):not(.active) {
        background: var(--accent-light);
        border-color: var(--accent-color);
        color: var(--accent-color);
        transform: translateY(-2px);
    }

    .pagination-btn.active {
        background: var(--accent-color);
        color: #fff;
        border-color: var(--accent-color);
        box-shadow: 0 4px 10px rgba(37, 99, 235, 0.3);
    }

.pagination-info {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 500;
    padding: 8px 16px;
    background: var(--bg-body);
    border-radius: 50px;
}

/* ------------------- Custom Modal ------------------- */
.custom-modal .modal-content {
    border-radius: 16px;
    border: none;
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}

.custom-modal .modal-header {
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border-light);
    padding: 1.25rem 1.5rem;
    align-items: center;
}

.modal-title {
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 700;
    color: var(--text-main);
}

.icon-wrapper {
    width: 36px;
    height: 36px;
    background: var(--accent-light);
    color: var(--accent-color);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-close-custom {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.2rem;
    transition: 0.2s;
}

    .btn-close-custom:hover {
        color: var(--danger);
        transform: rotate(90deg);
    }

.border-start-lg {
    border-right: 1px solid var(--border-light);
}

@media (max-width: 992px) {
    .border-start-lg {
        border-right: none;
        border-bottom: 1px solid var(--border-light);
    }
}

.section-header {
    font-size: 0.85rem;
    text-transform: uppercase;
    color: var(--text-muted);
    font-weight: 700;
    letter-spacing: 0.5px;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-light);
}

.required {
    color: var(--danger);
    margin-right: 4px;
}

.form-label {
    font-size: 0.9rem;
    font-weight: 500;
    margin-bottom: 6px;
    color: var(--text-secondary);
}

.upload-area {
    border: 2px dashed var(--border-light);
    border-radius: 12px;
    padding: 1.5rem;
    text-align: center;
    cursor: pointer;
    transition: 0.2s;
    background: #fcfcfc;
}

    .upload-area:hover {
        border-color: var(--accent-color);
        background: var(--accent-light);
    }

    .upload-area i {
        font-size: 2rem;
        color: var(--text-muted);
        margin-bottom: 8px;
        display: block;
    }

    .upload-area p {
        margin: 0;
        font-weight: 600;
        color: var(--text-main);
        font-size: 0.9rem;
    }

.file-info {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
    gap: 12px;
    margin-top: 15px;
    max-height: 300px;
    overflow-y: auto;
    padding: 5px;
    background: #f8fafc;
    border-radius: 12px;
    border: 1px solid var(--border-light);
}

.gallery-thumb {
    position: relative;
    border-radius: 10px;
    overflow: hidden;
    aspect-ratio: 1;
    border: 2px solid var(--border-light);
    transition: all 0.2s;
    box-shadow: var(--shadow-sm);
}

    .gallery-thumb:hover {
        border-color: var(--accent-color);
        transform: scale(1.03);
        box-shadow: var(--shadow-md);
    }

    .gallery-thumb img {
        width: 100%;
        height: 100%;
        object-fit: cover;
        cursor: pointer;
    }

.btn-remove-img {
    position: absolute;
    top: 4px;
    left: 4px;
    width: 24px;
    height: 24px;
    background: rgba(239, 68, 68, 0.9);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 12px;
    transition: 0.2s;
    border: 1px solid white;
}

    .btn-remove-img:hover {
        background: var(--danger);
        transform: scale(1.1);
    }

.status-selector {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
}

.btn-status {
    text-align: center;
    padding: 8px;
    border: 1px solid var(--border-light);
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 500;
    transition: 0.2s;
    background: white;
}

.btn-check:checked + .btn-status {
    border-color: var(--accent-color);
    background: var(--accent-light);
    color: var(--accent-color);
    font-weight: 700;
}

    .btn-check:checked + .btn-status.discount {
        border-color: #10b981;
        background: #d1fae5;
        color: #047857;
    }

    .btn-check:checked + .btn-status.offer {
        border-color: #f59e0b;
        background: #fef3c7;
        color: #b45309;
    }

    .btn-check:checked + .btn-status.hidden {
        border-color: #ef4444;
        background: #fee2e2;
        color: #b91c1c;
    }

.dots-loader {
    width: 40px;
    height: 40px;
    border: 4px solid var(--border-light);
    border-top-color: var(--accent-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 20px auto;
}

@keyframes spin {
    100% {
        transform: rotate(360deg);
    }
}

.spinner-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(4px);
    z-index: 9999;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    visibility: hidden;
    transition: 0.3s;
}

    .spinner-overlay.show {
        opacity: 1;
        visibility: visible;
    }

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #e2e8f0;
    border-top-color: var(--accent-color);
    border-radius: 50%;
    animation: spin 0.8s infinite linear;
}

.spinner-text {
    margin-top: 15px;
    font-weight: 600;
    color: var(--primary-800);
    text-align: center;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-5px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ------------------- RESPONSIVE MOBİL ALAN (Media Queries) ------------------- */
@media (max-width: 992px) {
    .admin-sidebar {
        transform: translateX(100%); /* Sağa itip gizle (RTL Sistem) */
    }

        .admin-sidebar.show {
            transform: translateX(0); /* Çıkar */
        }

    .main-content {
        margin-right: 0;
    }
}

@media (max-width: 768px) {
    /* Top Bar Mobile */
    .top-bar {
        padding: 0 1rem;
        gap: 10px;
    }

    .page-title {
        font-size: 1.05rem;
    }

    /* Ürün Ekle Butonu Mobil */
    .btn-custom {
        padding: 0.5rem 0.8rem;
        font-size: 0.85rem;
    }

    /* Tablo Kolonları Sıkıştırma Padding Ayarları */
    .custom-table th, .custom-table td {
        padding: 6px 8px;
        font-size: 0.8rem;
    }

    .product-img {
        width: 32px;
        height: 32px;
    }

    .content-wrapper {
        padding: 1rem;
    }
}

@media (max-width: 576px) {
    .custom-table th:nth-child(4),
    .custom-table td:nth-child(4) {
        display: none;
    }
}
