/*
 * Hisab Multi-Seller Order & Accounting System
 * Modern Green + White Theme Stylesheet
 * 100% Mobile Responsive Optimization
 */

:root {
    --primary-color: #059669;
    --primary-hover: #047857;
    --primary-light: #d1fae5;
    --accent-color: #10b981;
    --bg-body: #f4f6f8;
    --bg-card: #ffffff;
    --text-main: #1f2937;
    --text-muted: #6b7280;
    --border-color: #e5e7eb;
    --sidebar-bg: #064e3b;
    --sidebar-text: #ecfdf5;
    --sidebar-hover: #047857;
    --header-bg: rgba(255, 255, 255, 0.95);
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.05);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
    --shadow-lg: 0 10px 25px rgba(5,150,105,0.12);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 18px;
}

body.dark-mode {
    --bg-body: #0f172a;
    --bg-card: #1e293b;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --border-color: #334155;
    --header-bg: rgba(30, 41, 59, 0.95);
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.3);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.4);
}

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background-color: var(--bg-body);
    color: var(--text-main);
    transition: background-color 0.3s ease, color 0.3s ease;
    overflow-x: hidden;
    margin: 0;
    padding: 0;
}

/* Emerald Button Helper Class */
.btn-emerald {
    background-color: #059669 !important;
    color: #ffffff !important;
    border: none;
    font-weight: 500;
}

.btn-emerald:hover {
    background-color: #047857 !important;
    color: #ffffff !important;
}

/* Glassmorphism Header */
.top-header {
    background: var(--header-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 1020;
    height: 65px;
    display: flex;
    align-items: center;
    padding: 0 1.25rem;
}

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

.sidebar {
    width: 260px;
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    flex-shrink: 0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1040;
    display: flex;
    flex-direction: column;
}

.sidebar-brand {
    padding: 1.25rem 1.5rem;
    font-size: 1.25rem;
    font-weight: 700;
    color: #ffffff;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar-menu {
    list-style: none;
    padding: 1rem 0;
    margin: 0;
    flex-grow: 1;
    overflow-y: auto;
}

.sidebar-item {
    margin: 0.25rem 0.75rem;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 0.75rem 1rem;
    color: #d1fae5;
    text-decoration: none;
    font-weight: 500;
    border-radius: var(--radius-sm);
    transition: all 0.2s ease;
}

.sidebar-link:hover, .sidebar-link.active {
    background: var(--sidebar-hover);
    color: #ffffff;
    transform: translateX(4px);
}

.sidebar-link i {
    font-size: 1.2rem;
}

.main-content {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    width: calc(100% - 260px);
    min-width: 0;
}

.page-body {
    padding: 1.5rem;
    flex-grow: 1;
}

/* Stat Cards */
.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1.25rem;
    box-shadow: var(--shadow-sm);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: var(--primary-color);
}

.stat-icon {
    width: 46px;
    height: 46px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    background: var(--primary-light);
    color: var(--primary-color);
}

.stat-value {
    font-size: 1.6rem;
    font-weight: 700;
    margin-top: 0.5rem;
}

/* Modern Cards & Responsive Tables */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    margin-bottom: 1.25rem;
}

.card-header {
    background: transparent;
    border-bottom: 1px solid var(--border-color);
    padding: 1rem 1.25rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.table-custom {
    margin-bottom: 0;
    color: var(--text-main);
    white-space: nowrap;
}

.table-custom th {
    background: rgba(0,0,0,0.02);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border-color);
    padding: 0.85rem 1rem;
}

.table-custom td {
    padding: 0.85rem 1rem;
    vertical-align: middle;
    border-bottom: 1px solid var(--border-color);
}

/* Mobile Responsiveness Rules (320px - 991px) */
@media (max-width: 991.98px) {
    .sidebar {
        position: fixed;
        left: -270px;
        top: 0;
        bottom: 0;
        box-shadow: 5px 0 25px rgba(0,0,0,0.3);
    }
    .sidebar.show {
        left: 0;
    }
    .main-content {
        width: 100% !important;
    }
    .page-body {
        padding: 1rem;
    }
    .top-header {
        padding: 0 1rem;
    }
}

@media (max-width: 575.98px) {
    .stat-card {
        padding: 1rem;
    }
    .stat-value {
        font-size: 1.35rem;
    }
    .btn-group {
        flex-direction: column;
        width: 100%;
    }
    .btn-group .btn {
        border-radius: var(--radius-sm) !important;
        margin-bottom: 2px;
    }
    .modal-dialog {
        margin: 0.5rem;
    }
}
