/* =====================================================
   Homily to Video Generator - Professional Styles
   Dark mode, mobile-first, brand-aligned
   ===================================================== */

/* Reset & Base */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #0b0b14;
    color: #e0e0e0;
    min-height: 100vh;
    line-height: 1.6;
    position: relative;
}

/* Sacred art background — Italian church mosaic */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    background: url('/img/Religious-art-background.png') center center / cover no-repeat;
    opacity: 0.08;
    z-index: 0;
    pointer-events: none;
}

body::after {
    content: '';
    position: fixed;
    inset: 0;
    background: linear-gradient(
        180deg,
        rgba(11, 11, 20, 0.6) 0%,
        rgba(11, 11, 20, 0.35) 40%,
        rgba(11, 11, 20, 0.6) 100%
    );
    z-index: 0;
    pointer-events: none;
}

/* Container */
.hvg-container {
    max-width: 1340px;
    margin: 0 auto;
    padding: 0 24px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    position: relative;
    z-index: 1;
}

/* =====================================================
   Guest Header (standalone navbar)
   ===================================================== */
.hvg-header {
    background: #13131f;
    border-bottom: 1px solid rgba(124, 92, 252, 0.18);
    padding: 0;
    margin-bottom: 0;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 12px rgba(0,0,0,0.35);
}

.hvg-header-inner {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 2rem;
    height: 64px;
}

.hvg-logo {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: inherit;
}

.hvg-logo-img {
    height: 36px;
    width: auto;
    flex-shrink: 0;
}

.hvg-logo h1 {
    font-size: 18px;
    font-weight: 700;
    color: #ffffff;
    margin: 0;
    line-height: 1.2;
}

.hvg-tagline {
    font-size: 11px;
    color: #a78bfa;
    font-weight: 500;
    letter-spacing: 0.3px;
}

.hvg-subtitle {
    color: #7a7a8e;
    font-size: 14px;
    margin-top: 2px;
}

/* =====================================================
   Main Layout — two columns on desktop
   ===================================================== */
.hvg-main {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 28px;
    align-items: start;
    flex: 1;
}

/* =====================================================
   Cards
   ===================================================== */
.hvg-card {
    background: #13132a;
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 16px;
    padding: 28px;
    margin-bottom: 20px;
}

.hvg-card h2 {
    font-size: 16px;
    font-weight: 600;
    color: #ffffff;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.hvg-card h2 i {
    color: #7c5cfc;
    font-size: 15px;
}

/* =====================================================
   Empty State (right column default)
   ===================================================== */
.hvg-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 60px 32px;
    min-height: 340px;
    border: 1px dashed rgba(124, 92, 252, 0.15);
    background: rgba(124, 92, 252, 0.02);
}

.hvg-empty-icon {
    width: 72px;
    height: 72px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: rgba(124, 92, 252, 0.08);
    margin-bottom: 20px;
}

.hvg-empty-icon i {
    font-size: 28px;
    color: #7c5cfc;
    opacity: 0.6;
}

.hvg-empty-state h3 {
    font-size: 17px;
    font-weight: 600;
    color: #c0c0d0;
    margin-bottom: 8px;
}

.hvg-empty-state p {
    font-size: 14px;
    color: #6a6a7e;
    max-width: 320px;
    line-height: 1.5;
}

/* =====================================================
   Form Elements
   ===================================================== */
.hvg-form-group {
    margin-bottom: 18px;
}

.hvg-form-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #a0a0b4;
    margin-bottom: 7px;
}

.hvg-form-group label i {
    margin-right: 5px;
    color: #7c5cfc;
    font-size: 12px;
}

/* Side-by-side dropdowns */
.hvg-form-row {
    display: flex;
    gap: 14px;
}

.hvg-form-half {
    flex: 1;
    min-width: 0;
}

textarea,
select,
input[type="text"] {
    width: 100%;
    background: #0e0e1e;
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 10px;
    padding: 12px 14px;
    color: #e0e0e0;
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.2s, box-shadow 0.2s;
    resize: vertical;
}

textarea:focus,
select:focus,
input[type="text"]:focus {
    outline: none;
    border-color: #7c5cfc;
    box-shadow: 0 0 0 3px rgba(124, 92, 252, 0.12);
}

textarea {
    min-height: 240px;
    line-height: 1.7;
}

select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%236a6a7e'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 36px;
}

input[type="file"] {
    width: 100%;
    background: #0e0e1e;
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 10px;
    padding: 10px 14px;
    color: #e0e0e0;
    font-size: 13px;
    cursor: pointer;
}

.hvg-char-count {
    text-align: right;
    font-size: 12px;
    color: #5a5a6e;
    margin-top: 5px;
}

.hvg-form-hint {
    font-size: 12px;
    color: #6a6a82;
    margin-top: 4px;
    margin-bottom: 18px;
    line-height: 1.4;
    font-style: italic;
}

/* =====================================================
   Buttons
   ===================================================== */
.hvg-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all 0.2s ease;
    text-decoration: none;
    font-family: inherit;
}

.hvg-btn-primary {
    background: linear-gradient(135deg, #7c5cfc, #5a3fd6);
    color: #fff;
    width: 100%;
}

.hvg-btn-primary:hover {
    background: linear-gradient(135deg, #8b6dff, #6b4ee0);
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(124, 92, 252, 0.3);
}

.hvg-btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.hvg-btn-secondary {
    background: rgba(255,255,255,0.06);
    color: #b0b0c4;
    border: 1px solid rgba(255,255,255,0.08);
}

.hvg-btn-secondary:hover {
    background: rgba(255,255,255,0.1);
    color: #fff;
    border-color: rgba(255,255,255,0.14);
}

.hvg-btn-link {
    background: none;
    border: none;
    color: #7c5cfc;
    cursor: pointer;
    font-size: 12px;
    text-decoration: underline;
    padding: 0;
    flex-shrink: 0;
    font-family: inherit;
}

.hvg-btn-link:hover {
    color: #a78bfa;
}

/* =====================================================
   Voice Clone Section (collapsible <details>)
   ===================================================== */
.hvg-voice-clone-section {
    margin-bottom: 20px;
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 10px;
    overflow: hidden;
}

.hvg-voice-clone-section summary {
    padding: 13px 16px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    color: #a0a0b4;
    background: rgba(255,255,255,0.02);
    user-select: none;
    list-style: none;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: background 0.2s;
}

.hvg-voice-clone-section summary:hover {
    background: rgba(255,255,255,0.04);
}

.hvg-voice-clone-section summary i {
    color: #7c5cfc;
}

.hvg-voice-clone-section summary::before {
    content: '\f054';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    font-size: 9px;
    color: #5a5a6e;
    transition: transform 0.2s;
}

.hvg-voice-clone-section[open] summary::before {
    transform: rotate(90deg);
}

.hvg-voice-clone-section summary::-webkit-details-marker {
    display: none;
}

.hvg-clone-inner {
    padding: 18px;
    border-top: 1px solid rgba(255,255,255,0.04);
}

.hvg-clone-inner p {
    font-size: 13px;
    color: #7a7a90;
    margin-bottom: 16px;
    line-height: 1.5;
}

.hvg-clone-status {
    margin-top: 12px;
    font-size: 13px;
    min-height: 20px;
}

.hvg-voice-cloned-banner {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 18px;
    background: rgba(46, 204, 113, 0.08);
    border: 1px solid rgba(46, 204, 113, 0.2);
    border-radius: 10px;
    color: #2ecc71;
    font-size: 14px;
    margin-bottom: 4px;
}

.hvg-voice-cloned-banner i {
    font-size: 18px;
    flex-shrink: 0;
}

.hvg-voice-cloned-banner span {
    flex: 1;
}

/* Info Tooltip */
.hvg-info-tip {
    position: relative;
    display: inline-block;
    cursor: pointer;
    color: #7c5cfc;
}

.hvg-info-tip i {
    font-size: 14px;
}

.hvg-info-tip-content {
    display: none;
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    background: #1a1a34;
    border: 1px solid rgba(124, 92, 252, 0.25);
    border-radius: 10px;
    padding: 14px 16px;
    width: 290px;
    font-size: 12px;
    line-height: 1.7;
    color: #b5b5c6;
    z-index: 10;
    box-shadow: 0 8px 24px rgba(0,0,0,0.5);
}

.hvg-info-tip-content strong {
    color: #e0e0e8;
    display: block;
    margin-bottom: 6px;
}

.hvg-info-tip:hover .hvg-info-tip-content,
.hvg-info-tip:focus .hvg-info-tip-content {
    display: block;
}

/* Audio Source Toggle */
.hvg-audio-source-toggle {
    display: flex;
    gap: 0;
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid rgba(255,255,255,0.08);
}

.hvg-toggle-btn {
    flex: 1;
    padding: 9px 12px;
    background: rgba(255,255,255,0.02);
    border: none;
    color: #7a7a90;
    cursor: pointer;
    font-size: 13px;
    font-family: inherit;
    transition: all 0.2s;
}

.hvg-toggle-btn:first-child {
    border-right: 1px solid rgba(255,255,255,0.08);
}

.hvg-toggle-btn.active {
    background: rgba(124, 92, 252, 0.12);
    color: #a78bfa;
}

.hvg-toggle-btn:hover:not(.active) {
    background: rgba(255,255,255,0.05);
    color: #b5b5c6;
}

/* Voice Recorder */
.hvg-recorder {
    display: flex;
    align-items: center;
    gap: 14px;
}

.hvg-btn-record {
    padding: 10px 20px;
    border-radius: 10px;
    font-size: 14px;
    transition: all 0.2s;
}

.hvg-btn-record.recording {
    background: #e63946 !important;
    color: #fff;
    animation: hvg-pulse-record 1.5s ease-in-out infinite;
}

@keyframes hvg-pulse-record {
    0%, 100% { box-shadow: 0 0 0 0 rgba(230, 57, 70, 0.4); }
    50% { box-shadow: 0 0 0 10px rgba(230, 57, 70, 0); }
}

.hvg-record-timer {
    font-size: 15px;
    font-family: 'SF Mono', 'Fira Code', monospace;
    color: #7a7a90;
    min-width: 50px;
}

#recordingPreview {
    margin-top: 12px;
}

#recordingPreview audio {
    width: 100%;
    height: 36px;
    margin-bottom: 8px;
}

#recordSection .hvg-btn-link {
    margin-top: 4px;
}

/* =====================================================
   Status Card — Processing State
   ===================================================== */
.hvg-status-card {
    border-color: rgba(124, 92, 252, 0.15);
}

.hvg-status-header {
    display: flex;
    align-items: center;
    gap: 18px;
    margin-bottom: 24px;
}

.hvg-status-header h2 {
    margin-bottom: 2px;
    font-size: 18px;
}

.hvg-status-header .hvg-progress-text {
    margin: 0;
}

/* Spinner Ring */
.hvg-spinner-ring {
    width: 48px;
    height: 48px;
    border: 3px solid rgba(124, 92, 252, 0.15);
    border-top-color: #7c5cfc;
    border-radius: 50%;
    animation: hvg-spin 1s linear infinite;
    flex-shrink: 0;
}

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

/* Progress Bar */
.hvg-progress-bar {
    height: 4px;
    background: rgba(255,255,255,0.06);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 8px;
}

.hvg-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #7c5cfc, #a78bfa);
    border-radius: 4px;
    transition: width 0.6s ease;
}

.hvg-progress-text {
    font-size: 13px;
    color: #7a7a90;
}

.hvg-progress-percent {
    text-align: center;
    font-size: 14px;
    font-weight: 600;
    color: #a78bfa;
    margin-top: 4px;
}

/* =====================================================
   Video Preview Card
   ===================================================== */
.hvg-video-wrapper {
    border-radius: 10px;
    overflow: hidden;
    background: #000;
    margin-bottom: 18px;
}

.hvg-video-wrapper video {
    width: 100%;
    display: block;
    max-height: 450px;
}

/* Portrait video — no black bars */
.hvg-video-wrapper.hvg-portrait {
    background: transparent;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.hvg-video-wrapper.hvg-portrait video {
    width: auto;
    max-width: 100%;
    max-height: 520px;
    border-radius: 10px;
    background: #000;
}

.hvg-video-actions {
    display: flex;
    gap: 10px;
    margin-bottom: 18px;
}

.hvg-video-actions .hvg-btn-primary {
    flex: 1;
}

.hvg-video-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 12px 24px;
}

.hvg-meta-item {
    font-size: 13px;
    color: #7a7a90;
}

.hvg-meta-item strong {
    color: #a0a0b4;
    margin-right: 4px;
}

.hvg-meta-item code {
    background: rgba(255,255,255,0.05);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 12px;
    color: #7c5cfc;
    word-break: break-all;
}

/* =====================================================
   Error Card
   ===================================================== */
.hvg-error-card {
    border-color: rgba(230, 57, 70, 0.2);
}

.hvg-error-card h2 i {
    color: #e63946;
}

.hvg-error-message {
    background: rgba(230, 57, 70, 0.06);
    border: 1px solid rgba(230, 57, 70, 0.15);
    border-radius: 10px;
    padding: 16px;
    font-size: 13px;
    color: #ff6b6b;
    margin-bottom: 16px;
    word-break: break-word;
    line-height: 1.5;
}

.hvg-error-meta {
    font-size: 12px;
    color: #5a5a6e;
    margin-top: 12px;
}

.hvg-error-meta code {
    background: rgba(255,255,255,0.05);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 11px;
    color: #e63946;
}

/* =====================================================
   Footer
   ===================================================== */
.hvg-footer {
    text-align: center;
    padding: 24px 0;
    margin-top: 40px;
    border-top: 1px solid rgba(255,255,255,0.04);
}

.hvg-footer p {
    font-size: 12px;
    color: #9a9ab0;
}

.hvg-footer a {
    color: #a78bfa;
    text-decoration: none;
}

.hvg-footer a:hover {
    color: #c4b5fd;
    text-decoration: underline;
}

/* =====================================================
   Toast Notification
   ===================================================== */
.hvg-toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: #1a1a34;
    border: 1px solid rgba(124, 92, 252, 0.25);
    border-radius: 10px;
    padding: 14px 20px;
    font-size: 13px;
    color: #d0d0e0;
    z-index: 9999;
    box-shadow: 0 8px 32px rgba(0,0,0,0.5);
    animation: hvg-slide-up 0.3s ease;
    max-width: 360px;
}

@keyframes hvg-slide-up {
    from { transform: translateY(20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

/* =====================================================
   Mobile Responsive
   ===================================================== */
@media (max-width: 900px) {
    .hvg-main {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .hvg-container {
        padding: 0 16px;
    }

    .hvg-header-inner {
        padding: 0 1rem;
        height: 56px;
    }

    .hvg-logo-img {
        height: 34px;
    }

    .hvg-logo h1 {
        font-size: 18px;
    }

    .hvg-subtitle {
        font-size: 13px;
    }

    .hvg-card {
        padding: 20px;
        border-radius: 14px;
        margin-bottom: 16px;
    }

    .hvg-empty-state {
        padding: 40px 20px;
        min-height: 240px;
    }

    textarea {
        min-height: 200px;
    }

    /* Stack voice/format dropdowns */
    .hvg-form-row {
        flex-direction: column;
        gap: 0;
    }

    /* Ensure buttons are large enough for touch */
    .hvg-btn {
        padding: 14px 24px;
        font-size: 15px;
        min-height: 48px;
    }

    .hvg-btn-secondary {
        padding: 12px 16px;
        min-height: 44px;
    }

    /* Status header */
    .hvg-status-header {
        gap: 14px;
    }

    .hvg-spinner-ring {
        width: 40px;
        height: 40px;
    }

    .hvg-status-header h2 {
        font-size: 16px;
    }

    /* Video actions stack on very small screens */
    .hvg-video-actions {
        flex-wrap: wrap;
    }

    .hvg-video-actions .hvg-btn-primary {
        flex: 1 1 100%;
    }

    .hvg-video-actions .hvg-btn-secondary {
        flex: 1;
    }

    /* Toast */
    .hvg-toast {
        left: 16px;
        right: 16px;
        bottom: 16px;
        max-width: none;
    }

    /* Voice clone */
    .hvg-voice-clone-section summary {
        padding: 12px 14px;
    }

    .hvg-clone-inner {
        padding: 14px;
    }

    .hvg-voice-cloned-banner {
        flex-wrap: wrap;
        gap: 8px;
        padding: 12px 14px;
        font-size: 13px;
    }

    /* Info tooltip on mobile — position left to avoid overflow */
    .hvg-info-tip-content {
        left: auto;
        right: -10px;
        transform: none;
        width: 260px;
    }
}
