/* custom.css */

/* Base Theme Colors */
:root {
    --bg-primary: #111827;
    --bg-secondary: #1f2937;
    --bg-tertiary: #374151;
    --text-primary: #f3f4f6;
    --text-secondary: #9ca3af;
    --accent-primary: #3b82f6;
    --accent-hover: #2563eb;
    --accent-light: #60a5fa;
    --success: #34d399;
    --error: #ef4444;
    --warning: #fbbf24;
    --border-color: #374151;
}

/* Reset and Base Styles */
body {
    background-color: var(--bg-primary);
    color: var(--text-primary);
}

/* Animation Keyframes */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes pulse {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
    100% {
        transform: scale(1);
    }
}

/* Enhanced Progress Bar Styles (kept for transcription/save overlays) */
@keyframes progressPulse {
    0%, 100% { 
        opacity: 1; 
    }
    50% { 
        opacity: 0.7; 
    }
}

@keyframes progressCircleRotate {
    0% { 
        transform: rotate(-90deg) scale(1); 
    }
    50% { 
        transform: rotate(-90deg) scale(1.02); 
    }
    100% { 
        transform: rotate(-90deg) scale(1); 
    }
}

.panel-loading {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(17, 24, 39, 0.95);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    border-radius: 8px;
}

.progress-circle {
    transition: stroke-dashoffset 0.5s ease-out;
    filter: drop-shadow(0 0 6px rgba(59, 130, 246, 0.4));
    animation: progressCircleRotate 3s ease-in-out infinite;
}

.progress-bar {
    background: linear-gradient(90deg, #3b82f6, #60a5fa);
    box-shadow: 0 0 10px rgba(59, 130, 246, 0.3);
    animation: progressPulse 2s ease-in-out infinite;
}

.progress-percentage {
    font-weight: 600;
    text-shadow: 0 0 8px rgba(59, 130, 246, 0.5);
}

.loading-message {
    animation: fadeIn 0.3s ease-out;
}

.timer-display {
    font-family: 'JetBrains Mono', 'Consolas', monospace;
    animation: fadeIn 0.5s ease-out;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

/* Animation Classes */
.animate-fade-in {
    animation: fadeIn 0.6s ease-out forwards;
}

.animate-fade-in-delay {
    animation: fadeIn 0.6s ease-out 0.3s forwards;
    opacity: 0;
}

.animate-fade-in-delay-2 {
    animation: fadeIn 0.6s ease-out 0.6s forwards;
    opacity: 0;
}

/* Split-screen Animation */
@keyframes transformContent {
    0% {
        opacity: 0.7;
        transform: scale(0.98);
    }
    50% {
        opacity: 0.9;
        transform: scale(1.02);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

.format-transform {
    animation: transformContent 0.8s ease-in-out forwards;
}

/* ═══════════════════════════════════════════════════════
   LIVE TEMPLATE MORPHING — Report Generation Animation
   ═══════════════════════════════════════════════════════ */

/* State: panel is in "generating" mode */
.report-generating {
    position: relative;
    overflow: hidden;
}

/* ── Scan Beam: glowing line that sweeps top-to-bottom ── */
@keyframes scanBeamSweep {
    0%   { top: -2px; opacity: 0; }
    5%   { opacity: 1; }
    95%  { opacity: 1; }
    100% { top: 100%; opacity: 0; }
}

.report-scan-beam {
    position: absolute;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, 
        transparent 0%, 
        rgba(59, 130, 246, 0.3) 15%, 
        rgba(59, 130, 246, 0.9) 50%, 
        rgba(59, 130, 246, 0.3) 85%, 
        transparent 100%);
    box-shadow: 
        0 0 12px rgba(59, 130, 246, 0.5),
        0 0 30px rgba(59, 130, 246, 0.2);
    z-index: 5;
    pointer-events: none;
    will-change: top, opacity;
    animation: scanBeamSweep 4s ease-in-out infinite;
}

/* ── Thin top progress bar ── */
.report-progress-bar {
    position: absolute;
    top: 0;
    left: 0;
    height: 4px;
    background: linear-gradient(90deg, #3b82f6, #60a5fa, #93c5fd);
    z-index: 6;
    border-radius: 0 1px 1px 0;
    transition: width 0.4s ease-out;
    will-change: width;
    box-shadow: 0 0 8px rgba(59, 130, 246, 0.4);
}

/* ── Section highlighting: text-selection sweep (left → right) ── */
@keyframes selectionSweep {
    0%   { background-size: 0% 100%; }
    20%  { background-size: 100% 100%; }
    70%  { background-size: 100% 100%; }
    100% { background-size: 0% 100%; background-position: right center; }
}

.report-generating .report-section-scanning {
    background: linear-gradient(90deg, 
        rgba(59, 130, 246, 0.25) 0%, 
        rgba(59, 130, 246, 0.18) 100%);
    background-repeat: no-repeat;
    background-position: left center;
    background-size: 0% 100%;
    animation: selectionSweep 0.25s ease-in-out forwards;
    will-change: background-size;
}

/* Text inside the highlighted section gets a slight brightness boost */
.report-generating .report-text-shimmer {
    animation: none;
}

/* ── Status Pill (compact, bottom of panel) ── */
.report-status-pill {
    position: absolute;
    bottom: 12px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(17, 24, 39, 0.9);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(59, 130, 246, 0.3);
    border-radius: 20px;
    padding: 6px 16px;
    z-index: 8;
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
    will-change: opacity;
    animation: fadeIn 0.3s ease-out;
}

.report-status-pill .status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #3b82f6;
    animation: progressPulse 1.5s ease-in-out infinite;
}

.report-status-pill .status-text {
    font-size: 11px;
    color: #93c5fd;
    font-weight: 500;
    transition: opacity 0.15s ease-in-out;
}

/* ── Crossfade transition for content swap ── */
@keyframes contentCrossfadeOut {
    0%   { opacity: 1; transform: translateY(0); }
    100% { opacity: 0; transform: translateY(-6px); }
}

@keyframes contentCrossfadeIn {
    0%   { opacity: 0; transform: translateY(6px); }
    100% { opacity: 1; transform: translateY(0); }
}

.report-crossfade-out {
    animation: contentCrossfadeOut 0.3s ease-in forwards;
    will-change: opacity, transform;
}

.report-crossfade-in {
    animation: contentCrossfadeIn 0.4s ease-out forwards;
    will-change: opacity, transform;
}

/* Staggered reveal for report elements */
.report-element-reveal {
    opacity: 0;
    transform: translateY(4px);
    animation: contentCrossfadeIn 0.35s ease-out forwards;
    will-change: opacity, transform;
}

/* ── Progressive Report Block Reveal ── */
@keyframes reportBlockReveal {
    0%   { opacity: 0; transform: translateY(6px); }
    100% { opacity: 1; transform: translateY(0); }
}

.report-block-hidden {
    opacity: 0 !important;
    transform: translateY(6px);
}

.report-block-revealed {
    animation: reportBlockReveal 0.28s ease-out forwards;
    will-change: opacity, transform;
}

/* ── Completion flash ── */
@keyframes completionFlash {
    0%   { box-shadow: inset 0 0 0 0 rgba(52, 211, 153, 0); }
    50%  { box-shadow: inset 0 0 0 2px rgba(52, 211, 153, 0.4); }
    100% { box-shadow: inset 0 0 0 0 rgba(52, 211, 153, 0); }
}

.report-complete-flash {
    animation: completionFlash 0.8s ease-out;
}

/* ── Inline Rich Text Editor Toolbar ── */
.report-editor-toolbar {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 2px;
    padding: 4px 6px;
    background: rgba(30, 41, 59, 0.95);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px 6px 0 0;
    margin: -0.75rem -0.75rem 0.5rem -0.75rem;
}

.report-editor-toolbar button {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 30px;
    height: 28px;
    padding: 0 6px;
    border: none;
    border-radius: 4px;
    background: transparent;
    color: #d1d5db;
    font-size: 0.75rem;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
}

.report-editor-toolbar button:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #f3f4f6;
}

.report-editor-toolbar button.active {
    background: rgba(96, 165, 250, 0.2);
    color: #60a5fa;
}

.report-editor-toolbar .toolbar-separator {
    width: 1px;
    height: 20px;
    background: rgba(255, 255, 255, 0.12);
    margin: 0 3px;
    flex-shrink: 0;
}

.report-editor-toolbar select {
    height: 28px;
    padding: 0 4px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.06);
    color: #d1d5db;
    font-size: 0.7rem;
    cursor: pointer;
    outline: none;
}

.report-editor-toolbar select:focus {
    border-color: #60a5fa;
}

.report-editor-toolbar select option {
    background: #1e293b;
    color: #d1d5db;
}

/* Edit mode indicator */
#report-results-content.editing {
    outline: 1px dashed rgba(96, 165, 250, 0.35);
    outline-offset: 2px;
    min-height: 200px;
    cursor: text;
}

#report-results-content.editing:focus {
    outline-color: rgba(96, 165, 250, 0.5);
}

/* Table context menu (add/remove row/col) */
.table-context-menu {
    position: absolute;
    z-index: 30;
    background: rgba(30, 41, 59, 0.97);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 6px;
    padding: 4px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.table-context-menu button {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    border: none;
    border-radius: 4px;
    background: transparent;
    color: #d1d5db;
    font-size: 0.72rem;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.1s ease;
}

.table-context-menu button:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #f3f4f6;
}

.table-context-menu button.danger {
    color: #f87171;
}

.table-context-menu button.danger:hover {
    background: rgba(248, 113, 113, 0.1);
}

/* Light mode overrides */
body.light-mode .report-editor-toolbar {
    background: rgba(248, 250, 252, 0.97);
    border-bottom-color: #e5e7eb;
}

body.light-mode .report-editor-toolbar button {
    color: #4b5563;
}

body.light-mode .report-editor-toolbar button:hover {
    background: rgba(0, 0, 0, 0.06);
    color: #1f2937;
}

body.light-mode .report-editor-toolbar button.active {
    background: rgba(59, 130, 246, 0.1);
    color: #2563eb;
}

body.light-mode .report-editor-toolbar .toolbar-separator {
    background: #e5e7eb;
}

body.light-mode .report-editor-toolbar select {
    border-color: #d1d5db;
    background: #ffffff;
    color: #374151;
}

body.light-mode .report-editor-toolbar select option {
    background: #ffffff;
    color: #374151;
}

body.light-mode #report-results-content.editing {
    outline-color: rgba(59, 130, 246, 0.3);
}

body.light-mode .table-context-menu {
    background: rgba(255, 255, 255, 0.98);
    border-color: #e5e7eb;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

body.light-mode .table-context-menu button {
    color: #374151;
}

body.light-mode .table-context-menu button:hover {
    background: rgba(0, 0, 0, 0.04);
}

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

::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
    background: var(--accent-light);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--accent-primary);
}

/* Split-screen Layout Styles */
.recorder-container {
    background-color: var(--bg-secondary);
    border-radius: 0.75rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    height: 100%;
}

.format-preview-panel, .report-results-panel {
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    transition: all 0.3s ease;
    min-height: 400px;
    max-height: calc(100vh - 400px); /* Reduced max height to prevent overlap with Generate Report button */
    display: flex;
    flex-direction: column;
    position: relative; /* Ensure proper positioning */
    margin-bottom: 20px; /* Add margin to prevent overlap with Generate Report button */
}

/* Ensure panels are hidden by default, but allow JS to override */
#format-preview-panel.hidden, #report-results-panel.hidden {
    display: none; /* Hide panels when they have the hidden class */
}

/* When not hidden, ensure panels are visible with proper display type */
#format-preview-panel:not(.hidden), #report-results-panel:not(.hidden) {
    display: flex; /* Display as flex when not hidden */
}

/* Panel loading indicator */
.panel-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    background-color: rgba(31, 41, 55, 0.7);
    border-radius: 0.5rem;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10;
}

/* Highlight sections in the format preview */
.format-preview-panel .section-highlight {
    background-color: rgba(59, 130, 246, 0.1);
    border-left: 3px solid var(--accent-primary);
    padding-left: 0.5rem;
    transition: background-color 0.3s ease;
}

/* Mobile Responsive Adjustments */
@media (max-width: 768px) {
    .split-screen-container {
        flex-direction: column;
    }
    
    .format-preview-panel {
        margin-top: 1rem;
        max-height: 400px;
    }
}

/* Navigation Styles */
.nav-dark {
    background-color: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
}

.nav-link {
    color: var(--text-primary);
    transition: color 0.3s ease;
}

.nav-link:hover {
    color: var(--accent-light);
}

.logo-img {
  height: 48px;         /* Sets a comfortable display height */
  width: auto;          /* Maintains the image's aspect ratio */
  max-width: 100px;      /* Prevents the logo from growing too large */
  object-fit: contain;  /* Ensures the image fits well within its bounds */
  display: block;       /* Eliminates any unwanted inline spacing */
  border-radius: 8px;   /* Makes corners slightly rounded */
}

/* Responsive adjustment for mobile devices */
@media (max-width: 640px) {
  .logo-img {
    height: 40px;       /* Slightly smaller on mobile */
    max-width: 80px;
  }
}

/* Hero Section */
.hero-gradient {
  background: linear-gradient(to right, rgba(30, 64, 175, 0.8), rgba(17, 24, 39, 0.8)),
              url('/assets/images/banner.png') center/cover no-repeat;
  border-bottom: 2px solid #374151;
}

/* Card Styles */
.card-dark {
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    transition: all 0.3s ease;
}

.card-dark:hover {
    transform: translateY(-5px);
    border-color: var(--accent-light);
    box-shadow: 0 4px 20px rgba(59, 130, 246, 0.2);
}

/* Pricing Cards */
.pricing-card {
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    transition: all 0.3s ease;
}

.pricing-card.popular {
    border: 2px solid var(--accent-primary);
    transform: scale(1.05);
}

.pricing-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 4px 20px rgba(59, 130, 246, 0.2);
}

/* Button Styles */
.btn-primary {
    background-color: var(--accent-primary);
    color: white;
    transition: all 0.3s ease;
}

.btn-primary:hover {
    background-color: var(--accent-hover);
    transform: translateY(-2px);
}

.btn-secondary {
    background-color: transparent;
    border: 2px solid var(--accent-light);
    color: var(--accent-light);
    transition: all 0.3s ease;
}

.btn-secondary:hover {
    background-color: var(--accent-light);
    color: var(--bg-primary);
    transform: translateY(-2px);
}

/* Form Elements */
.input-dark {
    background-color: var(--bg-primary);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    transition: all 0.3s ease;
}

.input-dark:focus {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
    outline: none;
}

/* Modal Styles */
.modal {
    background-color: rgba(17, 24, 39, 0.95);
    backdrop-filter: blur(4px);
}

.modal-content {
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
}

/* Loading Elements */
.spinner-border {
    border: 3px solid rgba(96, 165, 250, 0.1);
    border-top: 3px solid var(--accent-light);
    border-radius: 50%;
    width: 24px;
    height: 24px;
    animation: spin 1s linear infinite;
}

#loading-overlay {
    background-color: rgba(17, 24, 39, 0.8);
    backdrop-filter: blur(4px);
}

/* Notification Styles */
.notification {
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2);
}

.notification.success {
    border-color: var(--success);
    background-color: rgba(52, 211, 153, 0.1);
}

.notification.error {
    border-color: var(--error);
    background-color: rgba(239, 68, 68, 0.1);
}

.notification.info {
    border-color: var(--accent-light);
    background-color: rgba(96, 165, 250, 0.1);
}

/* Avatar Styles */
.avatar-container {
    background-color: var(--accent-primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 500;
}

/* Features Section */
.feature-card {
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    transition: all 0.3s ease;
}

.feature-card:hover {
    transform: translateY(-5px);
    border-color: var(--accent-light);
    box-shadow: 0 4px 20px rgba(59, 130, 246, 0.2);
}

/* Table Styles */
.table-dark {
    background-color: var(--bg-secondary);
    color: var(--text-primary);
}

.table-dark th {
    background-color: var(--bg-tertiary);
}

.table-dark td {
    border-color: var(--border-color);
}

/* Toast Notifications */
.toast {
    position: fixed;
    bottom: 1rem;
    right: 1rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    border-radius: 0.5rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2);
    transform: translateY(100%);
    opacity: 0;
    transition: all 0.3s ease;
}

.toast.show {
    transform: translateY(0);
    opacity: 1;
}

/* Footer Styles */
.footer-dark {
    background-color: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
}

/* Mobile Menu */
.mobile-menu {
    background-color: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
}

/* Responsive Design */
@media (max-width: 640px) {
    .container {
        padding-left: 1rem;
        padding-right: 1rem;
    }

    .mobile-menu {
        display: block;
    }

    .desktop-menu {
        display: none;
    }
}

/* Print Styles */
@media print {
    body {
        background: white !important;
        color: black !important;
    }

    .no-print {
        display: none !important;
    }

    .container {
        width: 100% !important;
        margin: 0 !important;
        padding: 0 !important;
    }
}

/* Custom Transitions */
.transition-all {
    transition: all 0.3s ease;
}

.hover-translate {
    transition: transform 0.3s ease;
}

.hover-translate:hover {
    transform: translateY(-5px);
}

/* Status Indicators */
.status-active {
    background-color: rgba(52, 211, 153, 0.1);
    color: var(--success);
    border: 1px solid var(--success);
}

.status-inactive {
    background-color: rgba(239, 68, 68, 0.1);
    color: var(--error);
    border: 1px solid var(--error);
}

/* Focus States */
*:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* Testimonial Carousel Styles */
.testimonials-container {
    max-width: 100%;
}

.testimonials-track {
    display: flex;
    transition: transform 0.5s ease-in-out;
}

.testimonial-card {
    min-width: 320px;
    max-width: 384px;
    flex-shrink: 0;
    margin: 0 16px;
}

@media (max-width: 768px) {
    .testimonial-card {
        min-width: 280px;
        max-width: 320px;
        margin: 0 8px;
    }
}

/* Navigation Dots */
#testimonialDots button {
    transition: all 0.3s ease;
    cursor: pointer;
    border: none;
    padding: 0;
}

#testimonialDots button:hover {
    transform: scale(1.2);
}

/* Mobile Performance Updates */
@media (max-width: 768px) {
    .panel-loading,
    .modal,
    #loading-overlay {
        backdrop-filter: none !important;
        -webkit-backdrop-filter: none !important;
    }
    
    .panel-loading {
        background: rgba(17, 24, 39, 0.98);
    }
    
    .modal,
    #loading-overlay {
        background-color: rgba(17, 24, 39, 0.95);
    }

    /* Disable expensive report animations on mobile */
    .report-scan-beam {
        display: none !important;
    }
    
    .report-generating .report-section-scanning,
    .report-generating .report-text-shimmer {
        animation: none !important;
    }
    
    .report-status-pill {
        backdrop-filter: none !important;
        -webkit-backdrop-filter: none !important;
        background: rgba(17, 24, 39, 0.95);
    }
    
    body.light-mode .report-status-pill {
        background: rgba(255, 255, 255, 0.98);
    }

    /* Skip progressive block reveal on mobile — instant display */
    .report-block-hidden {
        opacity: 1 !important;
        transform: none !important;
    }
    .report-block-revealed {
        animation: none !important;
        opacity: 1 !important;
        transform: none !important;
    }

    /* Editor toolbar mobile adjustments */
    .report-editor-toolbar {
        backdrop-filter: none !important;
        -webkit-backdrop-filter: none !important;
        gap: 2px;
        padding: 4px 6px;
        flex-wrap: nowrap;
    }
    .report-editor-toolbar button {
        min-width: 32px;
        height: 30px;
        font-size: 0.75rem;
    }
    .report-editor-toolbar select {
        height: 30px;
        font-size: 0.7rem;
    }
    .report-editor-toolbar .toolbar-desktop-only {
        display: none !important;
    }
}

/* Respect reduced-motion preference */
@media (prefers-reduced-motion: reduce) {
    .report-block-revealed {
        animation: none !important;
        opacity: 1 !important;
        transform: none !important;
    }
    .report-block-hidden {
        opacity: 1 !important;
        transform: none !important;
    }
}
