/* Professional Investment-Ready Styling */

/* Typography & Font Loading */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

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

html {
    scroll-behavior: smooth;
    font-size: 16px;
    line-height: 1.5;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-feature-settings: 'kern' 1, 'liga' 1, 'calt' 1, 'ss01' 1;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    color: #1a1a1a;
    background-color: #ffffff;
    overflow-x: hidden;
}

/* Dark mode styles */
.dark body {
    background-color: #0f172a;
    color: #e2e8f0;
}

/* Professional Typography Scale */
h1, h2, h3, h4, h5, h6 {
    font-family: 'Inter', sans-serif;
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: -0.02em;
    color: #0a0a0a;
    margin-bottom: 1rem;
}

.dark h1, .dark h2, .dark h3, .dark h4, .dark h5, .dark h6 {
    color: #f8fafc;
}

h1 {
    font-size: clamp(2.5rem, 4vw, 3.5rem);
    font-weight: 800;
    line-height: 1.1;
}

h2 {
    font-size: clamp(2rem, 3vw, 2.75rem);
    font-weight: 700;
    line-height: 1.15;
}

h3 {
    font-size: clamp(1.5rem, 2.5vw, 2rem);
    font-weight: 600;
    line-height: 1.3;
}

h4 {
    font-size: clamp(1.25rem, 2vw, 1.5rem);
    font-weight: 600;
}

p {
    font-size: 1.125rem;
    line-height: 1.7;
    color: #4a4a4a;
    margin-bottom: 1.5rem;
    font-weight: 400;
}

.dark p {
    color: #cbd5e1;
}

/* Professional Container System */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
}

.section {
    padding: 5rem 0;
}

.section-sm {
    padding: 3rem 0;
}

/* Enhanced Tables */
table {
    width: 100%;
    border-collapse: collapse;
    margin: 2rem 0;
    background: #ffffff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    border: 1px solid #e5e7eb;
}

.dark table {
    background: #1e293b;
    border-color: #334155;
}

th {
    background: linear-gradient(135deg, #1f2937 0%, #374151 100%);
    color: #ffffff;
    padding: 1.25rem 1.5rem;
    text-align: left;
    font-weight: 600;
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 2px solid #374151;
}

td {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid #f3f4f6;
    font-size: 0.95rem;
    line-height: 1.6;
    color: #374151;
}

.dark td {
    border-bottom-color: #374151;
    color: #cbd5e1;
}

tr:hover {
    background-color: #f8fafc;
    transition: background-color 0.2s ease;
}

.dark tr:hover {
    background-color: #374151;
}

tr:last-child td {
    border-bottom: none;
}

/* Professional Lists */
ul, ol {
    margin: 1.5rem 0;
    padding-left: 0;
}

li {
    position: relative;
    padding: 0.75rem 0 0.75rem 2.5rem;
    margin-bottom: 0.5rem;
    line-height: 1.6;
    color: #374151;
    font-size: 1.05rem;
}

.dark li {
    color: #cbd5e1;
}

ul li::before {
    content: '';
    position: absolute;
    left: 0;
    top: 1.2rem;
    width: 6px;
    height: 6px;
    background: #059669;
    border-radius: 50%;
    transform: translateY(-50%);
}

/* Professional Buttons */
button, .btn {
    font-family: 'Inter', sans-serif;
    font-weight: 600;
    font-size: 0.95rem;
    padding: 0.875rem 1.75rem;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    display: inline-block;
    text-align: center;
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(5, 150, 105, 0.25);
}

button:hover, .btn:hover {
    background: linear-gradient(135deg, #047857 0%, #065f46 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(5, 150, 105, 0.35);
}

/* Professional Cards */
.card {
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 2rem;
  margin: 1.5rem 0;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.06);
  transition: all 0.3s ease;
}

.dark .card {
  background: #1e293b;
  border: 1px solid #475569;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

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

.dark .card:hover {
  background: #2d3748;
  border-color: #4a5568;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.4);
}

/* Professional Metric Cards */
.metric-card {
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
    color: #ffffff;
    padding: 2rem;
    border-radius: 16px;
    text-align: center;
    box-shadow: 0 8px 25px rgba(5, 150, 105, 0.25);
    transition: all 0.3s ease;
    margin: 1rem 0;
}

.metric-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 12px 40px rgba(5, 150, 105, 0.35);
}

.metric-value {
    font-size: 2.5rem;
    font-weight: 800;
    margin-bottom: 0.5rem;
    display: block;
}

.metric-label {
    font-size: 0.875rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    opacity: 0.9;
}

/* Print Button */
.print-button {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
    color: white;
    border: none;
    padding: 1rem 1.5rem;
    border-radius: 12px;
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 600;
    box-shadow: 0 4px 15px rgba(5, 150, 105, 0.3);
    transition: all 0.3s ease;
}

.print-button:hover {
    background: linear-gradient(135deg, #047857 0%, #065f46 100%);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(5, 150, 105, 0.4);
}

/* Loading Indicators - Fixed to prevent fullscreen overlay */
.loading-indicator {
    display: none !important;
}
.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #e5e7eb;
    border-top-color: #059669;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.dark .loading-spinner {
    border-color: #374151;
    border-top-color: #34d399;
}

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

.refresh-indicator {
    position: fixed;
    top: 20px;
    right: 20px;
    background: rgba(5, 150, 105, 0.9);
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 0.875rem;
    z-index: 1000;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.refresh-indicator .loading-spinner {
    width: 16px;
    height: 16px;
    border-width: 2px;
    border-color: rgba(255, 255, 255, 0.3);
    border-top-color: white;
}

/* Alert System */
.alert {
    position: fixed;
    top: 20px;
    right: 20px;
    min-width: 300px;
    padding: 1rem;
    border-radius: 8px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
    z-index: 10000;
    animation: slideInRight 0.3s ease;
}

.alert-error {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #991b1b;
}

.dark .alert-error {
    background: #7f1d1d;
    border-color: #991b1b;
    color: #fca5a5;
}

.alert-content {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
}

.alert-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: background-color 0.2s;
}

.alert-close:hover {
    background: rgba(0, 0, 0, 0.1);
}

.dark .alert-close:hover {
    background: rgba(255, 255, 255, 0.1);
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

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

/* Enhanced Metric Cards */
.metric-change {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(4px);
}

.kpi-card {
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
}

.kpi-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15);
}

.kpi-card:focus {
    outline: 2px solid #059669;
    outline-offset: 2px;
}

/* Chart Container */
.chart-container {
    position: relative;
    height: 300px;
    margin: 1rem 0;
}

/* Update Notification */
.update-notification {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
    z-index: 10000;
    min-width: 320px;
    text-align: center;
}

.dark .update-notification {
    background: #1e293b;
    border-color: #374151;
    color: #f1f5f9;
}

.update-content {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    align-items: center;
}

.btn-update, .btn-dismiss {
    padding: 0.5rem 1rem;
    border-radius: 6px;
    border: none;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.875rem;
}

.btn-update {
    background: #059669;
    color: white;
}

.btn-update:hover {
    background: #047857;
    transform: translateY(-1px);
}

.btn-dismiss {
    background: #6b7280;
    color: white;
    margin-left: 0.5rem;
}

.btn-dismiss:hover {
    background: #4b5563;
}

/* Field Errors */
.field-error {
    color: #dc2626;
    font-size: 0.875rem;
    margin-top: 0.25rem;
    padding: 0.25rem 0;
}

.dark .field-error {
    color: #fca5a5;
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 0 1rem;
    }
    
    .section {
        padding: 3rem 0;
    }
    
    .card {
        padding: 1.5rem;
    }
    
    h1 {
        font-size: 2rem;
    }
    
    h2 {
        font-size: 1.5rem;
    }
    
    .alert {
        left: 10px;
        right: 10px;
        min-width: auto;
    }
    
    .loading-indicator p {
        font-size: 0.875rem;
    }
    
    .chart-container {
        height: 250px;
    }
    
    .update-notification {
        left: 20px;
        right: 20px;
        transform: none;
        min-width: auto;
    }
}
