/* ===================================
   EXPENSE INVOICE GENERATOR - DESIGN SYSTEM
   Bit Apps Professional Styling
   =================================== */

/* === ROOT VARIABLES === */
:root {
    /* Primary Colors */
    --primary-action: #2160FD;
    --primary-hover: #1850E8;
    --primary-light: #E8EFFE;
    
    /* Text Colors */
    --text-header: #0F172A;
    --text-body: #64748B;
    --text-light: #94A3B8;
    
    /* Success & Status */
    --success: #10B981;
    --warning: #F59E0B;
    --error: #EF4444;
    
    /* Backgrounds */
    --bg-white: #FFFFFF;
    --bg-light: #F8FAFC;
    --bg-card: #FFFFFF;
    
    /* Borders & Lines */
    --border-color: #E2E8F0;
    --border-radius: 12px;
    --border-radius-sm: 8px;
    
    /* 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);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    
    /* Spacing */
    --space-xs: 8px;
    --space-sm: 12px;
    --space-md: 16px;
    --space-lg: 24px;
    --space-xl: 32px;
    --space-2xl: 48px;
}

/* === GLOBAL RESET === */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Inter', 'Segoe UI', 'Poppins', sans-serif;
    background: linear-gradient(135deg, #F8FAFC 0%, #E8EFFE 100%);
    color: var(--text-body);
    line-height: 1.6;
    min-height: 100vh;
    padding: 0;
    margin: 0;
}

/* === PROFESSIONAL HEADER === */
.site-header {
    background: linear-gradient(135deg, var(--primary-action) 0%, var(--primary-hover) 100%);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.header-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: var(--space-md) var(--space-xl);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: var(--space-lg);
}

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

.site-logo {
    font-size: 1.8rem;
    font-weight: 700;
    color: white;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    transition: transform 0.2s ease;
}

.site-logo:hover {
    transform: scale(1.02);
}

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

.site-nav {
    display: flex;
    gap: var(--space-xs);
    align-items: center;
}

.nav-link {
    color: white;
    text-decoration: none;
    padding: var(--space-sm) var(--space-lg);
    border-radius: var(--border-radius-sm);
    font-weight: 500;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    font-size: 0.95rem;
}

.nav-link:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: translateY(-1px);
}

.nav-link.active {
    background: rgba(255, 255, 255, 0.25);
    font-weight: 600;
}

/* === USER SECTION === */
.user-section {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    color: white;
}

.user-info {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
}

.username {
    font-weight: 600;
    font-size: 0.95rem;
}

.user-role {
    background: rgba(255, 255, 255, 0.2);
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.user-actions {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.user-action-link {
    color: rgba(255, 255, 255, 0.9);
    text-decoration: none;
    font-size: 0.85rem;
    padding: 4px 8px;
    border-radius: 4px;
    transition: all 0.2s ease;
    text-align: right;
}

.user-action-link:hover {
    background: rgba(255, 255, 255, 0.15);
    color: white;
}

.logout-link {
    font-weight: 600;
}

.main-content {
    padding: var(--space-xl);
}

/* === CONTAINER === */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: var(--space-xl);
    background: var(--bg-white);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
}

/* === TYPOGRAPHY === */
.page-title {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--text-header);
    margin-bottom: var(--space-xl);
    text-align: center;
    letter-spacing: -0.5px;
}

.section-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-header);
    margin: var(--space-xl) 0 var(--space-lg);
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.section-title::before {
    content: '';
    width: 4px;
    height: 24px;
    background: var(--primary-action);
    border-radius: 2px;
}

/* === FLASH MESSAGES === */
.flash-messages {
    margin-bottom: var(--space-lg);
}

.alert {
    padding: var(--space-md) var(--space-lg);
    border-radius: var(--border-radius-sm);
    margin-bottom: var(--space-sm);
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    animation: slideIn 0.3s ease-out;
}

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

.alert-success {
    background: #D1FAE5;
    color: #065F46;
    border-left: 4px solid var(--success);
}

.alert-warning {
    background: #FEF3C7;
    color: #92400E;
    border-left: 4px solid var(--warning);
}

.alert-error {
    background: #FEE2E2;
    color: #991B1B;
    border-left: 4px solid var(--error);
}

/* === FORM STYLING === */
.invoice-form {
    margin-top: var(--space-lg);
}

.form-card {
    background: var(--bg-light);
    padding: var(--space-xl);
    border-radius: var(--border-radius);
    margin-bottom: var(--space-xl);
    border: 1px solid var(--border-color);
}

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: var(--space-lg);
}

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

.field label {
    font-weight: 600;
    color: var(--text-header);
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.input, select, input[type="text"], input[type="date"], input[type="number"] {
    padding: var(--space-sm) var(--space-md);
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    font-size: 1rem;
    transition: all 0.2s ease;
    background: var(--bg-white);
    color: var(--text-header);
    font-family: inherit;
}

.input:focus, select:focus, input:focus {
    outline: none;
    border-color: var(--primary-action);
    box-shadow: 0 0 0 3px var(--primary-light);
}

.input:hover, select:hover, input:hover {
    border-color: var(--primary-action);
}

/* === EXPENSE TABLE === */
.expense-table {
    background: var(--bg-card);
    border-radius: var(--border-radius);
    overflow: hidden;
    border: 1px solid var(--border-color);
}

.expense-header {
    display: grid;
    grid-template-columns: 140px 150px 1fr 1fr 120px 60px;
    gap: var(--space-sm);
    padding: var(--space-md) var(--space-lg);
    background: var(--text-header);
    color: var(--bg-white);
    font-weight: 600;
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.expense-row {
    display: grid;
    grid-template-columns: 140px 150px 1fr 1fr 120px 60px;
    gap: var(--space-sm);
    padding: var(--space-md) var(--space-lg);
    border-bottom: 1px solid var(--border-color);
    align-items: center;
    transition: background 0.2s ease;
}

.expense-row:hover {
    background: var(--bg-light);
}

.expense-row:last-child {
    border-bottom: none;
}

.expense-row .input {
    padding: var(--space-xs) var(--space-sm);
    font-size: 0.9rem;
}

.remove-btn {
    background: var(--error);
    color: white;
    border: none;
    border-radius: var(--border-radius-sm);
    width: 36px;
    height: 36px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    transition: all 0.2s ease;
}

.remove-btn:hover {
    background: #DC2626;
    transform: scale(1.05);
}

.remove-btn:active {
    transform: scale(0.95);
}

/* === BUTTONS === */
.btn-group {
    display: flex;
    gap: var(--space-md);
    margin-top: var(--space-xl);
    justify-content: center;
    flex-wrap: wrap;
}

.primary-btn, .secondary-btn, .add-btn {
    padding: var(--space-md) var(--space-xl);
    border: none;
    border-radius: var(--border-radius-sm);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: var(--space-xs);
    font-family: inherit;
    text-decoration: none;
}

.primary-btn {
    background: var(--primary-action);
    color: white;
    box-shadow: var(--shadow-md);
}

.primary-btn:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.primary-btn:active {
    transform: translateY(0);
}

.secondary-btn {
    background: var(--bg-white);
    color: var(--primary-action);
    border: 2px solid var(--primary-action);
}

.secondary-btn:hover {
    background: var(--primary-light);
}

.add-btn {
    background: var(--success);
    color: white;
    margin: var(--space-lg) 0;
}

.add-btn:hover {
    background: #059669;
    transform: translateY(-2px);
}

/* === PREVIEW PAGE === */
.preview-container {
    text-align: center;
    padding: var(--space-2xl);
}

.success-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto var(--space-lg);
    background: var(--success);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 3rem;
}

.preview-info {
    background: var(--bg-light);
    padding: var(--space-xl);
    border-radius: var(--border-radius);
    margin: var(--space-xl) auto;
    max-width: 600px;
    border: 1px solid var(--border-color);
}

.preview-info h2 {
    color: var(--text-header);
    margin-bottom: var(--space-md);
}

.preview-info p {
    color: var(--text-body);
    margin: var(--space-xs) 0;
    font-size: 1.1rem;
}

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

/* === RESPONSIVE === */
@media (max-width: 768px) {
    .container {
        padding: var(--space-lg);
    }
    
    .page-title {
        font-size: 2rem;
    }
    
    .grid {
        grid-template-columns: 1fr;
    }
    
    .expense-header {
        display: none;
    }
    
    .expense-row {
        grid-template-columns: 1fr;
        gap: var(--space-sm);
        padding: var(--space-md);
    }
    
    .btn-group, .preview-actions {
        flex-direction: column;
    }
    
    .primary-btn, .secondary-btn, .add-btn {
        width: 100%;
        justify-content: center;
    }
}

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

.expense-row {
    animation: fadeIn 0.3s ease-out;
}

/* === LOADING STATE === */
.loading {
    opacity: 0.6;
    pointer-events: none;
}

.primary-btn:disabled {
    background: var(--text-light);
    cursor: not-allowed;
}

/* === CREATOR CREDIT === */
.creator-credit {
    margin-top: var(--space-2xl);
    padding: var(--space-lg) 0;
    text-align: center;
    border-top: 1px solid var(--border-color);
}

.creator-credit p {
    color: var(--text-light);
    font-size: 0.9rem;
    margin: 0;
}

.creator-credit a {
    color: var(--primary-action);
    text-decoration: none;
    font-weight: 600;
    transition: all 0.2s ease;
}

.creator-credit a:hover {
    color: var(--primary-hover);
    text-decoration: underline;
}

/* === ENHANCED MODERN UI === */
.form-card {
    background: linear-gradient(135deg, #FFFFFF 0%, #F8FAFC 100%);
    border: 1px solid var(--border-color);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    transition: box-shadow 0.3s ease;
}

.form-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.field label {
    display: flex;
    align-items: center;
    gap: 4px;
}

.input:focus, select:focus {
    transform: translateY(-1px);
    box-shadow: 0 0 0 4px var(--primary-light);
}

.expense-table {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    transition: box-shadow 0.3s ease;
}

.expense-table:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.page-title {
    background: linear-gradient(135deg, var(--primary-action) 0%, var(--primary-hover) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* === DATA TABLE STYLING === */
.data-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.data-table thead {
    background: linear-gradient(135deg, var(--text-header) 0%, #1E293B 100%);
    color: white;
}

.data-table th {
    padding: var(--space-md) var(--space-lg);
    text-align: left;
    font-weight: 600;
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.data-table th.text-right {
    text-align: right;
}

.data-table th.text-center {
    text-align: center;
}

.data-table tbody tr {
    border-bottom: 1px solid var(--border-color);
    transition: all 0.2s ease;
}

.data-table tbody tr:hover {
    background: var(--bg-light);
    transform: scale(1.002);
}

.data-table tbody tr:last-child {
    border-bottom: none;
}

.data-table td {
    padding: var(--space-md) var(--space-lg);
    color: var(--text-body);
}

.data-table td.text-right {
    text-align: right;
}

.data-table td.text-center {
    text-align: center;
}

/* === BADGES AND STATUS === */
.badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge-success {
    background: #D1FAE5;
    color: #065F46;
}

.badge-warning {
    background: #FEF3C7;
    color: #92400E;
}

.badge-info {
    background: var(--primary-light);
    color: var(--primary-action);
}

/* === ACTION BUTTONS IN TABLES === */
.action-link {
    color: var(--primary-action);
    text-decoration: none;
    font-weight: 500;
    padding: 4px 8px;
    border-radius: 4px;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

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

.action-link.success {
    color: var(--success);
}

.action-link.success:hover {
    background: #D1FAE5;
}

/* === FILTER PANEL === */
.filter-panel {
    background: white;
    border-radius: var(--border-radius);
    padding: var(--space-xl);
    margin-bottom: var(--space-xl);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    border: 1px solid var(--border-color);
}

.filter-panel h2 {
    color: var(--text-header);
    font-size: 1.25rem;
    margin-bottom: var(--space-lg);
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.filter-actions {
    display: flex;
    gap: var(--space-md);
    flex-wrap: wrap;
}

/* === STATS CARDS === */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--space-lg);
    margin-bottom: var(--space-xl);
}

.stat-card {
    background: white;
    padding: var(--space-lg);
    border-radius: var(--border-radius);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    border-left: 4px solid var(--primary-action);
    transition: all 0.2s ease;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.stat-label {
    color: var(--text-light);
    font-size: 0.875rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-value {
    color: var(--text-header);
    font-size: 2rem;
    font-weight: 700;
    margin-top: var(--space-xs);
}

/* === EMPTY STATE === */
.empty-state {
    text-align: center;
    padding: var(--space-2xl);
    color: var(--text-light);
}

.empty-state-icon {
    font-size: 4rem;
    margin-bottom: var(--space-lg);
    opacity: 0.3;
}

.empty-state p {
    font-size: 1.1rem;
    margin-bottom: var(--space-md);
}

/* === PAGE HEADER === */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-xl);
    flex-wrap: wrap;
    gap: var(--space-md);
}

.page-header-actions {
    display: flex;
    gap: var(--space-md);
    flex-wrap: wrap;
}

/* === MOBILE RESPONSIVENESS === */
@media (max-width: 768px) {
    .header-container {
        flex-direction: column;
        gap: var(--space-md);
        padding: var(--space-md);
    }
    
    .site-nav {
        width: 100%;
        flex-direction: column;
        gap: var(--space-xs);
    }
    
    .nav-link {
        width: 100%;
        justify-content: center;
    }
    
    .data-table {
        font-size: 0.875rem;
    }
    
    .data-table th,
    .data-table td {
        padding: var(--space-sm);
    }
    
    .page-header {
        flex-direction: column;
        align-items: stretch;
    }
    
    .page-header-actions {
        flex-direction: column;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
}

