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

:root {
    --primary-bg: #0f0f23;
    --secondary-bg: #1a1a2e;
    --accent-bg: #16213e;
    --card-bg: #252545;
    --primary-blue: #3b82f6;
    --primary-blue-hover: #2563eb;
    --accent-purple: #8b5cf6;
    --accent-green: #10b981;
    --text-primary: #ffffff;
    --text-secondary: #a0a0b8;
    --text-muted: #6b7280;
    --border-color: #374151;
    --gradient-1: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --gradient-2: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.5), 0 10px 10px -5px rgba(0, 0, 0, 0.2);
    --shadow-xl: 0 25px 50px -12px rgba(0, 0, 0, 0.6);
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--primary-bg);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(ellipse at top, rgba(59, 130, 246, 0.1) 0%, transparent 70%);
    pointer-events: none;
    z-index: -1;
}

.hero-section {
    background: linear-gradient(135deg, var(--secondary-bg) 0%, var(--accent-bg) 100%);
    border-bottom: 1px solid var(--border-color);
    position: relative;
    overflow: hidden;
}

.hero-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><pattern id="grid" width="10" height="10" patternUnits="userSpaceOnUse"><path d="M 10 0 L 0 0 0 10" fill="none" stroke="%23374151" stroke-width="0.5" opacity="0.3"/></pattern></defs><rect width="100" height="100" fill="url(%23grid)"/></svg>');
    opacity: 0.5;
}

.hero-section > div {
    position: relative;
    z-index: 1;
}

.viewer-section {
    background: var(--primary-bg);
    position: relative;
}

.section-title {
    background: var(--gradient-1);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: 800;
    letter-spacing: -0.025em;
}

.glass-card {
    background: rgba(37, 37, 69, 0.8);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    box-shadow: var(--shadow-lg);
}

.bookmark-item {
    background: var(--card-bg);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 1rem;
    cursor: pointer;
    position: relative;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(10px);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    width: 120px;
    height: 120px;
    flex: 0 0 auto;
    box-sizing: border-box;
}

.bookmark-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--gradient-1);
    transform: scaleX(0);
    transition: transform 0.3s ease;
}

.bookmark-item:hover::before {
    transform: scaleX(1);
}

.bookmark-category {
    font-size: 0.6rem;
    color: var(--accent-purple);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-weight: 600;
    margin-bottom: 0.3rem;
    opacity: 0.9;
    position: absolute;
    top: 0.5rem;
    left: 0.5rem;
    right: 2rem;
    text-align: left;
}

.bookmark-name {
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.3rem;
    font-size: 0.95rem;
    line-height: 1.3;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.bookmark-url {
    font-size: 0.7rem;
    color: var(--text-muted);
    opacity: 0.7;
    font-family: 'SF Mono', 'Monaco', monospace;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    max-width: 100%;
    background: rgba(255, 255, 255, 0.05);
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
}

.bookmark-item:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: var(--shadow-xl);
    border-color: var(--primary-blue);
    background: rgba(59, 130, 246, 0.1);
}

.bookmark-remove {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    width: 1.5rem;
    height: 1.5rem;
    background: linear-gradient(135deg, #ff6b6b, #ee5a24);
    color: white;
    border: none;
    border-radius: 50%;
    font-size: 0.8rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(238, 90, 36, 0.4);
    z-index: 10;
}

.bookmark-remove:hover {
    background: linear-gradient(135deg, #ee5a24, #ff4757);
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(238, 90, 36, 0.6);
}

.bookmark-item:hover .bookmark-remove {
    opacity: 1;
}

/* Stats Cards - Same style as bookmark cards */
.stats-card {
    background: var(--card-bg);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 1rem;
    position: relative;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(10px);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    width: 120px;
    height: 120px;
    flex: 0 0 auto;
    box-sizing: border-box;
}

.stats-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--gradient-2);
    transform: scaleX(0);
    transition: transform 0.3s ease;
}

.stats-card:hover::before {
    transform: scaleX(1);
}

.stats-card:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: var(--shadow-xl);
    border-color: var(--primary-blue);
    background: rgba(59, 130, 246, 0.1);
}

.stats-icon {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
    opacity: 0.9;
}

.stats-number {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
    line-height: 1.2;
}

.stats-label {
    font-size: 0.7rem;
    color: var(--text-muted);
    opacity: 0.8;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
}

/* Stats Grid Layout - FIXED */
.stats-grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-start;
    align-items: flex-start;
    width: 100%;
    min-height: 40px;
    gap: 1rem;
}

#urlInput {
    background: rgba(255, 255, 255, 0.95);
    color: #1f2937;
    border: 2px solid rgba(59, 130, 246, 0.3);
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 500;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

#urlInput:focus {
    border-color: var(--primary-blue);
    background: white;
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.1), 0 8px 25px rgba(0, 0, 0, 0.15);
    outline: none;
    transform: translateY(-2px);
}

.viewer-height {
    height: 70vh;
    border-radius: 16px;
    background: #000;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: var(--shadow-xl);
    overflow: hidden;
    position: relative;
}

.viewer-height::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg, rgba(59, 130, 246, 0.1) 0%, rgba(139, 92, 246, 0.1) 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
    z-index: 1;
}

.viewer-loading::before {
    opacity: 1;
}


#addBookmarkModal .bg-gray-800 {
    background: var(--card-bg);
    border: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(20px);
    box-shadow: var(--shadow-xl);
    border-radius: 20px;
}

.btn-primary {
    background: var(--gradient-1);
    border: none;
    border-radius: 12px;
    padding: 0.75rem 1.5rem;
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(59, 130, 246, 0.4);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    padding: 0.75rem 1.5rem;
    font-weight: 600;
    transition: all 0.3s ease;
    color: var(--text-primary);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(59, 130, 246, 0.3);
    border-radius: 50%;
    border-top-color: var(--primary-blue);
    animation: spin 1s ease-in-out infinite;
}

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

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

.fade-in {
    animation: fadeIn 0.6s ease-out;
}

.text-gradient {
    background: var(--gradient-1);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Enhanced iframe and video player styles */
.viewer-height iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100% !important;
    height: 100% !important;
    border: none;
    border-radius: 15px;
    z-index: 10;
}

#welcomeMessage {
    background: rgba(15, 15, 35, 0.95);
    backdrop-filter: blur(10px);
    z-index: 20;
    border-radius: 15px;
}

#loadingSpinner {
    background: rgba(15, 15, 35, 0.95);
    backdrop-filter: blur(10px);
    z-index: 20;
    border-radius: 15px;
}

/* Enhanced video player support */
.viewer-height video,
.viewer-height [class*="video"],
.viewer-height [id*="video"],
.viewer-height [class*="player"],
.viewer-height [id*="player"] {
    width: 100% !important;
    height: 100% !important;
    max-width: 100% !important;
    max-height: 100% !important;
    object-fit: contain;
}

/* Force full-width for common video containers */
.viewer-height .video-container,
.viewer-height .player-container,
.viewer-height .video-wrapper,
.viewer-height .player-wrapper {
    width: 100% !important;
    height: 100% !important;
    position: relative !important;
}

/* YouTube specific fixes */
.viewer-height #movie_player,
.viewer-height .html5-video-player,
.viewer-height .ytp-embed {
    width: 100% !important;
    height: 100% !important;
}

/* Generic iframe content fixes */
.viewer-height iframe[src*="youtube"],
.viewer-height iframe[src*="vimeo"],
.viewer-height iframe[src*="dailymotion"],
.viewer-height iframe[src*="twitch"] {
    width: 100% !important;
    height: 100% !important;
    min-width: 100% !important;
    min-height: 100% !important;
}

/* Mobile responsive adjustments for button group */
@media (max-width: 768px) {
    /* Stack buttons in two rows on mobile */
    .flex.space-x-2 {
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    #pipButton,
    #fullscreenButton {
        padding: 0.75rem 1rem;
        font-size: 0.875rem;
        min-width: auto;
    }
}

@media (max-width: 480px) {
    /* Full width buttons on very small screens */
    .flex.space-x-2 {
        flex-direction: column;
        space-x: 0;
        width: 100%;
    }

    .flex.space-x-2 > button {
        width: 100%;
        text-align: center;
    }
}

/* History item styles */
.history-item {
    background: rgba(37, 37, 69, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    margin-bottom: 0.5rem;
}

.history-item:hover {
    background: rgba(37, 37, 69, 0.8);
    border-color: var(--primary-blue);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.history-remove {
    transition: all 0.2s ease;
}

.history-remove:hover {
    transform: scale(1.1);
}


/* Bookmark List Container */
#bookmarksList {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-start;
    align-items: flex-start;
    width: 100%;
    min-height: 40px;
    gap: 1rem;
}

/* Ensure bookmark items align properly */
.bookmark-item {
    margin: 0;
}

/* ===================================================================
   DESKTOP MODE ENFORCEMENT - FORCE DESKTOP BEHAVIOR ON MOBILE
   =================================================================== */

/* Force desktop controls and layout on mobile */
@media screen and (max-width: 768px) {
    /* Scale down desktop view to fit mobile screens */
    html {
        zoom: 0.8;
        -webkit-text-size-adjust: 100%;
    }

    body {
        min-width: 1200px;
        overflow-x: auto;
    }

    /* Force desktop video controls to show */
    video::-webkit-media-controls-panel {
        display: flex !important;
    }

    video::-webkit-media-controls-picture-in-picture-button {
        display: block !important;
    }

    video::-webkit-media-controls-fullscreen-button {
        display: block !important;
    }

    /* Override mobile-specific hiding of controls */
    video::-webkit-media-controls {
        opacity: 1 !important;
    }

    /* Force desktop iframe behavior */
    iframe {
        min-width: 100% !important;
        width: 100% !important;
    }
}

@media screen and (max-width: 480px) {
    /* Extra scaling for very small screens */
    html {
        zoom: 0.6;
    }

    body {
        min-width: 1200px;
    }
}

/* Force all video elements to show desktop controls */
video {
    -webkit-appearance: none;
}

video::-webkit-media-controls-panel {
    display: flex !important;
    opacity: 1 !important;
}

video::-webkit-media-controls-picture-in-picture-button {
    display: block !important;
    opacity: 1 !important;
}

video::-webkit-media-controls-fullscreen-button {
    display: block !important;
    opacity: 1 !important;
}