/* ============================================
   BillBharat - GST Invoicing App Styles
   Indian Business Aesthetic: Green & Orange
   ============================================ */

:root {
    /* Primary Colors - Indian Business Palette */
    --color-primary: #138808;          /* India Green */
    --color-primary-dark: #0d6b06;
    --color-primary-light: #e8f5e9;
    --color-secondary: #FF9933;        /* Saffron/Orange */
    --color-secondary-dark: #e8850a;
    --color-secondary-light: #fff3e0;
    
    /* Neutral Colors */
    --color-bg: #fafafa;
    --color-surface: #ffffff;
    --color-surface-elevated: #ffffff;
    --color-border: #e5e7eb;
    --color-border-light: #f3f4f6;
    
    /* Text Colors */
    --color-text: #1f2937;
    --color-text-secondary: #6b7280;
    --color-text-muted: #9ca3af;
    --color-text-inverse: #ffffff;
    
    /* Status Colors */
    --color-success: #138808;
    --color-warning: #FF9933;
    --color-danger: #dc2626;
    --color-info: #2563eb;
    
    /* Status Backgrounds */
    --color-success-bg: #dcfce7;
    --color-warning-bg: #ffedd5;
    --color-danger-bg: #fee2e2;
    --color-info-bg: #dbeafe;
    
    /* Typography */
    --font-display: 'Plus Jakarta Sans', 'Noto Sans Devanagari', sans-serif;
    --font-body: 'Plus Jakarta Sans', 'Noto Sans Devanagari', sans-serif;
    
    /* Spacing */
    --space-xs: 0.25rem;
    --space-sm: 0.5rem;
    --space-md: 1rem;
    --space-lg: 1.5rem;
    --space-xl: 2rem;
    --space-2xl: 3rem;
    
    /* Border Radius */
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    --radius-full: 9999px;
    
    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    
    /* Transitions */
    --transition-fast: 150ms ease;
    --transition-base: 250ms ease;
    --transition-slow: 350ms ease;
    
    /* Sidebar */
    --sidebar-width: 280px;
    --sidebar-collapsed: 70px;
}

/* Reset & Base */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-body);
    font-size: 0.875rem;
    line-height: 1.5;
    color: var(--color-text);
    background: var(--color-bg);
    min-height: 100vh;
}

/* Hindi Text Styling */
.hindi {
    font-family: 'Noto Sans Devanagari', var(--font-body);
    opacity: 0.85;
    font-weight: 400;
}

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

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background: var(--color-surface);
    border-right: 1px solid var(--color-border);
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    z-index: 100;
    transition: width var(--transition-base);
}

.sidebar-header {
    padding: var(--space-lg);
    border-bottom: 1px solid var(--color-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.logo-icon {
    font-size: 1.5rem;
}

.logo-text {
    display: flex;
    flex-direction: column;
}

.logo-main {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--color-primary);
    line-height: 1.2;
}

.logo-tagline {
    font-size: 0.75rem;
    color: var(--color-text-muted);
    font-family: 'Noto Sans Devanagari', sans-serif;
}

.menu-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--color-text);
    cursor: pointer;
    padding: var(--space-sm);
}

.nav-section {
    padding: var(--space-md) 0;
}

.nav-section + .nav-section {
    border-top: 1px solid var(--color-border-light);
}

.nav-label {
    display: block;
    padding: 0 var(--space-lg);
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-text-muted);
    margin-bottom: var(--space-sm);
}

.nav-links {
    list-style: none;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-sm) var(--space-lg);
    color: var(--color-text-secondary);
    text-decoration: none;
    transition: all var(--transition-fast);
    border-left: 3px solid transparent;
}

.nav-link:hover {
    background: var(--color-primary-light);
    color: var(--color-primary);
}

.nav-link.active {
    background: var(--color-primary-light);
    color: var(--color-primary);
    border-left-color: var(--color-primary);
    font-weight: 500;
}

.nav-link svg {
    flex-shrink: 0;
}

.sidebar-footer {
    margin-top: auto;
    padding: var(--space-lg);
    border-top: 1px solid var(--color-border);
}

.business-info {
    display: flex;
    align-items: center;
    gap: var(--space-md);
}

.business-avatar {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-full);
    background: linear-gradient(135deg, var(--color-primary), var(--color-secondary));
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 1rem;
}

.business-details {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.business-name {
    font-weight: 600;
    font-size: 0.875rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.business-gstin {
    font-size: 0.75rem;
    color: var(--color-text-muted);
}

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

/* Page Structure */
.page {
    display: none;
    animation: fadeIn 0.3s ease;
}

.page.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: var(--space-xl);
    flex-wrap: wrap;
    gap: var(--space-md);
}

.page-title {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--color-text);
    margin-bottom: var(--space-xs);
}

.page-subtitle {
    color: var(--color-text-secondary);
    font-size: 0.9375rem;
}

.header-actions {
    display: flex;
    gap: var(--space-sm);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-md);
    font-family: var(--font-body);
    font-size: 0.875rem;
    font-weight: 500;
    border-radius: var(--radius-md);
    border: none;
    cursor: pointer;
    transition: all var(--transition-fast);
    text-decoration: none;
}

.btn-primary {
    background: var(--color-primary);
    color: white;
}

.btn-primary:hover {
    background: var(--color-primary-dark);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-secondary {
    background: white;
    color: var(--color-text);
    border: 1px solid var(--color-border);
}

.btn-secondary:hover {
    background: var(--color-bg);
    border-color: var(--color-text-muted);
}

.btn-danger {
    background: var(--color-danger);
    color: white;
}

.btn-danger:hover {
    background: #b91c1c;
}

.btn-sm {
    padding: var(--space-xs) var(--space-sm);
    font-size: 0.8125rem;
}

.btn-lg {
    padding: var(--space-md) var(--space-xl);
    font-size: 1rem;
}

.btn-icon {
    padding: var(--space-sm);
}

/* Dashboard Grid */
.dashboard-grid {
    display: flex;
    flex-direction: column;
    gap: var(--space-xl);
}

.stats-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--space-lg);
}

.stat-card {
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    display: flex;
    align-items: flex-start;
    gap: var(--space-md);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--color-border);
    transition: all var(--transition-fast);
}

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

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
}

.stat-icon.revenue {
    background: var(--color-primary-light);
    color: var(--color-primary);
}

.stat-icon.pending {
    background: var(--color-warning-bg);
    color: var(--color-secondary-dark);
}

.stat-icon.tax {
    background: var(--color-info-bg);
    color: var(--color-info);
}

.stat-icon.invoices {
    background: #f3e8ff;
    color: #7c3aed;
}

.stat-content {
    flex: 1;
}

.stat-label {
    display: block;
    font-size: 0.8125rem;
    color: var(--color-text-secondary);
    margin-bottom: var(--space-xs);
}

.stat-value {
    display: block;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--color-text);
    margin-bottom: var(--space-xs);
}

.stat-change {
    font-size: 0.75rem;
    font-weight: 500;
    padding: var(--space-xs) var(--space-sm);
    border-radius: var(--radius-full);
}

.stat-change.positive {
    background: var(--color-success-bg);
    color: var(--color-success);
}

.stat-change.negative {
    background: var(--color-danger-bg);
    color: var(--color-danger);
}

.stat-sublabel {
    font-size: 0.75rem;
    color: var(--color-text-muted);
}

/* Charts */
.charts-row {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: var(--space-lg);
}

.chart-card {
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--color-border);
}

.chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-lg);
}

.chart-header h3 {
    font-size: 1rem;
    font-weight: 600;
}

.chart-filters {
    display: flex;
    gap: var(--space-xs);
}

.filter-btn {
    padding: var(--space-xs) var(--space-sm);
    font-size: 0.75rem;
    border: 1px solid var(--color-border);
    background: white;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.filter-btn.active,
.filter-btn:hover {
    background: var(--color-primary);
    color: white;
    border-color: var(--color-primary);
}

.chart-container {
    height: 250px;
    position: relative;
}

.chart-container canvas {
    width: 100% !important;
    height: 100% !important;
}

/* Activity Section */
.activity-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-lg);
}

.activity-card {
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--color-border);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-lg);
}

.card-header h3 {
    font-size: 1rem;
    font-weight: 600;
}

.view-all {
    color: var(--color-primary);
    text-decoration: none;
    font-size: 0.8125rem;
    font-weight: 500;
}

.view-all:hover {
    text-decoration: underline;
}

/* Invoice List */
.invoice-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.invoice-list-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-md);
    background: var(--color-bg);
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
}

.invoice-list-item:hover {
    background: var(--color-primary-light);
}

.invoice-list-info {
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
}

.invoice-list-id {
    font-weight: 600;
    font-size: 0.875rem;
}

.invoice-list-customer {
    font-size: 0.8125rem;
    color: var(--color-text-secondary);
}

.invoice-list-amount {
    font-weight: 600;
    text-align: right;
}

.invoice-list-date {
    font-size: 0.75rem;
    color: var(--color-text-muted);
}

/* Customer List */
.customer-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}

.customer-list-item {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-md);
    background: var(--color-bg);
    border-radius: var(--radius-md);
}

.customer-avatar {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-full);
    background: linear-gradient(135deg, var(--color-secondary), #ff6b35);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 0.875rem;
}

.customer-info {
    flex: 1;
}

.customer-name {
    font-weight: 600;
    font-size: 0.875rem;
}

.customer-revenue {
    font-size: 0.8125rem;
    color: var(--color-text-secondary);
}

.customer-rank {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--color-primary);
    opacity: 0.3;
}

/* Filters Bar */
.filters-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-lg);
    flex-wrap: wrap;
    gap: var(--space-md);
}

.search-box {
    position: relative;
    flex: 1;
    max-width: 400px;
}

.search-box svg {
    position: absolute;
    left: var(--space-md);
    top: 50%;
    transform: translateY(-50%);
    color: var(--color-text-muted);
}

.search-box input {
    width: 100%;
    padding: var(--space-sm) var(--space-md) var(--space-sm) 2.5rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    font-family: var(--font-body);
    font-size: 0.875rem;
    transition: all var(--transition-fast);
}

.search-box input:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(19, 136, 8, 0.1);
}

.filter-group {
    display: flex;
    gap: var(--space-sm);
}

.filter-select {
    padding: var(--space-sm) var(--space-md);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    font-family: var(--font-body);
    font-size: 0.875rem;
    background: white;
    cursor: pointer;
    min-width: 150px;
}

/* Data Table */
.table-container {
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    border: 1px solid var(--color-border);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th,
.data-table td {
    padding: var(--space-md) var(--space-lg);
    text-align: left;
    font-size: 0.875rem;
}

.data-table th {
    background: var(--color-bg);
    font-weight: 600;
    color: var(--color-text-secondary);
    text-transform: uppercase;
    font-size: 0.6875rem;
    letter-spacing: 0.05em;
}

.data-table tbody tr {
    border-top: 1px solid var(--color-border-light);
    transition: background var(--transition-fast);
}

.data-table tbody tr:hover {
    background: var(--color-bg);
}

.data-table td {
    color: var(--color-text);
}

/* Status Badges */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: var(--space-xs);
    padding: var(--space-xs) var(--space-sm);
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 500;
}

.status-badge::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
}

.status-paid {
    background: var(--color-success-bg);
    color: var(--color-success);
}

.status-paid::before {
    background: var(--color-success);
}

.status-pending {
    background: var(--color-warning-bg);
    color: var(--color-secondary-dark);
}

.status-pending::before {
    background: var(--color-secondary);
}

.status-overdue {
    background: var(--color-danger-bg);
    color: var(--color-danger);
}

.status-overdue::before {
    background: var(--color-danger);
}

.status-partial {
    background: var(--color-info-bg);
    color: var(--color-info);
}

.status-partial::before {
    background: var(--color-info);
}

/* Action Buttons */
.actions {
    display: flex;
    gap: var(--space-xs);
}

.action-btn {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-md);
    border: none;
    background: transparent;
    color: var(--color-text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
}

.action-btn:hover {
    background: var(--color-bg);
    color: var(--color-primary);
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: var(--space-lg);
    overflow-y: auto;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--color-surface);
    border-radius: var(--radius-xl);
    width: 100%;
    max-width: 600px;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    animation: modalSlideIn 0.3s ease;
}

.modal-xl {
    max-width: 1000px;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-lg);
    border-bottom: 1px solid var(--color-border);
}

.modal-header h2 {
    font-size: 1.25rem;
    font-weight: 600;
}

.modal-close {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-full);
    border: none;
    background: transparent;
    color: var(--color-text-secondary);
    font-size: 1.5rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
}

.modal-close:hover {
    background: var(--color-bg);
    color: var(--color-text);
}

.modal-body {
    flex: 1;
    overflow-y: auto;
    padding: var(--space-lg);
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: var(--space-sm);
    padding: var(--space-lg);
    border-top: 1px solid var(--color-border);
}

/* Invoice Builder */
.invoice-builder {
    display: flex;
    flex-direction: column;
    gap: var(--space-xl);
}

.builder-section {
    padding-bottom: var(--space-lg);
    border-bottom: 1px solid var(--color-border-light);
}

.builder-section:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.builder-section h3 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: var(--space-md);
    color: var(--color-text);
}

.invoice-header-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--space-md);
}

.customer-search {
    display: flex;
    gap: var(--space-sm);
    margin-bottom: var(--space-md);
}

.customer-search .search-box {
    flex: 1;
    max-width: none;
}

.customer-details-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-md);
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
}

.form-group-full {
    grid-column: span 2;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-md);
}

.form-group label {
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--color-text-secondary);
}

.form-group input,
.form-group select,
.form-group textarea {
    padding: var(--space-sm) var(--space-md);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    font-family: var(--font-body);
    font-size: 0.875rem;
    transition: all var(--transition-fast);
    background: white;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(19, 136, 8, 0.1);
}

.form-group input:read-only {
    background: var(--color-bg);
    color: var(--color-text-muted);
}

.radio-group {
    display: flex;
    gap: var(--space-md);
}

.radio-label {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    cursor: pointer;
    font-size: 0.875rem;
}

.radio-label input[type="radio"] {
    width: 18px;
    height: 18px;
    accent-color: var(--color-primary);
}

/* Line Items Table */
.line-items-table {
    overflow-x: auto;
}

.line-items-table table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8125rem;
}

.line-items-table th {
    background: var(--color-bg);
    padding: var(--space-sm);
    text-align: left;
    font-weight: 600;
    color: var(--color-text-secondary);
    white-space: nowrap;
}

.line-items-table td {
    padding: var(--space-sm);
    border-bottom: 1px solid var(--color-border-light);
}

.line-items-table input,
.line-items-table select {
    width: 100%;
    padding: var(--space-xs) var(--space-sm);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    font-size: 0.8125rem;
}

.line-items-table input:focus,
.line-items-table select:focus {
    outline: none;
    border-color: var(--color-primary);
}

.line-item-number {
    color: var(--color-text-muted);
    font-weight: 500;
}

.btn-remove-item {
    width: 28px;
    height: 28px;
    border-radius: var(--radius-sm);
    border: none;
    background: var(--color-danger-bg);
    color: var(--color-danger);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
}

.btn-remove-item:hover {
    background: var(--color-danger);
    color: white;
}

.btn-add-item {
    margin-top: var(--space-md);
    width: 100%;
    justify-content: center;
}

/* Invoice Summary */
.invoice-summary {
    background: var(--color-bg);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    max-width: 400px;
    margin-left: auto;
}

.summary-row {
    display: flex;
    justify-content: space-between;
    padding: var(--space-sm) 0;
    font-size: 0.875rem;
}

.summary-row:not(:last-child) {
    border-bottom: 1px solid var(--color-border-light);
}

.summary-row.discount-row {
    align-items: center;
}

.summary-row.discount-row input {
    width: 80px;
    padding: var(--space-xs) var(--space-sm);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    text-align: right;
}

.total-row {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--color-text);
    padding-top: var(--space-md);
    margin-top: var(--space-sm);
    border-top: 2px solid var(--color-border);
}

/* Clients Grid */
.clients-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: var(--space-lg);
}

.client-card {
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--color-border);
    transition: all var(--transition-fast);
}

.client-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.client-card-header {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    margin-bottom: var(--space-md);
}

.client-avatar {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-full);
    background: linear-gradient(135deg, var(--color-primary), var(--color-secondary));
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 1.125rem;
}

.client-info h4 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: var(--space-xs);
}

.client-info p {
    font-size: 0.8125rem;
    color: var(--color-text-secondary);
}

.client-stats {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-md);
    margin-bottom: var(--space-md);
    padding: var(--space-md) 0;
    border-top: 1px solid var(--color-border-light);
    border-bottom: 1px solid var(--color-border-light);
}

.client-stat {
    display: flex;
    flex-direction: column;
}

.client-stat-label {
    font-size: 0.75rem;
    color: var(--color-text-muted);
    margin-bottom: var(--space-xs);
}

.client-stat-value {
    font-size: 0.9375rem;
    font-weight: 600;
}

.client-stat-value.due {
    color: var(--color-danger);
}

.client-actions {
    display: flex;
    gap: var(--space-sm);
}

/* Payments Page */
.payments-overview {
    margin-bottom: var(--space-xl);
}

.payment-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-lg);
}

.payment-stat {
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    text-align: center;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--color-border);
}

.payment-label {
    display: block;
    font-size: 0.8125rem;
    color: var(--color-text-secondary);
    margin-bottom: var(--space-sm);
}

.payment-value {
    font-size: 1.5rem;
    font-weight: 700;
}

.payment-value.pending {
    color: var(--color-secondary-dark);
}

.payment-value.partial {
    color: var(--color-info);
}

.payment-value.paid {
    color: var(--color-success);
}

/* Settings Page */
.settings-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-lg);
}

.settings-card {
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--color-border);
    overflow: hidden;
}

.settings-header {
    padding: var(--space-lg);
    border-bottom: 1px solid var(--color-border);
    background: var(--color-bg);
}

.settings-header h3 {
    font-size: 1rem;
    font-weight: 600;
}

.settings-body {
    padding: var(--space-lg);
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}

.logo-upload {
    display: flex;
    align-items: center;
    gap: var(--space-md);
}

.logo-preview {
    width: 80px;
    height: 80px;
    border-radius: var(--radius-md);
    background: var(--color-bg);
    border: 2px dashed var(--color-border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    color: var(--color-text-muted);
    text-align: center;
    overflow: hidden;
}

.logo-preview img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.logo-upload input[type="file"] {
    display: none;
}

/* Template Selection */
.template-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-md);
}

.template-option {
    cursor: pointer;
    text-align: center;
}

.template-option input {
    display: none;
}

.template-preview {
    width: 100%;
    aspect-ratio: 3/4;
    border-radius: var(--radius-md);
    border: 2px solid var(--color-border);
    margin-bottom: var(--space-sm);
    overflow: hidden;
    transition: all var(--transition-fast);
}

.template-preview.classic .template-header {
    height: 30%;
    background: var(--color-primary);
}

.template-preview.modern .template-header {
    height: 25%;
    background: linear-gradient(135deg, var(--color-primary), var(--color-secondary));
}

.template-preview.minimal .template-header {
    height: 20%;
    background: var(--color-text);
}

.template-preview .template-body {
    height: 70%;
    background: white;
}

.template-option input:checked + .template-preview {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(19, 136, 8, 0.2);
}

.template-option span {
    font-size: 0.8125rem;
    color: var(--color-text-secondary);
}

.template-option input:checked ~ span {
    color: var(--color-primary);
    font-weight: 500;
}

.settings-actions {
    margin-top: var(--space-xl);
    display: flex;
    justify-content: center;
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    bottom: var(--space-lg);
    right: var(--space-lg);
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.toast {
    background: var(--color-surface);
    border-radius: var(--radius-md);
    padding: var(--space-md) var(--space-lg);
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: var(--space-md);
    animation: toastSlideIn 0.3s ease;
    min-width: 300px;
}

.toast.success {
    border-left: 4px solid var(--color-success);
}

.toast.error {
    border-left: 4px solid var(--color-danger);
}

.toast.warning {
    border-left: 4px solid var(--color-warning);
}

@keyframes toastSlideIn {
    from {
        opacity: 0;
        transform: translateX(100%);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.toast-icon {
    width: 24px;
    height: 24px;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
}

.toast.success .toast-icon {
    background: var(--color-success-bg);
    color: var(--color-success);
}

.toast.error .toast-icon {
    background: var(--color-danger-bg);
    color: var(--color-danger);
}

.toast-message {
    flex: 1;
    font-size: 0.875rem;
}

.toast-close {
    background: none;
    border: none;
    color: var(--color-text-muted);
    cursor: pointer;
    font-size: 1.25rem;
    line-height: 1;
}

/* Payment Modal */
.payment-form {
    display: flex;
    flex-direction: column;
    gap: var(--space-lg);
}

.payment-invoice-info {
    background: var(--color-bg);
    border-radius: var(--radius-md);
    padding: var(--space-md);
}

.payment-invoice-info p {
    display: flex;
    justify-content: space-between;
    margin-bottom: var(--space-xs);
}

.payment-invoice-info p:last-child {
    margin-bottom: 0;
    padding-top: var(--space-sm);
    border-top: 1px solid var(--color-border);
    font-weight: 600;
}

/* Responsive Design */
@media (max-width: 1200px) {
    .stats-row {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .charts-row {
        grid-template-columns: 1fr;
    }
    
    .activity-row {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .sidebar {
        width: var(--sidebar-collapsed);
    }
    
    .sidebar .logo-text,
    .sidebar .nav-link span,
    .sidebar .nav-label,
    .sidebar .business-details {
        display: none;
    }
    
    .sidebar-header {
        justify-content: center;
    }
    
    .nav-link {
        justify-content: center;
        padding: var(--space-md);
    }
    
    .nav-link.active {
        border-left: none;
        border-bottom: 3px solid var(--color-primary);
    }
    
    .main-content {
        margin-left: var(--sidebar-collapsed);
        padding: var(--space-md);
    }
    
    .stats-row {
        grid-template-columns: 1fr;
    }
    
    .settings-grid {
        grid-template-columns: 1fr;
    }
    
    .invoice-header-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .customer-details-grid {
        grid-template-columns: 1fr;
    }
    
    .form-group-full {
        grid-column: span 1;
    }
    
    .payment-stats {
        grid-template-columns: 1fr;
    }
    
    .template-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .page-header {
        flex-direction: column;
        align-items: stretch;
    }
    
    .header-actions {
        justify-content: stretch;
    }
    
    .header-actions .btn {
        flex: 1;
    }
    
    .filters-bar {
        flex-direction: column;
        align-items: stretch;
    }
    
    .search-box {
        max-width: none;
    }
    
    .filter-group {
        justify-content: stretch;
    }
    
    .filter-group .filter-select {
        flex: 1;
    }
    
    .data-table {
        font-size: 0.75rem;
    }
    
    .data-table th,
    .data-table td {
        padding: var(--space-sm);
    }
    
    .modal-content {
        margin: var(--space-sm);
        max-height: calc(100vh - var(--space-lg));
    }
}

/* Print Styles for Invoice */
@media print {
    .sidebar,
    .page-header,
    .modal-footer,
    .btn {
        display: none !important;
    }
    
    .main-content {
        margin-left: 0;
        padding: 0;
    }
    
    .modal {
        position: static;
        display: block !important;
        background: none;
    }
    
    .modal-content {
        box-shadow: none;
        max-width: 100%;
        max-height: none;
    }
}

/* Animations */
@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

.loading {
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--color-bg);
}

::-webkit-scrollbar-thumb {
    background: var(--color-border);
    border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--color-text-muted);
}

/* Focus Visible */
:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
}

/* Selection */
::selection {
    background: var(--color-primary-light);
    color: var(--color-primary-dark);
}