/* =============================================================================
   Main Stylesheet - Loan Management App
   Minimal & Modern Fintech Design
   ============================================================================= */

/* CSS Variables */
:root {
    /* Colors - Professional Fintech Palette */
    --primary: #0F172A;
    --primary-light: #1E293B;
    --secondary: #334155;
    --accent: #2563EB;
    --accent-hover: #1D4ED8;
    --dark: #0F172A;
    --success: #059669;
    --danger: #DC2626;
    --warning: #D97706;
    --light: #FFFFFF;
    --bg: #F8FAFC;
    --text: #1E293B;
    --text-muted: #64748B;
    --border: #E2E8F0;

    /* Spacing Tokens (8dp rhythm) */
    --space-xs: 4px;
    --space-sm: 8px;
    --space-md: 16px;
    --space-lg: 24px;
    --space-xl: 32px;
    --space-2xl: 48px;
    --space-3xl: 64px;
    --space-4xl: 96px;

    /* Typography */
    --font-family: 'Vazirmatn', 'Tahoma', sans-serif;
    --font-size-xs: 0.75rem;
    --font-size-sm: 0.875rem;
    --font-size-base: 1rem;
    --font-size-lg: 1.125rem;
    --font-size-xl: 1.25rem;
    --font-size-2xl: 1.5rem;
    --font-size-3xl: 1.875rem;
    --font-size-4xl: 2.25rem;

    /* Shadows - Minimal */
    --shadow-xs: 0 1px 2px rgba(0,0,0,0.04);
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.06), 0 2px 4px -1px rgba(0,0,0,0.04);

    /* Transitions */
    --transition-fast: 150ms ease;
    --transition-base: 200ms ease;

    /* Border Radius */
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;
}

/* Base */
*,
*::before,
*::after {
    box-sizing: border-box;
}

body {
    font-family: var(--font-family);
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

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

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* =============================================================================
   Navbar
   ============================================================================= */

.navbar {
    background-color: var(--dark) !important;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}

.navbar-brand {
    font-weight: 700;
    font-size: var(--font-size-lg);
    letter-spacing: -0.02em;
}

.dropdown-menu {
    text-align: right;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-md);
}

/* Container */
.container {
    max-width: 1120px;
}

/* Navbar Spacer */
.navbar-spacer {
    height: 64px;
}

/* =============================================================================
   Hero Section
   ============================================================================= */

.hero {
    background: var(--dark);
    color: white;
    padding: var(--space-4xl) 0 var(--space-3xl);
}

.hero h1 {
    font-size: var(--font-size-4xl);
    font-weight: 700;
    margin-bottom: var(--space-md);
    letter-spacing: -0.02em;
    line-height: 1.2;
}

.hero p {
    font-size: var(--font-size-lg);
    opacity: 0.7;
    margin-bottom: var(--space-xl);
    max-width: 520px;
    margin-left: auto;
    margin-right: auto;
    line-height: 1.6;
}

.hero-buttons {
    display: flex;
    gap: var(--space-md);
    justify-content: center;
    flex-wrap: wrap;
}

/* Hero Buttons */
.btn-hero {
    background: var(--accent);
    color: white;
    padding: 12px 32px;
    border-radius: var(--radius-md);
    font-weight: 500;
    font-size: var(--font-size-base);
    transition: all var(--transition-base);
    border: none;
    display: inline-flex;
    align-items: center;
    gap: var(--space-sm);
    text-decoration: none;
}

.btn-hero:hover {
    background: var(--accent-hover);
    color: white;
}

.btn-hero-outline {
    background: transparent;
    color: white;
    border: 1px solid rgba(255,255,255,0.25);
}

.btn-hero-outline:hover {
    background: rgba(255,255,255,0.08);
    border-color: rgba(255,255,255,0.4);
    color: white;
}

/* =============================================================================
   Stats Section
   ============================================================================= */

.stats-section {
    padding: var(--space-3xl) 0;
    background: var(--light);
    border-bottom: 1px solid var(--border);
}

.stat-item {
    text-align: center;
    padding: var(--space-lg) var(--space-md);
}

.stat-icon {
    width: 44px;
    height: 44px;
    margin: 0 auto var(--space-md);
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text);
    font-size: 1.125rem;
}

.stat-value {
    font-size: var(--font-size-xl);
    font-weight: 600;
    color: var(--text);
    margin-bottom: var(--space-xs);
}

.stat-label {
    font-size: var(--font-size-sm);
    color: var(--text-muted);
    margin: 0;
}

/* =============================================================================
   Features Section
   ============================================================================= */

.features-section {
    padding: var(--space-4xl) 0;
    background: var(--bg);
}

.feature-card {
    background: var(--light);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: var(--space-xl);
    transition: all var(--transition-base);
    height: 100%;
}

.feature-card:hover {
    border-color: var(--accent);
    box-shadow: var(--shadow-sm);
}

.feature-icon {
    width: 44px;
    height: 44px;
    margin-bottom: var(--space-lg);
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text);
    font-size: 1.125rem;
}

.feature-title {
    font-size: var(--font-size-base);
    font-weight: 600;
    margin-bottom: var(--space-sm);
    color: var(--text);
}

.feature-desc {
    font-size: var(--font-size-sm);
    color: var(--text-muted);
    line-height: 1.6;
    margin: 0;
}

/* =============================================================================
   Section Title
   ============================================================================= */

.section-title {
    font-size: var(--font-size-3xl);
    font-weight: 700;
    margin-bottom: var(--space-2xl);
    text-align: center;
    color: var(--text);
    letter-spacing: -0.02em;
}

/* =============================================================================
   How It Works
   ============================================================================= */

.steps-section {
    padding: var(--space-4xl) 0;
    background: var(--light);
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
}

.step-card {
    text-align: center;
    padding: var(--space-xl);
}

.step-number {
    width: 48px;
    height: 48px;
    margin: 0 auto var(--space-lg);
    background: var(--dark);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: var(--font-size-lg);
    font-weight: 600;
}

.step-title {
    font-size: var(--font-size-base);
    font-weight: 600;
    margin-bottom: var(--space-sm);
    color: var(--text);
}

.step-desc {
    font-size: var(--font-size-sm);
    color: var(--text-muted);
    line-height: 1.5;
    margin: 0;
}

/* =============================================================================
   Testimonials
   ============================================================================= */

.testimonials-section {
    padding: var(--space-4xl) 0;
    background: var(--bg);
}

.testimonial-card {
    background: var(--light);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: var(--space-xl);
    height: 100%;
}

.testimonial-quote {
    font-size: 1.5rem;
    color: var(--border);
    line-height: 1;
    margin-bottom: var(--space-md);
    font-family: Georgia, serif;
}

.testimonial-text {
    font-size: var(--font-size-sm);
    color: var(--text);
    line-height: 1.7;
    margin-bottom: var(--space-lg);
}

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

.testimonial-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--dark);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 500;
    font-size: var(--font-size-sm);
    flex-shrink: 0;
}

.testimonial-name {
    font-weight: 600;
    color: var(--text);
    font-size: var(--font-size-sm);
    margin: 0;
}

.testimonial-role {
    font-size: var(--font-size-xs);
    color: var(--text-muted);
    margin: 0;
}

/* =============================================================================
   Footer
   ============================================================================= */

.footer {
    background: var(--dark);
    color: white;
    padding: var(--space-3xl) 0 var(--space-xl);
}

.footer h5 {
    font-weight: 600;
    font-size: var(--font-size-base);
    margin-bottom: var(--space-lg);
}

.footer p {
    color: rgba(255,255,255,0.6);
    font-size: var(--font-size-sm);
    line-height: 1.6;
}

.footer-links {
    list-style: none;
    padding: 0;
    margin: 0;
}

.footer-links li {
    margin-bottom: var(--space-sm);
}

.footer-links a {
    color: rgba(255,255,255,0.6);
    text-decoration: none;
    transition: color var(--transition-fast);
    font-size: var(--font-size-sm);
}

.footer-links a:hover {
    color: white;
}

.footer-social {
    display: flex;
    gap: var(--space-md);
}

.footer-social a {
    color: rgba(255,255,255,0.6);
    transition: color var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    border: 1px solid rgba(255,255,255,0.15);
}

.footer-social a:hover {
    color: white;
    border-color: rgba(255,255,255,0.4);
    background: rgba(255,255,255,0.05);
}

.footer-bottom {
    border-top: 1px solid rgba(255,255,255,0.1);
    padding-top: var(--space-xl);
    margin-top: var(--space-xl);
}

.footer-bottom p {
    margin: 0;
    font-size: var(--font-size-xs);
    color: rgba(255,255,255,0.4);
}

/* =============================================================================
   Responsive Breakpoints
   ============================================================================= */

/* Small phones (375px) */
@media (max-width: 400px) {
    .hero {
        padding: var(--space-3xl) 0 var(--space-2xl);
    }

    .hero h1 {
        font-size: var(--font-size-2xl);
    }

    .hero p {
        font-size: var(--font-size-base);
    }

    .btn-hero {
        padding: 10px 24px;
        font-size: var(--font-size-sm);
        width: 100%;
        justify-content: center;
    }

    .section-title {
        font-size: var(--font-size-xl);
    }

    .feature-card {
        padding: var(--space-lg);
    }

    .stat-value {
        font-size: var(--font-size-lg);
    }
}

/* Tablets (768px) */
@media (max-width: 768px) {
    .hero h1 {
        font-size: var(--font-size-3xl);
    }

    .hero p {
        font-size: var(--font-size-base);
    }

    .section-title {
        font-size: var(--font-size-2xl);
        margin-bottom: var(--space-xl);
    }

    .footer {
        padding: var(--space-2xl) 0 var(--space-lg);
    }
}

/* Desktop (1024px+) */
@media (min-width: 1024px) {
    .hero {
        padding: var(--space-4xl) 0;
    }

    .hero h1 {
        font-size: 2.75rem;
    }
}

/* =============================================================================
   Utility Classes
   ============================================================================= */

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Touch target minimum (44px) */
.btn,
.nav-link,
.dropdown-item {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
}

/* Links */
a {
    color: var(--accent);
    text-decoration: none;
    transition: color var(--transition-fast);
}

a:hover {
    color: var(--accent-hover);
}

/* =============================================================================
   Dashboard Responsive Improvements
   ============================================================================= */

/* Mobile-first: Stack stat cards vertically on small screens */
@media (max-width: 576px) {
    .row.g-3 > [class*="col-"] {
        padding-left: var(--space-xs);
        padding-right: var(--space-xs);
    }

    .card-body {
        padding: var(--space-sm);
    }

    .table-responsive {
        font-size: var(--font-size-sm);
    }

    .table th,
    .table td {
        padding: var(--space-xs) var(--space-sm);
    }

    .badge {
        font-size: 0.65rem;
    }

    h4 {
        font-size: var(--font-size-lg);
    }

    h5 {
        font-size: var(--font-size-base);
    }
}

/* Tablets: Better table layout */
@media (max-width: 768px) {
    .projection-card .card-body {
        padding: var(--space-xs);
    }

    .projection-card strong {
        font-size: var(--font-size-sm);
    }

    .projection-card h6 {
        font-size: var(--font-size-xs);
    }
}

/* Print styles */
@media print {
    .navbar,
    .btn,
    .modal,
    .projection-card {
        display: none !important;
    }

    .card {
        break-inside: avoid;
        border: 1px solid #ddd !important;
    }

    body {
        background: white;
    }
}

/* =============================================================================
   Reports Page
   ============================================================================= */

/* Mobile: tables scroll horizontally, charts readable */
@media (max-width: 576px) {
    .report-tabs .nav-link {
        font-size: 0.7rem;
        padding: 0.35rem 0.5rem;
    }

    .chart-container {
        min-height: 220px;
    }

    .stat-value {
        font-size: 1.25rem;
    }

    .stat-label {
        font-size: 0.65rem;
    }
}

/* Tablets: improved chart dimensions */
@media (min-width: 577px) and (max-width: 1024px) {
    .chart-container {
        min-height: 280px;
    }
}

/* Desktop: full layout */
@media (min-width: 1025px) {
    .chart-container {
        min-height: 350px;
    }
}

/* Ensure tables are horizontally scrollable on mobile */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}
