/* =========================================
   1. DEĞİŞKENLER VE TEMA (DARK/LIGHT)
   ========================================= */
:root {
    --primary-color: #2563eb;       /* Ana Mavi */
    --primary-hover: #1d4ed8;
    --secondary-color: #64748b;     /* Gri */
    --success-color: #22c55e;       /* Yeşil */
    --danger-color: #ef4444;        /* Kırmızı */
    --warning-color: #f59e0b;       /* Turuncu */
    
    --bg-body: #f8f9fa;
    --bg-surface: #ffffff;
    --bg-header: #ffffff;
    
    --text-main: #1e293b;
    --text-muted: #64748b;
    --text-light: #94a3b8;
    
    --border-color: #e2e8f0;
    --input-bg: #ffffff;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    
    --radius: 8px;
    --container-width: 1200px;
}

/* Karanlık Mod */
@media (prefers-color-scheme: dark) {
    :root {
        --bg-body: #0f172a;
        --bg-surface: #1e293b;
        --bg-header: #1e293b;
        
        --text-main: #f1f5f9;
        --text-muted: #94a3b8;
        --text-light: #64748b;
        
        --border-color: #334155;
        --input-bg: #0f172a;
        --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
        --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.5);
    }
}

/* =========================================
   2. TEMEL AYARLAR (RESET & BASE)
   ========================================= */
* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    overflow-x: hidden;
}

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background-color: var(--bg-body);
    color: var(--text-main);
    line-height: 1.6;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    transition: background-color 0.3s, color 0.3s;
}

body.no-scroll { overflow: hidden; }

a { text-decoration: none; color: inherit; transition: color 0.2s; }
ul { list-style: none; padding: 0; margin: 0; }
img { max-width: 100%; display: block; }

.container {
    max-width: var(--container-width);
    margin: 0 auto;
    padding: 0 20px;
    width: 100%;
}

.main-wrapper { flex: 1; padding-top: 30px; padding-bottom: 50px; }

/* =========================================
   3. HEADER VE NAVİGASYON
   ========================================= */
.site-header {
    background-color: var(--bg-header);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: var(--shadow-sm);
}

.header-inner {
    height: 70px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
    display: flex;
    align-items: center;
    gap: 10px;
}

.search-bar { flex: 1; max-width: 500px; margin: 0 20px; }
.search-bar form { position: relative; }
.search-bar input {
    width: 100%;
    padding: 10px 40px 10px 15px;
    border-radius: 20px;
    border: 1px solid var(--border-color);
    background-color: var(--input-bg);
    color: var(--text-main);
}
.search-bar button {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
}

.header-actions { display: flex; align-items: center; gap: 15px; }

.action-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: var(--radius);
    color: var(--text-main);
    font-weight: 500;
    position: relative;
    border: none;
    background: transparent;
    cursor: pointer;
    font-size: 1rem;
}
.action-btn:hover { background-color: rgba(0,0,0,0.05); color: var(--primary-color); }

.cart-badge {
    position: absolute;
    top: 0;
    right: 0;
    background-color: var(--danger-color);
    color: white;
    font-size: 0.7rem;
    padding: 2px 6px;
    border-radius: 10px;
    transform: translate(25%, -25%);
}

/* Dropdown */
.dropdown { position: relative; }
.dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    width: 220px;
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    margin-top: 10px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: all 0.2s ease;
    overflow: hidden;
    z-index: 1001;
}

@media (min-width: 769px) {
    .dropdown:hover .dropdown-menu, 
    .dropdown-menu.show {
        opacity: 1;
        visibility: visible;
        transform: translateY(0);
    }
}

.dropdown-header {
    padding: 15px;
    background-color: rgba(0,0,0,0.02);
    border-bottom: 1px solid var(--border-color);
}
.dropdown-header strong { display: block; }
.dropdown-header small { color: var(--text-muted); font-size: 0.85rem; }

.dropdown-menu a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 15px;
    color: var(--text-main);
    font-size: 0.95rem;
}
.dropdown-menu a:hover { background-color: rgba(0,0,0,0.03); color: var(--primary-color); }
.dropdown-menu .divider { height: 1px; background-color: var(--border-color); margin: 5px 0; }
.dropdown-menu .text-danger { color: var(--danger-color); }

.mobile-toggle { display: none; background: none; border: none; font-size: 1.5rem; color: var(--text-main); cursor: pointer; }
.mobile-search { display: none; padding: 10px 0; border-top: 1px solid var(--border-color); background: var(--bg-header); }
.mobile-search input { width: 100%; padding: 8px; border-radius: var(--radius); border: 1px solid var(--border-color); background: var(--input-bg); color: var(--text-main);}

/* =========================================
   4. ÜRÜN KARTLARI VE LİSTELEME
   ========================================= */
.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 25px;
}

.product-card {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s;
    display: flex;
    flex-direction: column;
}

.product-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-md);
    border-color: var(--primary-color);
}

.product-image {
    height: 250px;
    background-color: rgba(0,0,0,0.03);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-light);
    font-size: 3rem;
    overflow: hidden;
}
.product-image img { width: 100%; height: 100%; object-fit: cover; }

.product-info { padding: 15px; flex: 1; display: flex; flex-direction: column; }
.product-cat { font-size: 0.8rem; color: var(--primary-color); margin-bottom: 5px; text-transform: uppercase; font-weight: 600; }
.product-title { font-size: 1.1rem; margin: 0 0 5px; font-weight: 700; line-height: 1.4; }
.product-author { color: var(--text-muted); font-size: 0.9rem; margin-bottom: 15px; flex: 1; }
.btn-primary {
    background-color: var(--primary-color);
    color: white;
    text-align: center;
    padding: 10px;
    border-radius: var(--radius);
    font-weight: 500;
    transition: background 0.2s;
    border: none;
    cursor: pointer;
    display: block;
    width: 100%;
}
.btn-primary:hover { background-color: var(--primary-hover); }

/* =========================================
   5. FOOTER
   ========================================= */
.site-footer {
    background-color: #1e293b;
    color: #f8f9fa;
    padding: 60px 0 20px;
    margin-top: auto;
}
.footer-inner {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 40px;
    margin-bottom: 40px;
}
.footer-col h3 { font-size: 1.1rem; border-bottom: 2px solid var(--primary-color); padding-bottom: 10px; margin-bottom: 20px; display: inline-block; }
.footer-col ul li { margin-bottom: 10px; }
.footer-col ul li a { color: #94a3b8; }
.footer-col ul li a:hover { color: white; padding-left: 5px; }
.footer-bottom { text-align: center; padding-top: 20px; border-top: 1px solid #334155; color: #64748b; font-size: 0.9rem; }

/* =========================================
   6. YENİ EKLENEN: ANA SAYFA DÜZENİ (SIDEBAR)
   ========================================= */
.home-container {
    display: flex;
    gap: 30px;
    margin-top: 30px;
    align-items: flex-start;
}

.sidebar {
    width: 260px;
    flex-shrink: 0;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    overflow: hidden;
}

.sidebar-title {
    margin: 0;
    padding: 15px 20px;
    background: rgba(0,0,0,0.02);
    border-bottom: 1px solid var(--border-color);
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-main);
}

.category-list { list-style: none; padding: 10px 0; margin: 0; }
.category-link {
    display: block;
    padding: 10px 20px;
    color: var(--text-muted);
    transition: all 0.2s;
    font-weight: 500;
    border-left: 3px solid transparent;
}
.category-link:hover {
    background: rgba(0,0,0,0.03);
    color: var(--primary-color);
    border-left-color: var(--primary-color);
    padding-left: 25px;
}

.home-main { flex-grow: 1; }
.section-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin-top: 0;
    margin-bottom: 20px;
    color: var(--text-main);
    padding-bottom: 10px;
    border-bottom: 2px solid var(--border-color);
}

/* =========================================
   7. MOBİL UYUMLULUK VE DRAWER MENÜ
   ========================================= */
@media (max-width: 768px) {
    .home-container { flex-direction: column; }
    .sidebar { width: 100%; margin-bottom: 30px; }

    .search-bar { display: none !important; }
    .header-actions .action-text { display: none !important; }
    #userDropdownBtn { display: none !important; }

    .mobile-search { display: block; }
    .mobile-toggle { display: block; }
    
    .dropdown-menu {
        position: fixed;
        top: 0;
        left: -100%;
        width: 85%;
        max-width: 320px;
        height: 100vh;
        background-color: var(--bg-surface);
        border: none;
        border-radius: 0;
        box-shadow: 4px 0 15px rgba(0,0,0,0.2);
        z-index: 1005;
        transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        display: flex;
        flex-direction: column;
        opacity: 1;
        visibility: visible;
        overflow-y: auto;
    }

    .dropdown-header {
        background: var(--primary-color);
        color: white;
        padding: 30px 20px;
        margin-bottom: 10px;
        border-bottom: none;
        flex-shrink: 0;
    }
    .dropdown-header small { color: rgba(255,255,255,0.8); }

    .dropdown-menu.show { left: 0; }
    
    .dropdown-menu a {
        padding: 15px 20px;
        font-size: 1.1rem;
        border-bottom: 1px solid var(--border-color);
        display: block;
    }

    .menu-backdrop {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background-color: rgba(0, 0, 0, 0.5);
        z-index: 1004;
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.3s ease;
    }

    .menu-backdrop.show { opacity: 1; visibility: visible; }
}

/* =========================================
   8. YENİ EKLENEN: DETAY SAYFASI VE TABLOLAR
   ========================================= */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.95rem;
}

.table th, .table td {
    padding: 15px;
    border-bottom: 1px solid var(--border-color);
    text-align: left;
    vertical-align: middle;
}

.table th {
    background-color: #f8fafc;
    font-weight: 600;
    color: var(--text-muted);
}

/* Badge (Kondisyon Etiketleri için) */
.badge {
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.85rem;
    font-weight: 600;
    display: inline-block;
}

/* Form Elemanları (Card içi inputlar) */
.form-group { margin-bottom: 15px; }
.form-label { display: block; margin-bottom: 5px; font-weight: 500; color: var(--text-main); }
.form-control {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    background: var(--input-bg);
    color: var(--text-main);
    transition: border 0.2s;
}
.form-control:focus {
    border-color: var(--primary-color);
    outline: none;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}
.form-text { font-size: 0.85rem; color: var(--text-muted); margin-top: 5px; }

/* Buton Grupları (Küçük boyutlu) */
.btn-sm {
    padding: 6px 12px;
    font-size: 0.85rem;
    width: auto !important; /* w-100 olmasın */
    display: inline-flex !important;
    align-items: center;
    gap: 5px;
}
.btn-danger { background-color: var(--danger-color); color: white; }
.btn-danger:hover { background-color: #dc2626; }
.btn-success { background-color: var(--success-color); color: white; }