/**
 * Corporate Bookkeeping App - Main Stylesheet
 * Responsive Bootstrap enhancements, color scheme, and typography
 */

:root {
    --primary-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --primary-color: #667eea;
    --primary-dark: #5a6fd6;
    --secondary-color: #764ba2;
    --secondary-dark: #6a4190;
    --text-primary: #333333;
    --text-secondary: #666666;
    --bg-light: #f8f9fa;
    --card-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    --card-shadow-hover: 0 4px 16px rgba(0, 0, 0, 0.12);
}

body {
    background-color: var(--bg-light);
    color: var(--text-primary);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
}

/* ==========================================================================
   Header & Navigation
   ========================================================================== */

.header {
    background: var(--primary-gradient);
    color: #ffffff;
    padding: 1.25rem 0;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.header h1 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 600;
    letter-spacing: -0.02em;
}

.nav-links {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem 1.25rem;
}

.nav-links a {
    color: rgba(255, 255, 255, 0.9);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.95rem;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    transition: background-color 0.2s ease, opacity 0.2s ease, color 0.2s ease;
    white-space: nowrap;
}

.nav-links a:hover {
    color: #ffffff;
    background-color: rgba(255, 255, 255, 0.15);
    opacity: 1;
}

.nav-links a.active {
    color: #ffffff;
    background-color: rgba(255, 255, 255, 0.25);
    font-weight: 700;
}

/* Responsive navigation adjustments */
@media (max-width: 991.98px) {
    .header .header-bar {
        flex-direction: column;
        align-items: flex-start !important;
        gap: 1rem;
    }

    .nav-links {
        width: 100%;
        gap: 0.4rem 0.8rem;
        overflow-x: auto;
        padding-bottom: 0.25rem;
        -webkit-overflow-scrolling: touch;
    }

    .nav-links a {
        font-size: 0.875rem;
        padding: 0.2rem 0.4rem;
    }
}

/* ==========================================================================
   Cards & Layout Components
   ========================================================================== */

.stat-card {
    background: #ffffff;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: var(--card-shadow);
    height: 100%;
    transition: transform 0.25s ease, box-shadow 0.25s ease;
    border: 1px solid rgba(0, 0, 0, 0.04);
}

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

.stat-card h3 {
    font-size: 0.9rem;
    color: var(--text-secondary);
    font-weight: 500;
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.stat-card .value {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--text-primary);
    word-break: break-word;
}

.stat-card.revenue .value { color: #28a745; }
.stat-card.expenses .value { color: #dc3545; }
.stat-card.income .value { color: #007bff; }
.stat-card.pending .value { color: #d39e00; }
.stat-card.count .value { color: var(--primary-color); }

.report-section {
    background: #ffffff;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: var(--card-shadow);
    margin-top: 1.5rem;
    border: 1px solid rgba(0, 0, 0, 0.04);
}

.report-section h4 {
    color: var(--text-primary);
    font-weight: 600;
    margin-bottom: 1rem;
}

.filter-section {
    background: #ffffff;
    border-radius: 12px;
    padding: 1.25rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--card-shadow);
    border: 1px solid rgba(0, 0, 0, 0.04);
}

.total-display {
    background: var(--primary-gradient);
    color: #ffffff;
    border-radius: 10px;
    padding: 1.25rem;
    text-align: center;
    margin-bottom: 1.5rem;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.25);
}

.total-display .amount {
    font-size: 1.85rem;
    font-weight: 700;
    line-height: 1.2;
}

.total-display small {
    display: block;
    margin-top: 0.25rem;
    font-size: 0.85rem;
    opacity: 0.9;
}

/* Sheets Overview Cards */
.sheet-card {
    background: #ffffff;
    border-radius: 12px;
    padding: 1.75rem;
    box-shadow: var(--card-shadow);
    transition: transform 0.25s ease, box-shadow 0.25s ease;
    text-decoration: none;
    color: inherit;
    display: block;
    height: 100%;
    border: 1px solid rgba(0, 0, 0, 0.04);
}

.sheet-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--card-shadow-hover);
    color: inherit;
}

.sheet-card .icon {
    font-size: 2.25rem;
    margin-bottom: 0.75rem;
}

.sheet-card .title {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.sheet-card .count {
    font-size: 1.85rem;
    font-weight: 700;
    color: var(--primary-color);
}

.sheet-card .description {
    color: var(--text-secondary);
    font-size: 0.875rem;
    margin-top: 0.5rem;
}

.sync-info {
    background: #ffffff;
    border-radius: 12px;
    padding: 1.25rem;
    box-shadow: var(--card-shadow);
    margin-bottom: 1.5rem;
    border: 1px solid rgba(0, 0, 0, 0.04);
}

.sync-info .status {
    font-weight: 600;
}

/* ==========================================================================
   Tables & Data Presentation
   ========================================================================== */

.table-container {
    background: #ffffff;
    border-radius: 12px;
    box-shadow: var(--card-shadow);
    overflow: hidden;
    border: 1px solid rgba(0, 0, 0, 0.04);
    margin-bottom: 1.5rem;
}

.table {
    margin-bottom: 0;
    font-size: 0.875rem;
    width: 100%;
}

.table thead th {
    background-color: #f8f9fa;
    font-weight: 600;
    color: var(--text-primary);
    border-bottom: 2px solid #dee2e6;
    padding: 0.75rem 0.85rem;
    white-space: nowrap;
}

.table tbody td {
    padding: 0.75rem 0.85rem;
    vertical-align: middle;
    border-bottom: 1px solid #dee2e6;
}

.table tbody tr:hover {
    background-color: #f8f9fa;
}

.table-responsive {
    max-height: 650px;
    overflow-y: auto;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.breakdown-table {
    font-size: 0.875rem;
}

.breakdown-table th {
    background-color: #f8f9fa;
    font-weight: 600;
}

/* Specific cell types */
.receipt-cell {
    min-width: 180px;
    max-width: 280px;
}

.settlement-cell {
    min-width: 140px;
    max-width: 240px;
}

.receipt-item {
    margin-bottom: 0.5rem;
    word-break: break-word;
    overflow-wrap: break-word;
}

.receipt-item:last-child {
    margin-bottom: 0;
}

.receipt-name {
    font-weight: 500;
    color: var(--text-primary);
    display: block;
    word-break: break-word;
    overflow-wrap: break-word;
    white-space: normal;
    line-height: 1.35;
    font-size: 0.85rem;
}

.receipt-link {
    color: #0d6efd;
    text-decoration: none;
    font-size: 0.8rem;
    display: inline-block;
    margin-top: 0.2rem;
    font-weight: 500;
}

.receipt-link:hover {
    text-decoration: underline;
}

.settlement-text {
    word-break: break-word;
    overflow-wrap: break-word;
    white-space: normal;
    display: block;
    line-height: 1.35;
    font-size: 0.85rem;
}

/* Badges & Status Indicators */
.badge-pending,
.status-pending {
    color: #856404;
    font-weight: 600;
    background-color: #fff9db;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    display: inline-block;
    font-size: 0.8rem;
}

.badge-done,
.status-done,
.status-received {
    color: #155724;
    font-weight: 600;
    background-color: #d4edda;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    display: inline-block;
    font-size: 0.8rem;
}

.status-active-badge {
    color: #0c5460;
    background-color: #d1ecf1;
    font-weight: 600;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
}

.balance-positive {
    color: #28a745;
    font-weight: 600;
}

.balance-negative {
    color: #dc3545;
    font-weight: 600;
}

.no-link {
    color: #999999;
    font-style: italic;
    font-size: 0.85rem;
}

.no-data {
    text-align: center;
    padding: 3rem 1.5rem;
    color: var(--text-secondary);
}

.error {
    background-color: #f8d7da;
    color: #721c24;
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
    border: 1px solid #f5c6cb;
}

/* Dedicated styling classes replacing inline styles */
.test-mode-banner {
    border-left: 5px solid #ffc107;
    background-color: #fff3cd;
}

.status-danger-text {
    color: #dc3545;
    font-weight: 600;
}

.status-success-text {
    color: #28a745;
    font-weight: 600;
}

/* ==========================================================================
   Login Screen
   ========================================================================== */

.login-page-body {
    background: var(--primary-gradient);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem 0.75rem;
}

.login-container {
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    padding: 2.25rem;
    width: 100%;
    max-width: 420px;
    margin: 0 auto;
}

.login-header {
    text-align: center;
    margin-bottom: 1.75rem;
}

.login-header h2 {
    color: var(--text-primary);
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.login-header p {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.login-form .form-control {
    padding: 0.75rem;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    margin-bottom: 1rem;
    font-size: 0.95rem;
}

.login-form .form-control:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(102, 126, 234, 0.25);
}

.btn-login-gradient {
    background: var(--primary-gradient);
    border: none;
    color: #ffffff;
    padding: 0.75rem;
    border-radius: 8px;
    font-weight: 500;
    width: 100%;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.btn-login-gradient:hover {
    opacity: 0.92;
    color: #ffffff;
    transform: translateY(-1px);
}

/* ==========================================================================
   Mobile & Responsive Optimization
   ========================================================================== */

@media (max-width: 575.98px) {
    .header {
        padding: 1rem 0;
    }

    .header h1 {
        font-size: 1.25rem;
    }

    .total-display .amount {
        font-size: 1.5rem;
    }

    .total-display {
        padding: 1rem;
    }

    .stat-card .value {
        font-size: 1.5rem;
    }

    .login-container {
        padding: 1.5rem;
        border-radius: 12px;
    }

    .sheet-card {
        padding: 1.25rem;
    }

    .table thead th,
    .table tbody td {
        padding: 0.5rem 0.6rem;
        font-size: 0.8rem;
    }
}

