/* =============================================
   CYPRODECK PRO MUHASEBE - Ana Stil Dosyası
   Premium Light Theme
   ============================================= */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

/* ---- CSS Variables ---- */
:root {
    --bg-primary: #f0f2f5;
    --bg-secondary: #e8eaed;
    --bg-card: #ffffff;
    --bg-card-hover: #f8f9fa;
    --bg-sidebar: #ffffff;
    --bg-input: #f5f6f8;
    --border-color: #e2e5e9;
    --text-primary: #1a1d23;
    --text-secondary: #4a5568;
    --text-muted: #8896a6;
    --accent-indigo: #6366f1;
    --accent-amber: #f59e0b;
    --accent-red: #ef4444;
    --accent-green: #10b981;
    --accent-blue: #3b82f6;
    --accent-purple: #8b5cf6;
    --accent-pink: #ec4899;
    --accent-rose: #f43f5e;
    --accent-emerald: #10b981;
    --gradient-indigo: linear-gradient(135deg, #6366f1, #818cf8);
    --gradient-amber: linear-gradient(135deg, #f59e0b, #fbbf24);
    --gradient-red: linear-gradient(135deg, #ef4444, #f87171);
    --gradient-green: linear-gradient(135deg, #10b981, #34d399);
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
    --shadow-lg: 0 10px 30px rgba(0,0,0,0.1);
    --sidebar-width: 260px;
    --header-height: 64px;
    --radius: 12px;
    --radius-sm: 8px;
    --transition: all 0.3s cubic-bezier(0.4,0,0.2,1);
}

/* ---- Reset ---- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
    font-family: 'Inter', -apple-system, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
}
a { color: var(--accent-indigo); text-decoration: none; transition: var(--transition); }
a:hover { color: #4f46e5; }

/* ---- Login Page ---- */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-primary);
    background-image: radial-gradient(ellipse at 20% 50%, rgba(99,102,241,0.06) 0%, transparent 50%),
                      radial-gradient(ellipse at 80% 20%, rgba(139,92,246,0.04) 0%, transparent 50%);
}
.login-container {
    width: 100%; max-width: 420px; padding: 20px;
}
.login-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 48px 40px;
    box-shadow: var(--shadow-lg);
}
.login-logo {
    text-align: center; margin-bottom: 36px;
}
.login-logo h1 {
    font-size: 28px; font-weight: 800;
    background: var(--gradient-indigo);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 4px;
}
.login-logo span { font-size: 13px; color: var(--text-muted); }

/* ---- Layout ---- */
.app-wrapper { display: flex; min-height: 100vh; }

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border-color);
    position: fixed; top: 0; left: 0; bottom: 0;
    z-index: 100;
    display: flex; flex-direction: column;
    transition: var(--transition);
    overflow-y: auto;
    box-shadow: 2px 0 8px rgba(0,0,0,0.04);
}
.sidebar-brand {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex; align-items: center; gap: 12px;
}
.sidebar-brand .brand-icon {
    width: 40px; height: 40px;
    background: var(--gradient-indigo);
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    font-size: 20px; font-weight: 800; color: #fff;
}
.sidebar-brand h2 { font-size: 18px; font-weight: 700; color: var(--text-primary); }
.sidebar-brand small { font-size: 11px; color: var(--text-muted); display: block; }

.sidebar-nav { padding: 16px 12px; flex: 1; }
.nav-label {
    font-size: 10px; font-weight: 700; text-transform: uppercase;
    color: var(--text-muted); padding: 16px 12px 8px; letter-spacing: 1.5px;
}
.nav-item {
    display: flex; align-items: center; gap: 12px;
    padding: 10px 14px; border-radius: var(--radius-sm);
    color: var(--text-secondary); font-size: 14px; font-weight: 500;
    transition: var(--transition); margin-bottom: 2px; cursor: pointer;
}
.nav-item:hover { background: #f0f2f5; color: var(--text-primary); }
.nav-item.active {
    background: rgba(99,102,241,0.08); color: var(--accent-indigo); font-weight: 600;
}
.nav-item .nav-icon { font-size: 18px; width: 24px; text-align: center; }
.nav-item .nav-badge {
    margin-left: auto;
    background: var(--accent-red);
    color: #fff; font-size: 11px; font-weight: 600;
    padding: 2px 8px; border-radius: 10px;
}

.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--border-color);
}
.sidebar-user {
    display: flex; align-items: center; gap: 10px;
}
.sidebar-user .user-avatar {
    width: 36px; height: 36px;
    background: var(--gradient-indigo);
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; color: #fff; font-size: 14px;
}
.sidebar-user .user-info { flex: 1; }
.sidebar-user .user-name { font-size: 13px; font-weight: 600; color: var(--text-primary); }
.sidebar-user .user-role { font-size: 11px; color: var(--text-muted); }

/* Main Content */
.main-content {
    margin-left: var(--sidebar-width);
    flex: 1; min-height: 100vh;
}

/* Header */
.top-header {
    height: var(--header-height);
    background: rgba(255,255,255,0.85);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-color);
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 32px;
    position: sticky; top: 0; z-index: 50;
}
.header-left { display: flex; align-items: center; gap: 16px; }
.header-left h2 { font-size: 18px; font-weight: 700; color: var(--text-primary); }
.header-right { display: flex; align-items: center; gap: 12px; }
.menu-toggle {
    display: none; background: none; border: none;
    color: var(--text-primary); font-size: 24px; cursor: pointer;
}

/* Content */
.content-area { padding: 28px 32px; }

/* ---- Cards ---- */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
}
.card:hover { border-color: #d1d5db; box-shadow: var(--shadow-md); }
.card-header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 20px; padding-bottom: 16px;
    border-bottom: 1px solid var(--border-color);
}
.card-header h3 { font-size: 16px; font-weight: 600; color: var(--text-primary); }

/* Stat Cards */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 20px; margin-bottom: 28px; }
.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 24px;
    position: relative; overflow: hidden;
    transition: var(--transition);
    box-shadow: var(--shadow-sm);
}
.stat-card::before {
    content: '';
    position: absolute; top: 0; left: 0; right: 0; height: 3px;
}
.stat-card.sales::before { background: var(--gradient-indigo); }
.stat-card.purchases::before { background: var(--gradient-amber); }
.stat-card.expenses::before { background: var(--gradient-red); }
.stat-card.stock::before { background: var(--gradient-green); }
.stat-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-md); }
.stat-card .stat-icon {
    width: 48px; height: 48px; border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    font-size: 22px; margin-bottom: 16px;
}
.stat-card.sales .stat-icon { background: rgba(99,102,241,0.10); }
.stat-card.purchases .stat-icon { background: rgba(245,158,11,0.10); }
.stat-card.expenses .stat-icon { background: rgba(239,68,68,0.10); }
.stat-card.stock .stat-icon { background: rgba(16,185,129,0.10); }
.stat-card .stat-value { font-size: 28px; font-weight: 800; margin-bottom: 4px; color: var(--text-primary); }
.stat-card .stat-label { font-size: 13px; color: var(--text-muted); }

/* ---- Grid Layouts ---- */
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; margin-bottom: 28px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; margin-bottom: 28px; }

/* ---- Tables ---- */
.table-container { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
table th {
    padding: 12px 16px; text-align: left;
    font-size: 12px; font-weight: 600; text-transform: uppercase;
    color: var(--text-muted); letter-spacing: 0.5px;
    border-bottom: 2px solid var(--border-color);
    background: #f8f9fb;
}
table td {
    padding: 14px 16px; font-size: 14px;
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
    color: var(--text-primary);
}
table tbody tr { transition: var(--transition); }
table tbody tr:hover { background: #f5f6f8; }
table .text-right { text-align: right; }
table .text-center { text-align: center; }
.table-actions { display: flex; gap: 6px; }

/* ---- Forms ---- */
.form-group { margin-bottom: 20px; }
.form-group label {
    display: block; font-size: 13px; font-weight: 600;
    color: var(--text-secondary); margin-bottom: 6px;
}
.form-control {
    width: 100%; padding: 10px 14px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: inherit; font-size: 14px;
    transition: var(--transition);
    outline: none;
}
.form-control:focus { border-color: var(--accent-indigo); box-shadow: 0 0 0 3px rgba(99,102,241,0.12); background: #fff; }
select.form-control { cursor: pointer; }
textarea.form-control { resize: vertical; min-height: 80px; }
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; }
.form-inline { display: flex; gap: 12px; align-items: end; flex-wrap: wrap; }

/* ---- Buttons ---- */
.btn {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 10px 20px;
    border: none; border-radius: var(--radius-sm);
    font-family: inherit; font-size: 14px; font-weight: 600;
    cursor: pointer; transition: var(--transition);
    text-decoration: none;
}
.btn:hover { transform: translateY(-1px); }
.btn-primary { background: var(--gradient-indigo); color: #fff; }
.btn-primary:hover { box-shadow: 0 4px 15px rgba(99,102,241,0.3); color: #fff; }
.btn-success { background: var(--gradient-green); color: #fff; }
.btn-success:hover { box-shadow: 0 4px 15px rgba(16,185,129,0.3); color: #fff; }
.btn-warning { background: var(--gradient-amber); color: #fff; }
.btn-danger { background: var(--gradient-red); color: #fff; }
.btn-danger:hover { box-shadow: 0 4px 15px rgba(239,68,68,0.3); color: #fff; }
.btn-secondary { background: #fff; color: var(--text-primary); border: 1px solid var(--border-color); }
.btn-secondary:hover { background: #f5f6f8; border-color: #d1d5db; }
.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-icon { padding: 8px; width: 34px; height: 34px; justify-content: center; }

/* ---- Badges ---- */
.badge {
    display: inline-flex; align-items: center;
    padding: 4px 10px; border-radius: 6px;
    font-size: 12px; font-weight: 600;
}
.badge-success { background: rgba(16,185,129,0.10); color: #059669; }
.badge-danger { background: rgba(239,68,68,0.10); color: #dc2626; }
.badge-warning { background: rgba(245,158,11,0.10); color: #d97706; }
.badge-info { background: rgba(99,102,241,0.10); color: #4f46e5; }

/* ---- Filter Bar ---- */
.filter-bar {
    display: flex; align-items: center; gap: 12px;
    margin-bottom: 24px; flex-wrap: wrap;
}
.filter-bar .form-control { max-width: 200px; padding: 8px 12px; font-size: 13px; }
.search-box { position: relative; flex: 1; max-width: 320px; }
.search-box input { padding-left: 38px; }
.search-box::before {
    content: '🔍'; position: absolute; left: 12px; top: 50%;
    transform: translateY(-50%); font-size: 14px;
}

/* ---- Empty State ---- */
.empty-state {
    text-align: center; padding: 60px 20px;
    color: var(--text-muted);
}
.empty-icon { font-size: 64px; margin-bottom: 16px; opacity: 0.5; }
.empty-state h3 { font-size: 18px; color: var(--text-secondary); margin-bottom: 8px; }
.empty-state p { margin-bottom: 20px; }

/* ---- Pagination ---- */
.pagination { display: flex; gap: 4px; justify-content: center; margin-top: 24px; }
.page-btn {
    padding: 8px 14px; border-radius: 8px;
    background: #fff; border: 1px solid var(--border-color);
    color: var(--text-secondary); font-size: 13px; font-weight: 500;
    transition: var(--transition); cursor: pointer; text-decoration: none;
}
.page-btn:hover, .page-btn.active {
    background: var(--accent-indigo); color: #fff; border-color: var(--accent-indigo);
}

/* ---- Toast / Flash ---- */
.flash-message {
    position: fixed; top: 20px; right: 20px;
    padding: 14px 24px; border-radius: var(--radius-sm);
    font-size: 14px; font-weight: 500; z-index: 9999;
    animation: slideIn 0.3s ease, fadeOut 0.3s ease 3.5s forwards;
    box-shadow: var(--shadow-lg);
}
.flash-success { background: var(--accent-green); color: #fff; }
.flash-error { background: var(--accent-red); color: #fff; }
.flash-warning { background: var(--accent-amber); color: #fff; }

@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
@keyframes fadeOut { to { opacity: 0; transform: translateY(-10px); } }

/* ---- Invoice Items Table ---- */
.invoice-items-table { width: 100%; margin-bottom: 16px; }
.invoice-items-table th { font-size: 12px; padding: 8px; }
.invoice-items-table td { padding: 6px 8px; }
.invoice-items-table .form-control { padding: 8px; font-size: 13px; }
.add-item-btn { margin-top: 8px; }
.remove-item { color: var(--accent-red); cursor: pointer; background: none; border: none; font-size: 18px; }

.invoice-totals {
    margin-top: 16px; padding-top: 16px;
    border-top: 1px solid var(--border-color);
    display: flex; flex-direction: column; align-items: flex-end; gap: 8px;
}
.invoice-totals .total-row { display: flex; gap: 20px; font-size: 14px; }
.invoice-totals .total-row.grand { font-size: 18px; font-weight: 700; color: var(--accent-indigo); }

/* ---- Charts ---- */
.chart-container { position: relative; height: 300px; }

/* ---- Responsive ---- */
@media (max-width: 1024px) {
    .grid-2, .grid-3 { grid-template-columns: 1fr; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .main-content { margin-left: 0; }
    .menu-toggle { display: block; }
    .content-area { padding: 20px 16px; }
    .stats-grid { grid-template-columns: 1fr; }
    .filter-bar { flex-direction: column; align-items: stretch; }
    .filter-bar .form-control { max-width: 100%; }
    .search-box { max-width: 100%; }
    .form-row { grid-template-columns: 1fr; }
}

/* ---- Sidebar overlay on mobile ---- */
.sidebar-overlay {
    display: none; position: fixed; inset: 0;
    background: rgba(0,0,0,0.3); z-index: 99;
}
.sidebar-overlay.show { display: block; }

/* ---- Page Header ---- */
.page-header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 24px; flex-wrap: wrap; gap: 12px;
}
.page-header h2 { font-size: 22px; font-weight: 700; color: var(--text-primary); }

/* ---- Misc ---- */
.text-green { color: #059669; }
.text-red { color: #dc2626; }
.text-amber { color: #d97706; }
.text-indigo { color: #4f46e5; }
.text-muted { color: var(--text-muted); }
.fw-bold { font-weight: 700; }
.mb-0 { margin-bottom: 0; }
.mt-20 { margin-top: 20px; }
.d-flex { display: flex; }
.gap-12 { gap: 12px; }
.justify-between { justify-content: space-between; }
.align-center { align-items: center; }

/* ---- Table Responsive ---- */
.table-responsive { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.data-table { width: 100%; border-collapse: collapse; }
.data-table th {
    padding: 12px 16px; text-align: left;
    font-size: 12px; font-weight: 600; text-transform: uppercase;
    color: var(--text-muted); letter-spacing: 0.5px;
    border-bottom: 2px solid var(--border-color);
    background: #f8f9fb; white-space: nowrap;
}
.data-table td {
    padding: 14px 16px; font-size: 14px;
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
    color: var(--text-primary);
}
.data-table tbody tr { transition: var(--transition); }
.data-table tbody tr:hover { background: #f5f6f8; }
.data-table tfoot td { padding: 14px 16px; font-size: 14px; }

/* ---- Link Style ---- */
.link { color: var(--accent-indigo); font-weight: 500; text-decoration: none; }
.link:hover { color: #4f46e5; text-decoration: underline; }

/* ---- Settings Grid Responsive ---- */
@media (max-width: 768px) {
    .settings-grid { grid-template-columns: 1fr !important; }
    .settings-grid .card[style*="grid-column"] { grid-column: auto !important; }
}
