/* Custom CSS for The Ambidextrous Startup Dashboard */

/* Dark mode support */
.dark {
    color-scheme: dark;
}

.dark body {
    background-color: #0f172a;
    color: #e2e8f0;
}

.dark .bg-white {
    background-color: #1e293b;
}

.dark .bg-gray-50 {
    background-color: #0f172a;
}

.dark .text-gray-900 {
    color: #e2e8f0;
}

.dark .text-gray-700 {
    color: #cbd5e1;
}

.dark .text-gray-600 {
    color: #94a3b8;
}

.dark .border-gray-200 {
    border-color: #334155;
}

.dark .card-shadow {
    box-shadow: 0 10px 25px rgba(0,0,0,0.3);
}

.dark .mermaid-container {
    background: #1e293b;
}

.dark .mermaid-container::after {
    background: rgba(30, 41, 59, 0.9);
    color: #cbd5e1;
}

/* Timeline Styles */
.timeline {
    position: relative;
    padding: 2rem 0;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 50%;
    top: 0;
    bottom: 0;
    width: 2px;
    background: linear-gradient(180deg, #667eea 0%, #764ba2 100%);
    transform: translateX(-50%);
}

.timeline-item {
    position: relative;
    margin-bottom: 3rem;
    width: 100%;
}

.timeline-item:nth-child(odd) .timeline-content {
    margin-left: 0;
    margin-right: 52%;
    text-align: right;
}

.timeline-item:nth-child(even) .timeline-content {
    margin-left: 52%;
    margin-right: 0;
    text-align: left;
}

.timeline-marker {
    position: absolute;
    left: 50%;
    top: 1rem;
    width: 1rem;
    height: 1rem;
    background: #667eea;
    border-radius: 50%;
    transform: translateX(-50%);
    box-shadow: 0 0 0 4px white, 0 0 0 6px #667eea;
    z-index: 10;
}

.dark .timeline-marker {
    box-shadow: 0 0 0 4px #1e293b, 0 0 0 6px #667eea;
}

.timeline-content {
    background: white;
    padding: 1.5rem;
    border-radius: 0.75rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    border-left: 4px solid #667eea;
}

.dark .timeline-content {
    background: #1e293b;
    border-left-color: #667eea;
}

.timeline-date {
    font-size: 0.875rem;
    color: #667eea;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

/* Responsive timeline */
@media (max-width: 768px) {
    .timeline::before {
        left: 1rem;
    }
    
    .timeline-marker {
        left: 1rem;
    }
    
    .timeline-item:nth-child(odd) .timeline-content,
    .timeline-item:nth-child(even) .timeline-content {
        margin-left: 3rem;
        margin-right: 0;
        text-align: left;
    }
}

/* Custom scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f5f9;
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, #667eea 0%, #764ba2 100%);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, #5a67d8 0%, #6b46c1 100%);
}

.dark ::-webkit-scrollbar-track {
    background: #1e293b;
}

/* Animation keyframes */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

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

.animate-fade-in-up {
    animation: fadeInUp 0.6s ease-out;
}

.animate-slide-in-left {
    animation: slideInLeft 0.6s ease-out;
}

.animate-slide-in-right {
    animation: slideInRight 0.6s ease-out;
}

/* Interactive elements */
.interactive-element {
    cursor: pointer;
    transition: all 0.3s ease;
}

.interactive-element:hover {
    transform: scale(1.02);
}

/* Collapsible sections */
.collapsible-header {
    cursor: pointer;
    user-select: none;
    transition: all 0.3s ease;
}

.collapsible-header:hover {
    background-color: rgba(102, 126, 234, 0.05);
}

.collapsible-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.5s ease-out;
}

.collapsible-content.expanded {
    max-height: 2000px;
}

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

.expand-icon.rotated {
    transform: rotate(180deg);
}

/* Metric cards animation */
.metric-card {
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.metric-card::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(45deg, transparent, rgba(255,255,255,0.1), transparent);
    transform: rotate(45deg);
    transition: all 0.6s ease;
    opacity: 0;
}

.metric-card:hover::before {
    animation: shimmer 0.6s ease-in-out;
}

@keyframes shimmer {
    0% {
        transform: translateX(-100%) translateY(-100%) rotate(45deg);
        opacity: 0;
    }
    50% {
        opacity: 1;
    }
    100% {
        transform: translateX(100%) translateY(100%) rotate(45deg);
        opacity: 0;
    }
}

/* Print styles */
@media print {
    .fixed,
    nav,
    footer {
        display: none !important;
    }
    
    .section-animate {
        opacity: 1 !important;
        transform: none !important;
    }
    
    .card-shadow {
        box-shadow: none;
        border: 1px solid #e5e7eb;
    }
    
    .gradient-bg {
        background: white !important;
        color: black !important;
    }
    
    .bg-white {
        background: white !important;
    }
    
    body {
        background: white !important;
        color: black !important;
        font-size: 12pt;
        line-height: 1.4;
    }
    
    h1, h2, h3, h4, h5, h6 {
        color: black !important;
        page-break-after: avoid;
    }
    
    .timeline::before {
        background: black !important;
    }
    
    .timeline-marker {
        background: black !important;
        box-shadow: 0 0 0 4px white, 0 0 0 6px black !important;
    }
}

/* Accessibility improvements */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    .section-animate {
        opacity: 1;
        transform: none;
    }
}

/* Focus styles for keyboard navigation */
.focus\:ring-2:focus {
    outline: none;
    box-shadow: 0 0 0 2px #667eea;
}

/* Loading states */
.loading-skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, transparent 37%, #f0f0f0 63%);
    background-size: 400% 100%;
    animation: loading 1.4s ease-in-out infinite;
}

.dark .loading-skeleton {
    background: linear-gradient(90deg, #374151 25%, transparent 37%, #374151 63%);
    background-size: 400% 100%;
}

@keyframes loading {
    0% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

/* Chart container responsive sizing */
.chart-container {
    position: relative;
    height: 400px;
    width: 100%;
}

@media (max-width: 768px) {
    .chart-container {
        height: 300px;
    }
}

/* Mermaid diagram responsive sizing */
.mermaid-container {
    width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 1rem 0;
}

.mermaid {
    width: 100%;
    min-height: 300px;
}

/* Mobile-specific Mermaid adjustments */
@media (max-width: 640px) {
    .mermaid-container {
        overflow-x: scroll;
        -webkit-overflow-scrolling: touch;
        padding: 0.5rem;
        background: #f9fafb;
        border-radius: 0.5rem;
        margin: 1rem 0;
    }
    
    .mermaid {
        min-width: 600px; /* Ensure minimum width for readability */
        min-height: 400px;
    }
    
    /* Add scroll hint for mobile users */
    .mermaid-container::after {
        content: '← Swipe to explore →';
        display: block;
        text-align: center;
        font-size: 0.75rem;
        color: #6b7280;
        padding: 0.5rem;
        background: rgba(255, 255, 255, 0.9);
        border-radius: 0.25rem;
        margin-top: 0.5rem;
    }
}

@media (max-width: 480px) {
    .mermaid {
        min-width: 500px;
        min-height: 350px;
    }
}

/* Tooltip styles */
.tooltip {
    position: relative;
    cursor: help;
}

.tooltip::before,
.tooltip::after {
    position: absolute;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    z-index: 1000;
}

.tooltip::before {
    content: attr(data-tooltip);
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 0.5rem;
    border-radius: 0.25rem;
    font-size: 0.875rem;
    white-space: nowrap;
    margin-bottom: 0.25rem;
}

.tooltip::after {
    content: '';
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: rgba(0, 0, 0, 0.8);
}

.tooltip:hover::before,
.tooltip:hover::after {
    opacity: 1;
}

/* Status indicators */
.status-indicator {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 8px;
}

.status-h1 {
    background-color: #3b82f6;
}

.status-h2 {
    background-color: #10b981;
}

.status-h3 {
    background-color: #8b5cf6;
}

/* Mobile enhancements */
@media (max-width: 640px) {
    .hero-title {
        font-size: 2rem;
        line-height: 1.2;
    }
    
    .metric-card {
        text-align: center;
        margin-bottom: 1rem;
    }
    
    .grid-responsive {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .gradient-bg {
        background: #000;
        color: #fff;
    }
    
    .card-shadow {
        border: 2px solid #000;
        box-shadow: none;
    }
    
    .timeline-marker {
        background: #000;
        box-shadow: 0 0 0 4px #fff, 0 0 0 6px #000;
    }
}