@import 'animations.css';
@import 'workflow.css';

body {
    font-family: 'Inter', 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
    margin: 0;
    padding: 0;
    background: #f8fafc;
    min-height: 100vh;
    color: #1e293b;
    line-height: 1.6;
    font-size: 16px;
}

/* Add responsive meta viewport if not present */
/* This will be handled in HTML meta tag */

.container {
    max-width: 1400px;
    margin: 0 auto;
    background: white;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1), 0 1px 2px rgba(0, 0, 0, 0.06);
    min-height: 100vh;
}

.header {
    background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
    color: white;
    padding: 2rem 2.5rem;
    border-bottom: 1px solid #334155;
    text-align: center;
}

.header h1 {
    margin: 0 0 0.5rem 0;
    font-size: 2.25rem;
    font-weight: 700;
    letter-spacing: -0.025em;
    color: #ffffff;
    font-family: 'Inter', sans-serif;
}

/* Glassmorphism Utilities */
.glass-panel {
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.5);
}

.glass-panel-dark {
    background: rgba(15, 23, 42, 0.7);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.header p {
    margin: 0;
    color: #cbd5e1;
    font-size: 1.125rem;
    font-weight: 400;
    line-height: 1.5;
}

.header p.subtitle {
    margin-top: 0.25rem;
    color: #94a3b8;
    font-size: 1rem;
}

.business-selector {
    background: #ffffff;
    padding: 2.5rem;
    border-bottom: 1px solid #e2e8f0;
}

.business-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.business-card {
    background: #ffffff;
    padding: 1.5rem;
    border-radius: 12px;
    border: 2px solid #e2e8f0;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
    position: relative;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.business-card:hover {
    border-color: #3b82f6;
    transform: translateY(-4px);
    box-shadow: 0 8px 25px rgba(59, 130, 246, 0.15);
    background: #ffffff;
}

.business-card.selected {
    border-color: #3b82f6;
    background: #3b82f6;
    color: white;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.25);
}

.business-card h3 {
    margin: 0 0 1rem 0;
    font-size: 1.25rem;
    font-weight: 600;
    color: #1e293b;
    line-height: 1.3;
}

.business-card p {
    margin: 0 0 1.5rem 0;
    font-size: 0.875rem;
    color: #64748b;
    line-height: 1.6;
}

.custom-business {
    background: white;
    padding: 20px;
    border-radius: 10px;
    margin-top: 20px;
    display: none;
}

.tabs {
    display: flex;
    background: #f8fafc;
    border-bottom: 2px solid #e2e8f0;
    overflow-x: auto;
    padding: 0 2.5rem;
    scrollbar-width: thin;
}

.tab {
    flex: 1;
    min-width: 140px;
    padding: 1rem 1.5rem;
    text-align: center;
    cursor: pointer;
    background: transparent;
    border: none;
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.3s ease;
    border-bottom: 3px solid transparent;
    color: #64748b;
}

.tab:hover {
    background: #f1f5f9;
    color: #1e293b;
}

.tab.active {
    background: white;
    border-bottom-color: #3b82f6;
    color: #3b82f6;
    font-weight: 600;
}

.content {
    padding: 2.5rem;
    background: #ffffff;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

.assumptions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 24px;
    margin-bottom: 32px;
}

.assumption-group {
    background: #f8fafc;
    padding: 24px;
    border-radius: 8px;
    border-left: 3px solid #3b82f6;
    border: 1px solid #e2e8f0;
}

.assumption-group h3 {
    margin-top: 0;
    color: #1e293b;
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 16px;
}

.input-group {
    margin-bottom: 16px;
}

.input-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    color: #374151;
    font-size: 0.875rem;
}

.input-group input,
.input-group select,
.input-group textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 0.875rem;
    transition: all 0.2s ease;
    box-sizing: border-box;
    background: #ffffff;
}

.input-group textarea {
    height: 80px;
    resize: vertical;
}

.input-group input:focus,
.input-group select:focus,
.input-group textarea:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.table-container {
    overflow-x: auto;
    margin: 20px 0;
    border-radius: 10px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    font-size: 0.875rem;
}

th,
td {
    padding: 12px 16px;
    text-align: right;
    border-bottom: 1px solid #e2e8f0;
    font-variant-numeric: tabular-nums;
}

th {
    background: #1e293b;
    color: #f8fafc;
    font-weight: 600;
    position: sticky;
    top: 0;
    letter-spacing: 0.025em;
    font-size: 0.75rem;
    text-transform: uppercase;
}

th:first-child,
td:first-child {
    text-align: left;
    font-weight: 500;
}

tr:hover {
    background: #f8f9fa;
}

.metric-card {
    background: white;
    padding: 24px;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    margin-bottom: 16px;
    border-left: 3px solid #059669;
    border: 1px solid #e2e8f0;
}

.metric-value {
    font-size: 1.875rem;
    font-weight: 700;
    color: #059669;
    margin-bottom: 4px;
    font-variant-numeric: tabular-nums;
}

.metric-label {
    color: #64748b;
    font-size: 0.875rem;
    font-weight: 500;
}

.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.download-btn,
.generate-btn {
    background: #059669;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 6px;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    margin: 8px;
    letter-spacing: 0.025em;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.generate-btn {
    background: #3b82f6;
    padding: 14px 28px;
    font-size: 1rem;
    font-weight: 600;
    box-shadow: 0 4px 6px rgba(59, 130, 246, 0.1);
}

.download-btn:hover {
    background: #047857;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(5, 150, 105, 0.25);
}

.generate-btn:hover {
    background: #2563eb;
    transform: translateY(-1px);
    box-shadow: 0 8px 16px rgba(59, 130, 246, 0.25);
}

.section-title {
    color: #0f172a;
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 24px;
    padding-bottom: 12px;
    border-bottom: 2px solid #3b82f6;
    letter-spacing: -0.025em;
}

.valuation-card {
    background: #1e293b;
    color: white;
    padding: 32px;
    border-radius: 8px;
    margin: 24px 0;
    text-align: center;
    border: 1px solid #334155;
}

.valuation-value {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 8px;
    font-variant-numeric: tabular-nums;
}

.valuation-method {
    color: #cbd5e1;
    font-size: 1rem;
    font-weight: 500;
}

.revenue-line {
    border-left-color: #28a745 !important;
}

.expense-line {
    border-left-color: #dc3545 !important;
}

.profit-line {
    border-left-color: #667eea !important;
}

.valuation-line {
    border-left-color: #ffc107 !important;
}

.industry-insights {
    background: linear-gradient(135deg, #17a2b8 0%, #138496 100%);
    color: white;
    padding: 20px;
    border-radius: 10px;
    margin: 20px 0;
}

.benchmark-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 15px;
    margin-top: 15px;
}

.benchmark-item {
    background: rgba(255, 255, 255, 0.1);
    padding: 15px;
    border-radius: 8px;
}

/* Food & Restaurant specific styling */
.food-metrics {
    border-left-color: #fd7e14 !important;
}

.kitchen-metrics {
    border-left-color: #e83e8c !important;
}

.delivery-metrics {
    border-left-color: #20c997 !important;
}

/* E-commerce & Retail specific styling */
.ecommerce-metrics {
    border-left-color: #6f42c1 !important;
}

.retail-metrics {
    border-left-color: #fd7e14 !important;
}

/* Manufacturing & Services */
.manufacturing-metrics {
    border-left-color: #6c757d !important;
}

.consulting-metrics {
    border-left-color: #17a2b8 !important;
}

/* Collapse Button Styles */
.collapse-button {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #3b82f6;
    color: white;
    border: none;
    border-radius: 8px;
    padding: 8px 16px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.collapse-button:hover {
    background: #2563eb;
    transform: translateY(-1px);
}

.collapse-button:active {
    transform: translateY(0);
}

#collapseIcon {
    font-size: 12px;
    transition: transform 0.2s ease;
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    .container {
        margin: 0;
        min-height: 100vh;
    }

    .header {
        padding: 20px 16px;
        text-align: center;
    }

    .header h1 {
        font-size: 1.75rem;
        margin-bottom: 8px;
    }

    .header p {
        font-size: 1rem;
        line-height: 1.5;
    }

    .business-selector {
        padding: 20px 16px;
    }

    .business-selector>div:first-child {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 16px;
    }

    .section-title {
        font-size: 1.25rem !important;
        margin-bottom: 8px !important;
    }

    .currency-selector {
        order: -1;
        width: 100%;
        display: flex;
        justify-content: space-between;
        align-items: center;
    }

    .collapse-button {
        align-self: flex-end;
        margin-top: 8px;
    }

    .business-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .business-card {
        padding: 16px;
        text-align: center;
    }

    .business-card h3 {
        font-size: 1rem;
        margin-bottom: 8px;
    }

    .business-card p {
        font-size: 0.875rem;
        line-height: 1.4;
    }

    .content {
        padding: 20px 16px;
    }

    .assumptions-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .assumption-group {
        padding: 16px;
    }

    .assumption-group h3 {
        font-size: 1.125rem;
    }

    .tab-nav {
        padding: 0 16px;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .tab-nav button {
        white-space: nowrap;
        font-size: 0.875rem;
        padding: 12px 16px;
    }

    .table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        margin: 0 -16px;
        padding: 0 16px;
    }

    table {
        min-width: 600px;
    }

    .generate-btn,
    .download-btn {
        width: 100%;
        padding: 16px;
        font-size: 1rem;
    }

    .industry-insights {
        padding: 16px;
    }

    .benchmark-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .notification {
        margin: 0 16px;
        left: 16px;
        right: 16px;
        width: auto;
    }
}

/* Tablet Responsiveness */
@media (max-width: 1024px) and (min-width: 769px) {
    .header {
        padding: 28px 24px;
    }

    .business-selector {
        padding: 32px 24px;
    }

    .content {
        padding: 32px 24px;
    }

    .business-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .assumptions-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Small Mobile Devices */
@media (max-width: 480px) {
    .header h1 {
        font-size: 1.5rem;
    }

    .header p {
        font-size: 0.875rem;
    }

    .business-selector {
        padding: 16px 12px;
    }

    .content {
        padding: 16px 12px;
    }

    .table-container {
        margin: 0 -12px;
        padding: 0 12px;
    }

    .currency-selector {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .currency-selector select {
        width: 100%;
    }

    .notification {
        margin: 0 12px;
        left: 12px;
        right: 12px;
    }
}

/* Charts Styles */
.charts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(480px, 1fr));
    gap: 24px;
    margin-top: 24px;
}

.chart-container {
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.chart-container h3 {
    margin: 0 0 16px 0;
    font-size: 1.125rem;
    font-weight: 600;
    color: #1e293b;
    text-align: center;
}

.chart-container canvas {
    max-width: 100%;
    max-height: 400px;
    width: 100% !important;
    height: 300px !important;
}

/* Mobile Charts Responsiveness */
@media (max-width: 768px) {
    .charts-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .chart-container {
        padding: 16px;
    }

    .chart-container h3 {
        font-size: 1rem;
    }
}

/* Balance Sheet Table Styles */
.section-header {
    background-color: #1e293b !important;
    color: white !important;
    font-weight: 700 !important;
    text-align: center !important;
    padding: 12px !important;
}

.section-label {
    background-color: #f1f5f9 !important;
    font-weight: 600 !important;
    font-style: italic !important;
    color: #475569 !important;
    padding: 8px 12px !important;
}

.subtotal-label {
    font-weight: 600 !important;
    background-color: #f8fafc !important;
    border-top: 1px solid #cbd5e1 !important;
}

.subtotal-value {
    font-weight: 600 !important;
    background-color: #f8fafc !important;
    border-top: 1px solid #cbd5e1 !important;
}

.total-label {
    font-weight: 700 !important;
    background-color: #e2e8f0 !important;
    border-top: 2px solid #475569 !important;
    border-bottom: 2px solid #475569 !important;
}

.total-value {
    font-weight: 700 !important;
    background-color: #e2e8f0 !important;
    border-top: 2px solid #475569 !important;
    border-bottom: 2px solid #475569 !important;
}

/* Tab Header Styling */
.tab-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.tab-header h2 {
    margin: 0;
    flex: 1;
}

/* Export Button Styling - Consistent across all tabs */
.export-btn {
    background: #10b981;
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.9rem;
    min-width: 160px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.export-btn:hover {
    background: #059669;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.3);
}

.export-btn:active {
    transform: translateY(0);
    box-shadow: 0 1px 4px rgba(16, 185, 129, 0.3);
}

.export-btn:disabled {
    background: #9ca3af;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Dashboard specific styling improvements */
.section-title {
    color: #1e293b;
    font-size: 1.875rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    text-align: center;
}

.metrics-preview {
    background: #f1f5f9;
    color: #475569;
    font-weight: 500;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    font-size: 0.8rem;
    text-align: center;
}

.model-btn {
    background: #3b82f6;
    color: white;
    border: none;
    padding: 0.875rem 1.5rem;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.875rem;
    width: 100%;
    box-shadow: 0 2px 4px rgba(59, 130, 246, 0.2);
}

.model-btn:hover {
    background: #2563eb;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

/* Improve tab styling for better contrast */
.tabs {
    background: #f8fafc;
    border-bottom: 2px solid #e2e8f0;
    padding: 0 2.5rem;
    overflow-x: auto;
    scrollbar-width: thin;
}

.tab {
    padding: 1rem 1.5rem;
    color: #64748b;
    font-weight: 500;
    border-bottom: 3px solid transparent;
    transition: all 0.3s ease;
}

.tab:hover {
    color: #1e293b;
    background: #f1f5f9;
}

.tab.active {
    color: #3b82f6;
    background: white;
    border-bottom-color: #3b82f6;
    font-weight: 600;
}

/* Better content padding consistency */
.content {
    padding: 2.5rem;
    background: #ffffff;
}

/* Improve table header contrast */
th {
    background: #1e293b;
    color: #ffffff;
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 1rem;
}

/* Better metric card styling */
.metric-card {
    background: white;
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    border: 1px solid #e2e8f0;
    border-left: 4px solid #059669;
    transition: all 0.3s ease;
}

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

/* Responsive design improvements */
@media (max-width: 768px) {
    .header {
        padding: 1.5rem;
    }

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

    .business-selector,
    .content {
        padding: 1.5rem;
    }

    .business-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .tabs {
        padding: 0 1.5rem;
    }

    .tab {
        min-width: 120px;
        padding: 0.875rem 1rem;
        font-size: 0.8rem;
    }

    .tab-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    .export-btn {
        align-self: stretch;
        justify-content: center;
    }

    .assumptions-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
}

@media (max-width: 480px) {
    .header h1 {
        font-size: 1.5rem;
    }

    .header p {
        font-size: 1rem;
    }

    .section-title {
        font-size: 1.5rem;
    }
}

/* Touch-friendly improvements */
@media (hover: none) and (pointer: coarse) {

    .business-card,
    .tab,
    .generate-btn,
    .export-btn,
    .model-btn {
        min-height: 44px;
        /* iOS recommended touch target */
    }

    .business-card:hover {
        transform: translateY(-2px);
        /* Reduced hover effect for touch */
    }
}

/* Safe area support for notched devices */
@supports (padding: max(0px)) {
    .container {
        padding-left: max(1.5rem, env(safe-area-inset-left));
        padding-right: max(1.5rem, env(safe-area-inset-right));
    }
}

/* Navigation responsive styles */
@media (max-width: 768px) {
    .nav-container {
        padding: 0 1rem;
    }

    .nav-links {
        gap: 1rem;
        flex-wrap: wrap;
    }

    .nav-link {
        font-size: 0.9rem;
    }

    .business-type-indicator {
        font-size: 0.8rem;
        padding: 0.4rem 0.8rem;
    }
}

@media (max-width: 480px) {
    .nav-links {
        flex-direction: column;
        gap: 0.5rem;
        align-items: flex-end;
    }

    .business-type-indicator {
        margin-top: 0.5rem;
    }
}