/* SonicPesa - Professional Business App with Material Symbols */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --sidebar-bg: #1a1f2e;
    --main-bg: #252836;
    --card-bg: #1a1f2e;
    --accent: #6366f1;
    --accent-dark: #4f46e5;
    --success: #22c55e;
    --danger: #ef4444;
    --warning: #f59e0b;
    --white: #ffffff;
    --text-muted: #6b7280;
    --text-light: #9ca3af;
    --border: #374151;
}

body {
    font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, Roboto, sans-serif;
    color: var(--white);
    background-color: var(--main-bg);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
    max-width: 100vw;
}

/* Material Symbols */
.material-symbols-rounded {
    font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;
}

/* App Layout */
.app-layout {
    display: flex;
    min-height: 100vh;
}

/* Mobile Menu Button */
.mobile-menu-btn {
    display: none;
    position: fixed;
    top: 16px;
    left: 16px;
    z-index: 1001;
    width: 48px;
    height: 48px;
    border-radius: 12px;
    background-color: var(--accent);
    color: var(--white);
    border: none;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

/* Mobile Overlay */
.mobile-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 998;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.mobile-overlay.open {
    opacity: 1;
    pointer-events: all;
}

/* Sidebar */
.sidebar {
    width: 260px;
    background-color: var(--sidebar-bg);
    padding: 24px 16px;
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    left: 0;
    top: 0;
    z-index: 999;
    transition: transform 0.3s ease;
}

.sidebar-header-mobile {
    display: none;
    justify-content: flex-end;
    margin-bottom: 16px;
}

.close-mobile-menu {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background-color: rgba(255, 255, 255, 0.1);
    color: var(--white);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 48px;
    padding: 0 8px;
}

.sidebar-logo-icon {
    width: 44px;
    height: 44px;
    background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sidebar-logo-icon span {
    color: var(--sidebar-bg);
    font-size: 22px;
    font-weight: bold;
}

.sidebar-logo-text {
    font-size: 20px;
    font-weight: 700;
    color: var(--white);
}

/* Navigation Menu */
.nav-menu {
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 1;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    border-radius: 10px;
    color: var(--text-light);
    text-decoration: none;
    transition: all 0.2s;
    font-weight: 500;
    font-size: 14px;
}

.nav-item:hover {
    background-color: rgba(255, 255, 255, 0.05);
    color: var(--white);
}

.nav-item.active {
    background-color: var(--accent);
    color: var(--white);
}

.nav-icon {
    font-size: 22px;
}

.nav-divider {
    height: 1px;
    background-color: var(--border);
    margin: 16px 0;
}

/* Sidebar Bottom */
.sidebar-bottom {
    margin-top: auto;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

.logout-btn {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    border-radius: 10px;
    color: var(--text-light);
    background: none;
    border: none;
    cursor: pointer;
    width: 100%;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
}

.logout-btn:hover {
    background-color: rgba(239, 68, 68, 0.1);
    color: var(--danger);
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: 260px;
    padding: 32px;
}

/* Page Header */
.page-header {
    background: linear-gradient(135deg, #4f46e5 0%, #6366f1 50%, #818cf8 100%);
    padding: 32px;
    border-radius: 16px;
    margin-bottom: 32px;
}

.header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.header-title {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.8);
    font-weight: 500;
}

.header-balance {
    font-size: 36px;
    font-weight: 700;
    color: var(--white);
}

/* Balance Cards Grid */
.balance-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-bottom: 24px;
}

.balance-card {
    background-color: var(--card-bg);
    border-radius: 16px;
    padding: 24px;
}

.balance-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.balance-card-label {
    font-size: 13px;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.balance-card-value {
    font-size: 26px;
    font-weight: 700;
    color: var(--white);
}

/* Income & Expenses Grid */
.income-expense-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    margin-bottom: 32px;
}

.section-card {
    background-color: var(--card-bg);
    border-radius: 16px;
    padding: 24px;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.section-label {
    font-size: 13px;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.section-icon {
    width: 52px;
    height: 52px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
}

.section-icon.income {
    background-color: rgba(34, 197, 94, 0.15);
    color: var(--success);
}

.section-icon.expense {
    background-color: rgba(239, 68, 68, 0.15);
    color: var(--danger);
}

.section-value {
    font-size: 34px;
    font-weight: 700;
}

.section-value.income {
    color: var(--success);
}

.section-value.expense {
    color: var(--danger);
}

.section-subvalue {
    font-size: 14px;
    color: var(--text-muted);
    margin-top: 8px;
}

/* Buttons */
.btn {
    padding: 12px 24px;
    border-radius: 10px;
    border: none;
    cursor: pointer;
    font-weight: 600;
    font-size: 14px;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s;
}

.btn-primary {
    background-color: var(--accent);
    color: var(--white);
}

.btn-primary:hover {
    background-color: var(--accent-dark);
}

.btn-secondary {
    background-color: rgba(255, 255, 255, 0.1);
    color: var(--white);
}

.btn-secondary:hover {
    background-color: rgba(255, 255, 255, 0.15);
}

.btn-success {
    background-color: var(--success);
    color: var(--white);
}

.btn-danger {
    background-color: var(--danger);
    color: var(--white);
}

/* Action Buttons */
.action-buttons {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 32px;
}

/* Login Page */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1a1f2e 0%, #252836 50%, #1a1f2e 100%);
    padding: 16px;
}

.login-card {
    background-color: var(--card-bg);
    border-radius: 20px;
    padding: 40px 32px;
    width: 100%;
    max-width: 440px;
    border: 1px solid var(--border);
}

.login-header {
    text-align: center;
    margin-bottom: 32px;
}

.login-logo {
    width: 64px;
    height: 64px;
    margin: 0 auto 16px;
    background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-logo span {
    color: var(--sidebar-bg);
    font-size: 32px;
    font-weight: bold;
}

.login-title {
    font-size: 24px;
    font-weight: 700;
    color: var(--white);
    margin-bottom: 6px;
}

.login-subtitle {
    font-size: 14px;
    color: var(--text-muted);
}

/* Forms */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-size: 14px;
    color: var(--text-light);
    margin-bottom: 8px;
    font-weight: 500;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 14px 16px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background-color: var(--main-bg);
    color: var(--white);
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.2s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--accent);
}

.form-group input::placeholder {
    color: var(--text-muted);
}

.form-group textarea {
    resize: vertical;
    min-height: 100px;
}

/* Tables */
.table-container {
    background-color: var(--card-bg);
    border-radius: 16px;
    overflow: hidden;
}

.table-container table {
    width: 100%;
    border-collapse: collapse;
    min-width: 500px;
}

@media (max-width: 640px) {
    .table-container {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .table-container table {
        min-width: 100%;
    }
}

.table-container th {
    padding: 16px;
    text-align: left;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background-color: rgba(0, 0, 0, 0.2);
    border-bottom: 1px solid var(--border);
}

.table-container td {
    padding: 16px;
    font-size: 14px;
    color: var(--text-light);
    border-bottom: 1px solid var(--border);
}

.table-container tr:last-child td {
    border-bottom: none;
}

.table-container tr:hover td {
    background-color: rgba(255, 255, 255, 0.02);
}

/* Badges */
.badge {
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}

.badge-primary {
    background-color: rgba(99, 102, 241, 0.2);
    color: #a5b4fc;
}

/* Alerts */
.alert {
    padding: 16px;
    border-radius: 12px;
    margin-bottom: 20px;
}

.alert-danger {
    background-color: rgba(239, 68, 68, 0.1);
    color: #fca5a5;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.alert-success {
    background-color: rgba(34, 197, 94, 0.1);
    color: #86efac;
    border: 1px solid rgba(34, 197, 94, 0.3);
}

/* Cards */
.card {
    background-color: var(--card-bg);
    border-radius: 16px;
    padding: 24px;
    margin-bottom: 24px;
    overflow-x: auto;
}

.card-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--white);
}

/* User Info */
.user-name {
    font-size: 14px;
    font-weight: 500;
    color: var(--white);
}

.user-role {
    font-size: 12px;
    color: var(--text-muted);
}

/* Utility Classes */
.flex {
    display: flex;
}

.items-center {
    align-items: center;
}

.justify-between {
    justify-content: space-between;
}

.gap-2 {
    gap: 8px;
}

.gap-3 {
    gap: 12px;
}

.mt-4 {
    margin-top: 16px;
}

.mb-4 {
    margin-bottom: 16px;
}

.font-medium {
    font-weight: 500;
}

.font-bold {
    font-weight: 700;
}

.text-center {
    text-align: center;
}

.text-white {
    color: var(--white) !important;
}

/* Responsive - Mobile */
@media (max-width: 1024px) {
    .mobile-menu-btn {
        display: flex;
    }
    
    .sidebar {
        transform: translateX(-100%);
    }
    
    .sidebar.open {
        transform: translateX(0);
    }
    
    .sidebar-header-mobile {
        display: flex;
    }
    
    .main-content {
        margin-left: 0;
        padding: 32px 16px;
        padding-top: 80px;
    }
    
    .page-header {
        padding: 24px;
        border-radius: 12px;
    }
    
    .header-balance {
        font-size: 28px;
    }
    
    .balance-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }
    
    .income-expense-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    
    .card {
        padding: 20px;
        border-radius: 12px;
    }
    
    .section-value {
        font-size: 28px;
    }
}

@media (max-width: 640px) {
    .main-content {
        padding: 16px;
        padding-top: 72px;
    }
    
    .balance-grid {
        grid-template-columns: 1fr;
    }
    
    .login-card {
        padding: 32px 24px;
        border-radius: 16px;
    }
    
    .section-value {
        font-size: 24px;
    }
    
    .table-container {
        border-radius: 12px;
    }
    
    .table-container th,
    .table-container td {
        padding: 12px;
    }
}
