/*!
 * Business Insurance Calculator Styles
 * Mobile-first responsive design
 */

/* CSS Reset & Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

.bic-container {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    color: #111827;
    background-color: #ffffff;
    line-height: 1.5;
    max-width: 100%;
    overflow-x: hidden;
}

/* Typography */
h1, h2, h3, h4 {
    font-weight: 600;
    line-height: 1.2;
    margin-bottom: 0.75rem;
}

/* Title Section */
.bic-title-container {
    background-color: #2CEC00;
    color: #ffffff;
    text-align: center;
    padding: 2rem 1rem;
    margin-bottom: 1.5rem;
    width: 100%;
}

.bic-title {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.bic-subtitle {
    font-size: 1rem;
    opacity: 0.9;
    max-width: 600px;
    margin: 0 auto;
}

/* Card Styles */
.bic-card {
    background-color: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* Form Container */
.bic-form-container {
    max-width: 1200px;
    margin: 0 auto;
}

/* Section Styles */
.bic-section {
    margin-bottom: 2rem;
}

.bic-section-title {
    font-size: 1.25rem;
    color: #111827;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid #e5e7eb;
}

.bic-section-subtitle {
    font-size: 1.125rem;
    color: #374151;
    margin-bottom: 1rem;
}

/* Input Grid - Mobile First (1 column) */
.bic-input-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
    margin-bottom: 1rem;
}

.bic-input-group {
    display: flex;
    flex-direction: column;
}

.bic-input-group label {
    font-size: 0.875rem;
    font-weight: 500;
    color: #374151;
    margin-bottom: 0.375rem;
}

.bic-input {
    padding: 0.75rem;
    font-size: 1rem;
    border: 1px solid #e5e7eb;
    border-radius: 0.375rem;
    background-color: #ffffff;
    color: #111827;
    transition: border-color 0.15s ease-in-out;
    min-height: 44px; /* Touch-friendly */
}

.bic-input:focus {
    outline: none;
    border-color: #22c55e;
    box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.1);
}

.bic-input:invalid {
    border-color: #ef4444;
}

/* Error Messages */
.bic-error-message {
    font-size: 0.75rem;
    color: #ef4444;
    margin-top: 0.25rem;
    min-height: 1rem;
}

/* Advanced Options */
.bic-advanced-toggle {
    text-align: center;
    margin: 1.5rem 0;
}

.bic-toggle-btn {
    background: none;
    border: 1px solid #e5e7eb;
    border-radius: 0.375rem;
    padding: 0.75rem 1.5rem;
    font-size: 0.875rem;
    color: #374151;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    min-height: 44px;
    width: 100%;
    max-width: 300px;
}

.bic-toggle-btn:hover {
    background-color: #f3f4f6;
}

.bic-toggle-icon {
    transition: transform 0.3s ease;
}

.bic-advanced-options {
    margin-top: 1rem;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Checkbox Styles */
.bic-checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-top: 1rem;
}

.bic-checkbox {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    font-size: 0.875rem;
    color: #374151;
}

.bic-checkbox input[type="checkbox"] {
    width: 1.125rem;
    height: 1.125rem;
    cursor: pointer;
}

/* Button Styles */
.bic-button-group {
    text-align: center;
    margin-top: 2rem;
}

.bic-button {
    padding: 0.875rem 1.75rem;
    font-size: 1rem;
    font-weight: 500;
    border: none;
    border-radius: 0.375rem;
    cursor: pointer;
    transition: all 0.15s ease-in-out;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.bic-button-primary {
    background-color: #22c55e;
    color: #ffffff;
    width: 100%;
    max-width: 300px;
}

.bic-button-primary:hover {
    background-color: #16a34a;
}

.bic-button-secondary {
    background-color: #2563eb;
    color: #ffffff;
}

.bic-button-secondary:hover {
    background-color: #1d4ed8;
}

.bic-spinner {
    display: none;
    font-size: 0.875rem;
}

/* Results Section */
.bic-results-container {
    max-width: 1200px;
    margin: 0 auto;
    animation: slideInUp 0.5s ease;
}

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

.bic-results-title {
    font-size: 1.5rem;
    text-align: center;
    margin-bottom: 2rem;
    color: #111827;
}

/* Results Summary Cards */
.bic-results-summary {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
    margin-bottom: 2rem;
}

.bic-summary-card {
    background-color: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    padding: 1.25rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.bic-summary-icon {
    font-size: 1.5rem;
    width: 3rem;
    height: 3rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #f0fdf4;
    border-radius: 50%;
}

.bic-summary-content {
    flex: 1;
}

.bic-summary-title {
    font-size: 0.875rem;
    color: #6b7280;
    margin-bottom: 0.25rem;
}

.bic-summary-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: #111827;
}

/* Progress Bar */
.bic-progress-section {
    margin-bottom: 2rem;
}

.bic-progress-bar {
    height: 1.25rem;
    background-color: #e5e7eb;
    border-radius: 0.625rem;
    overflow: hidden;
    margin: 1rem 0;
}

.bic-progress-fill {
    height: 100%;
    background-color: #22c55e;
    border-radius: 0.625rem;
    transition: width 1s ease-in-out;
}

.bic-progress-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    color: #6b7280;
}

/* Charts Section */
.bic-charts-section {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
    margin-bottom: 2rem;
}

.bic-chart-container {
    background-color: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    padding: 1.25rem;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.bic-chart {
    width: 100% !important;
    height: 250px !important;
    margin-top: 1rem;
}

/* Table Containers for Horizontal Scroll on Mobile */
.bic-table-container {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 1rem 0;
}

.bic-table-container::-webkit-scrollbar {
    height: 6px;
}

.bic-table-container::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.bic-table-container::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.bic-table-container::-webkit-scrollbar-thumb:hover {
    background: #a1a1a1;
}

/* Table Styles */
.bic-breakdown-table,
.bic-projection-table {
    width: 100%;
    min-width: 600px; /* Minimum width for horizontal scroll */
    border-collapse: collapse;
    font-size: 0.875rem;
}

.bic-breakdown-table th,
.bic-projection-table th {
    background-color: #f3f4f6;
    color: #374151;
    font-weight: 600;
    text-align: left;
    padding: 0.75rem 1rem;
    border-bottom: 2px solid #e5e7eb;
}

.bic-breakdown-table td,
.bic-projection-table td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #e5e7eb;
    color: #374151;
}

.bic-breakdown-table tr:last-child td,
.bic-projection-table tr:last-child td {
    border-bottom: none;
}

.bic-breakdown-table tr:hover,
.bic-projection-table tr:hover {
    background-color: #f9fafb;
}

/* Action Buttons */
.bic-action-buttons {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid #e5e7eb;
}

.bic-action-buttons .bic-button {
    width: 100%;
}

/* Loading Overlay */
.bic-loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255, 255, 255, 0.9);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.bic-loading-spinner {
    width: 3rem;
    height: 3rem;
    border: 3px solid #e5e7eb;
    border-top-color: #22c55e;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 1rem;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Print Styles */
@media print {
    .bic-button-group,
    .bic-advanced-toggle,
    .bic-action-buttons,
    .bic-toggle-btn {
        display: none !important;
    }
    
    .bic-card {
        box-shadow: none;
        border: 1px solid #000;
    }
    
    .bic-title-container {
        background-color: #000 !important;
        -webkit-print-color-adjust: exact;
        color-adjust: exact;
    }
    
    .bic-chart {
        height: 200px !important;
    }
}

/* Media Queries - Tablet (481px - 768px) */
@media (min-width: 481px) {
    .bic-title {
        font-size: 2.25rem;
    }
    
    .bic-input-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .bic-results-summary {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .bic-charts-section {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .bic-action-buttons {
        flex-direction: row;
        justify-content: center;
    }
    
    .bic-action-buttons .bic-button {
        width: auto;
    }
}

/* Media Queries - Desktop (> 768px) */
@media (min-width: 769px) {
    .bic-title {
        font-size: 2.5rem;
    }
    
    .bic-subtitle {
        font-size: 1.125rem;
    }
    
    .bic-form-container,
    .bic-results-container {
        padding: 0 2rem;
    }
    
    .bic-section-title {
        font-size: 1.5rem;
    }
    
    .bic-input-grid {
        gap: 1.5rem;
    }
    
    .bic-results-summary {
        grid-template-columns: repeat(4, 1fr);
    }
    
    .bic-summary-card {
        padding: 1.5rem;
    }
    
    .bic-summary-value {
        font-size: 1.75rem;
    }
    
    .bic-chart {
        height: 300px !important;
    }
    
    .bic-table-container {
        margin: 1.5rem 0;
    }
}

/* Small Mobile (≤ 360px) */
@media (max-width: 360px) {
    .bic-title {
        font-size: 1.75rem;
    }
    
    .bic-subtitle {
        font-size: 0.875rem;
    }
    
    .bic-card {
        padding: 1rem;
    }
    
    .bic-button {
        padding: 0.75rem 1rem;
        font-size: 0.875rem;
    }
    
    .bic-summary-card {
        padding: 1rem;
    }
    
    .bic-summary-value {
        font-size: 1.25rem;
    }
    
    .bic-chart {
        height: 200px !important;
    }
}

/* Accessibility */
.bic-input:focus-visible,
.bic-button:focus-visible,
.bic-toggle-btn:focus-visible {
    outline: 2px solid #2563eb;
    outline-offset: 2px;
}

/* Screen Reader Only */
.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;
}

/* No horizontal scrolling on body */
html, body {
    overflow-x: hidden;
    width: 100%;
}

/* Ensure proper word breaking */
.bic-container {
    word-wrap: break-word;
    overflow-wrap: break-word;
}

/* Input number field styling */
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
    opacity: 1;
    height: auto;
    padding: 0;
}