/* Minimalist, focused design for video sharing */

:root {
    --primary-green: #0f4c3a;
    --accent-green: #1a5f47;
    --bg-dark: #1a1a1a;
    --bg-light: #ffffff;
    --text-primary: #333333;
    --text-secondary: #666666;
    --border-color: #e0e0e0;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-dark);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header */
.header {
    background: rgba(255, 255, 255, 0.98);
    padding: 1rem 2rem;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--primary-green);
}

/* Main player area */
.player-main {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
}

.video-container {
    width: 100%;
    max-width: 100%;
    background: #000;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
}

.video-player {
    width: 100%;
    height: auto;
    display: block;
    max-height: 80vh;  /* Prevent excessively tall videos on mobile */
    object-fit: contain;  /* Maintain aspect ratio without cropping */
}

/* Custom controls */
.video-controls {
    background: linear-gradient(to top, rgba(0,0,0,0.8), transparent);
    padding: 1.5rem;
    position: relative;

    /* Prevent iOS Safari interfering with controls */
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
}

.progress-bar {
    position: relative;
    margin-bottom: 1rem;
}

.seek-bar {
    width: 100%;
    height: 6px;
    appearance: none;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 3px;
    cursor: pointer;
}

.seek-bar::-webkit-slider-thumb {
    appearance: none;
    width: 16px;
    height: 16px;
    background: var(--primary-green);
    border-radius: 50%;
    cursor: pointer;
}

.controls-row {
    display: flex;
    align-items: center;
    gap: 1rem;
    color: white;
}

.control-btn {
    background: transparent;
    border: none;
    color: white;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 4px;
    transition: background 0.2s;

    /* Prevent text selection and iOS long press behaviors */
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;

    /* Disable iOS long press context menu and magnifier */
    -webkit-touch-callout: none;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;  /* Prevent zoom on double-tap */
}

.control-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

.time-display {
    font-size: 0.85rem;
    min-width: 180px;  /* Enough space for "0:00 (f0) / 0:00 (f999)" */
    text-align: center;
}

.separator {
    margin: 0 0.25rem;
}

.speed-controls {
    display: flex;
    gap: 0.5rem;
    margin-left: auto;
}

.speed-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    padding: 0.4rem 0.8rem;
    border-radius: 4px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
}

.speed-btn.active {
    background: var(--primary-green);
}

/* Video info */
.video-info {
    background: rgba(0, 0, 0, 0.6);
    padding: 1rem 1.5rem;
    color: white;
}

.info-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.impact-badge {
    background: rgba(255, 193, 7, 0.2);
    color: #ffc107;
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: 600;
}

/* CTA Footer */
.cta-footer {
    background: var(--bg-light);
    padding: 3rem 2rem;
    text-align: center;
    border-top: 1px solid var(--border-color);
}

.cta-content h3 {
    font-size: 1.8rem;
    margin-bottom: 0.5rem;
    color: var(--primary-green);
}

.cta-content p {
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
}

.cta-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-top: 1.5rem;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-green), var(--accent-green));
    color: white;
    padding: 0.875rem 2rem;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    display: inline-block;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(15, 76, 58, 0.3);
}

.btn-secondary {
    background: white;
    color: var(--primary-green);
    border: 2px solid var(--primary-green);
    padding: 0.875rem 2rem;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Share Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-content {
    background: white;
    padding: 2rem;
    border-radius: 12px;
    max-width: 500px;
    width: 90%;
}

.modal-content h3 {
    margin-bottom: 1.5rem;
    color: var(--primary-green);
}

.share-link {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.share-input {
    flex: 1;
    padding: 0.75rem;
    border: 2px solid var(--border-color);
    border-radius: 6px;
    font-size: 0.9rem;
}

.btn-copy {
    padding: 0.75rem 1.5rem;
    background: var(--primary-green);
    color: white;
    border: none;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
}

.btn-close {
    width: 100%;
    padding: 0.75rem;
    background: var(--border-color);
    border: none;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    margin-top: 1rem;
}

/* Utility classes */
.hidden {
    display: none !important;
}

.loading, .error {
    text-align: center;
    padding: 3rem;
    color: white;
}

.spinner {
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top-color: var(--primary-green);
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
    margin: 0 auto 1rem;
}

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

/* Video loading overlay */
.video-loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
}

.loading-content {
    text-align: center;
    color: white;
}

.loading-progress-bar {
    width: 300px;
    height: 8px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    margin: 1rem auto;
    overflow: hidden;
}

.loading-progress-fill {
    height: 100%;
    background: var(--primary-green);
    width: 0%;
    transition: width 0.3s ease;
}

.loading-progress-text {
    color: var(--primary-green);
    font-weight: 600;
    margin-top: 0.5rem;
}

/* Fullscreen mode */
.video-container:fullscreen {
    border-radius: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    background: #000;
}

.video-container:-webkit-full-screen {
    border-radius: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    background: #000;
}

.video-container:-moz-full-screen {
    border-radius: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    background: #000;
}

/* Video player in fullscreen */
.video-container:fullscreen .video-player {
    width: 100%;
    height: auto;
    max-height: 100vh;
}

.video-container:-webkit-full-screen .video-player {
    width: 100%;
    height: auto;
    max-height: 100vh;
}

/* Controls positioned at bottom in fullscreen */
.video-container:fullscreen .video-controls {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.9), rgba(0,0,0,0.6), transparent);
    padding: 2rem 1.5rem 1.5rem;
}

.video-container:-webkit-full-screen .video-controls {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.9), rgba(0,0,0,0.6), transparent);
    padding: 2rem 1.5rem 1.5rem;
}

/* Hide video info in fullscreen */
.video-container:fullscreen .video-info,
.video-container:-webkit-full-screen .video-info {
    display: none;
}

/* Mobile responsive */
@media (max-width: 768px) {
    .player-main {
        padding: 0.5rem;
        align-items: flex-start;  /* Align to top on mobile */
    }

    .video-container {
        width: 100%;
        border-radius: 8px;
    }

    .video-player {
        max-height: 85vh;  /* Use more screen space on mobile */
        width: 100%;
    }

    .cta-buttons {
        flex-direction: column;
    }

    .video-controls {
        padding: 1rem;
    }

    /* Allow controls to wrap to multiple rows */
    .controls-row {
        flex-wrap: wrap;
        gap: 0.4rem;
    }

    /* Remove auto margin on mobile so controls don't push buttons off-screen */
    .speed-controls {
        margin-left: 0;
        gap: 0.25rem;
        flex: 1 0 100%;  /* Force speed controls to own row */
        justify-content: center;
    }

    .speed-btn {
        padding: 0.3rem 0.5rem;
        font-size: 0.7rem;
    }

    .control-btn {
        padding: 0.4rem;
    }

    .time-display {
        font-size: 0.75rem;
        min-width: 150px;
    }
}

/* Extra narrow screens - simplify even more */
@media (max-width: 480px) {
    .speed-controls {
        gap: 0.2rem;
    }

    .speed-btn {
        padding: 0.25rem 0.4rem;
        font-size: 0.65rem;
    }

    .control-btn {
        padding: 0.3rem;
    }

    .controls-row {
        gap: 0.3rem;
    }
}
