/* ========================================
   VidGrab - Styles
   ======================================== */

:root {
    --bg-primary: #0a0a1a;
    --bg-secondary: #111128;
    --bg-card: rgba(20, 20, 50, 0.7);
    --bg-card-hover: rgba(30, 30, 65, 0.8);
    --text-primary: #f0f0ff;
    --text-secondary: #8888aa;
    --text-muted: #555577;
    --border: rgba(100, 100, 200, 0.15);
    --border-focus: rgba(120, 100, 255, 0.5);
    --accent: #7c5cff;
    --accent-hover: #9070ff;
    --youtube: #ff0033;
    --instagram: #e1306c;
    --facebook: #1877f2;
    --success: #00c853;
    --warning: #ffab00;
    --error: #ff1744;
    --radius: 16px;
    --radius-sm: 10px;
    --shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

html {
    scroll-behavior: smooth;
}

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

/* ---- Background Shapes ---- */
.bg-shapes {
    position: fixed;
    inset: 0;
    z-index: 0;
    overflow: hidden;
    pointer-events: none;
}

.shape {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.15;
    animation: float 20s ease-in-out infinite;
}

.shape-1 {
    width: 600px;
    height: 600px;
    background: var(--youtube);
    top: -200px;
    right: -100px;
    animation-delay: 0s;
}

.shape-2 {
    width: 500px;
    height: 500px;
    background: var(--accent);
    bottom: -150px;
    left: -100px;
    animation-delay: -7s;
}

.shape-3 {
    width: 400px;
    height: 400px;
    background: var(--facebook);
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    animation-delay: -14s;
}

@keyframes float {
    0%, 100% { transform: translate(0, 0) scale(1); }
    25% { transform: translate(30px, -30px) scale(1.05); }
    50% { transform: translate(-20px, 20px) scale(0.95); }
    75% { transform: translate(20px, 10px) scale(1.02); }
}

/* ---- Container ---- */
.container {
    position: relative;
    z-index: 1;
    max-width: 720px;
    margin: 0 auto;
    padding: 40px 20px 30px;
    min-height: 100vh;
}

/* ---- Header ---- */
.header {
    text-align: center;
    margin-bottom: 32px;
}

.logo {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.logo-icon {
    width: 40px;
    height: 40px;
    color: var(--accent);
    filter: drop-shadow(0 0 8px rgba(124, 92, 255, 0.5));
}

.logo h1 {
    font-size: 2.2rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--accent), #ff6b9d);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -0.5px;
}

.subtitle {
    color: var(--text-secondary);
    font-size: 1rem;
    font-weight: 400;
}

/* ---- Platforms ---- */
.platforms {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin-bottom: 28px;
    flex-wrap: wrap;
}

.platform-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border-radius: 50px;
    font-size: 0.82rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    border: 1px solid var(--border);
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    transition: var(--transition);
}

.platform-badge.youtube { color: var(--youtube); border-color: rgba(255, 0, 51, 0.25); }
.platform-badge.instagram { color: var(--instagram); border-color: rgba(225, 48, 108, 0.25); }
.platform-badge.facebook { color: var(--facebook); border-color: rgba(24, 119, 242, 0.25); }

.platform-badge:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}

/* ---- Cards ---- */
.card {
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 28px;
    box-shadow: var(--shadow);
    transition: var(--transition);
}

.main-card {
    margin-bottom: 24px;
}

/* ---- Input Group ---- */
.input-group {
    display: flex;
    gap: 12px;
}

.input-wrapper {
    flex: 1;
    position: relative;
    display: flex;
    align-items: center;
}

.input-icon {
    position: absolute;
    left: 16px;
    width: 20px;
    height: 20px;
    color: var(--text-muted);
    pointer-events: none;
    transition: var(--transition);
}

.input-wrapper input {
    width: 100%;
    padding: 16px 50px 16px 48px;
    background: rgba(0, 0, 0, 0.3);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.95rem;
    font-family: inherit;
    outline: none;
    transition: var(--transition);
}

.input-wrapper input::placeholder {
    color: var(--text-muted);
}

.input-wrapper input:focus {
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px rgba(124, 92, 255, 0.15);
}

.input-wrapper input:focus ~ .input-icon,
.input-wrapper input:focus + .paste-btn + .input-icon {
    color: var(--accent);
}

.paste-btn {
    position: absolute;
    right: 12px;
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 6px;
    border-radius: 6px;
    transition: var(--transition);
    display: flex;
}

.paste-btn:hover {
    color: var(--accent);
    background: rgba(124, 92, 255, 0.1);
}

/* ---- Buttons ---- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 16px 28px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
    text-decoration: none;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent), #5a3fd4);
    color: white;
    box-shadow: 0 4px 16px rgba(124, 92, 255, 0.3);
}

.btn-primary:hover:not(:disabled) {
    background: linear-gradient(135deg, var(--accent-hover), #6e50e8);
    transform: translateY(-1px);
    box-shadow: 0 6px 24px rgba(124, 92, 255, 0.4);
}

.btn-primary:active:not(:disabled) {
    transform: translateY(0);
}

.btn-download {
    width: 100%;
    padding: 18px;
    font-size: 1.05rem;
    background: linear-gradient(135deg, var(--success), #009624);
    color: white;
    box-shadow: 0 4px 16px rgba(0, 200, 83, 0.3);
    margin-top: 20px;
}

.btn-download:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 200, 83, 0.4);
}

.btn-download.downloading {
    background: linear-gradient(135deg, var(--accent), #5a3fd4);
    box-shadow: 0 4px 16px rgba(124, 92, 255, 0.3);
}

.btn-download.downloaded {
    background: linear-gradient(135deg, var(--success), #009624);
    box-shadow: 0 4px 16px rgba(0, 200, 83, 0.4);
}

/* ---- Loading ---- */
.loading {
    text-align: center;
    padding: 40px;
}

.spinner {
    width: 48px;
    height: 48px;
    border: 3px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 16px;
}

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

.loading p {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* ---- Result Card ---- */
.result-card {
    animation: slideUp 0.4s ease-out;
}

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

.video-info {
    display: flex;
    gap: 20px;
    margin-bottom: 24px;
}

.thumbnail-wrapper {
    position: relative;
    flex-shrink: 0;
    width: 200px;
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.thumbnail-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    aspect-ratio: 16/9;
}

.duration-badge {
    position: absolute;
    bottom: 8px;
    right: 8px;
    background: rgba(0, 0, 0, 0.85);
    color: white;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
}

.platform-indicator {
    position: absolute;
    top: 8px;
    left: 8px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    border: 2px solid rgba(0, 0, 0, 0.5);
}

.platform-indicator.youtube { background: var(--youtube); }
.platform-indicator.instagram { background: var(--instagram); }
.platform-indicator.facebook { background: var(--facebook); }

.video-details {
    flex: 1;
    min-width: 0;
}

.video-details h2 {
    font-size: 1.1rem;
    font-weight: 700;
    line-height: 1.4;
    margin-bottom: 6px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.uploader {
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-weight: 500;
}

/* ---- Format Selection ---- */
.format-section h3 {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 12px;
}

.format-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.format-option {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: rgba(0, 0, 0, 0.2);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
}

.format-option:hover {
    background: rgba(124, 92, 255, 0.08);
    border-color: rgba(124, 92, 255, 0.3);
}

.format-option.selected {
    background: rgba(124, 92, 255, 0.12);
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(124, 92, 255, 0.1);
}

.format-option input[type="radio"] {
    display: none;
}

.format-radio {
    width: 20px;
    height: 20px;
    border: 2px solid var(--border);
    border-radius: 50%;
    flex-shrink: 0;
    position: relative;
    transition: var(--transition);
}

.format-option.selected .format-radio {
    border-color: var(--accent);
}

.format-option.selected .format-radio::after {
    content: '';
    position: absolute;
    inset: 3px;
    background: var(--accent);
    border-radius: 50%;
}

.format-label {
    flex: 1;
    font-size: 0.9rem;
    font-weight: 500;
}

.format-ext {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--text-muted);
    background: rgba(255, 255, 255, 0.05);
    padding: 3px 8px;
    border-radius: 4px;
}

.format-size {
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.format-size-unknown {
    color: var(--text-muted);
    font-style: italic;
    font-weight: 400;
}

/* ---- Alerts ---- */
.alert {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 20px;
    border-radius: var(--radius-sm);
    margin-bottom: 20px;
    font-size: 0.88rem;
    line-height: 1.5;
    animation: slideUp 0.3s ease-out;
}

.alert svg {
    flex-shrink: 0;
}

.alert a {
    color: inherit;
    font-weight: 600;
    text-decoration: underline;
}

.alert-warning {
    background: rgba(255, 171, 0, 0.1);
    border: 1px solid rgba(255, 171, 0, 0.3);
    color: var(--warning);
}

.alert-error {
    background: rgba(255, 23, 68, 0.1);
    border: 1px solid rgba(255, 23, 68, 0.3);
    color: var(--error);
}

.alert-success {
    background: rgba(0, 200, 83, 0.1);
    border: 1px solid rgba(0, 200, 83, 0.3);
    color: var(--success);
}

/* ---- Footer ---- */
.footer {
    text-align: center;
    padding: 30px 0 10px;
    color: var(--text-muted);
    font-size: 0.78rem;
}

/* ---- Hidden ---- */
.hidden {
    display: none !important;
}

/* ---- Responsive ---- */
@media (max-width: 640px) {
    .container {
        padding: 24px 16px 20px;
    }

    .logo h1 {
        font-size: 1.8rem;
    }

    .subtitle {
        font-size: 0.88rem;
    }

    .input-group {
        flex-direction: column;
    }

    .btn-primary {
        width: 100%;
    }

    .card {
        padding: 20px;
    }

    .video-info {
        flex-direction: column;
    }

    .thumbnail-wrapper {
        width: 100%;
    }

    .platforms {
        gap: 8px;
    }

    .platform-badge {
        padding: 6px 12px;
        font-size: 0.76rem;
    }
}

@media (max-width: 380px) {
    .logo h1 {
        font-size: 1.5rem;
    }

    .logo-icon {
        width: 32px;
        height: 32px;
    }
}
