/* YouTube Embed Styles */

.youtube-embed-container {
    position: relative;
    width: 100%;
    max-width: 560px;
    margin: 16px 0;
    border-radius: 12px;
    overflow: hidden;
    background: var(--admin-hover, #1a1a1a);
    box-shadow: var(--admin-shadow, 0 2px 8px rgba(0, 0, 0, 0.15));
}

.youtube-embed-wrapper {
    position: relative;
    padding-bottom: 56.25%;
    /* 16:9 aspect ratio */
    height: 0;
    overflow: hidden;
}

.youtube-embed-wrapper iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
    border-radius: 12px;
}

/* ---------------------------------------------------------------------------
   Consent Placeholder

   The placeholder must always show the full content (icon, title, description,
   remember-checkbox, accept-button). Earlier versions forced a 16:9 box and
   absolutely positioned the content inside, which clipped the UI on narrow
   desktop layouts (e.g. split screen, sidebars) and on mobile.

   The placeholder now grows with its content, keeps a comfortable visual
   minimum-height on large widths and stays usable down to ~280px wide.
   --------------------------------------------------------------------------- */
.youtube-consent-placeholder {
    position: relative;
    width: 100%;
    box-sizing: border-box;
    background: linear-gradient(135deg, #1a1a1a 0%, #2d2d2d 100%);
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.06);
    display: flex;
}

.youtube-consent-content {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    box-sizing: border-box;
    padding: 32px 28px;
    text-align: center;
    gap: 14px;
    min-height: 260px;
}

.youtube-consent-icon {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: rgba(255, 0, 0, 0.12);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.youtube-consent-icon svg {
    width: 32px;
    height: 32px;
    fill: #ff0000;
}

.youtube-consent-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-color, #ffffff);
    margin: 0;
    line-height: 1.3;
}

.youtube-consent-description {
    font-size: 13px;
    color: var(--text-color-secondary, #a0a0a0);
    margin: 0;
    max-width: 420px;
    line-height: 1.5;
    word-wrap: break-word;
    overflow-wrap: anywhere;
    hyphens: auto;
}

.youtube-consent-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px 18px;
    align-items: center;
    justify-content: center;
    margin-top: 6px;
    width: 100%;
}

.youtube-consent-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 22px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.15s ease, box-shadow 0.2s ease;
    border: none;
    line-height: 1;
    white-space: nowrap;
}

.youtube-consent-btn svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.youtube-consent-btn-primary {
    background: #ff0000;
    color: #ffffff;
}

@media (hover: hover) and (pointer: fine) {
    .youtube-consent-btn-primary:hover {
        background: #cc0000;
        transform: translateY(-1px);
        box-shadow: 0 4px 12px rgba(255, 0, 0, 0.3);
    }
}

.youtube-consent-btn-primary:active {
    transform: translateY(0);
}

.youtube-consent-btn-primary:focus-visible {
    outline: 2px solid #ffffff;
    outline-offset: 2px;
}

.youtube-consent-checkbox-label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 12.5px;
    color: var(--text-color-secondary, #a0a0a0);
    cursor: pointer;
    user-select: none;
    line-height: 1.2;
    transition: color 0.15s ease;
}

.youtube-consent-checkbox-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: #ff0000;
    cursor: pointer;
    flex-shrink: 0;
    margin: 0;
}

@media (hover: hover) and (pointer: fine) {
    .youtube-consent-checkbox-label:hover {
        color: var(--text-color, #ffffff);
    }
}

/* Loading State */
.youtube-embed-loading {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--admin-hover, #1a1a1a);
}

.youtube-embed-loading::after {
    content: "";
    width: 32px;
    height: 32px;
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-top-color: #ff0000;
    border-radius: 50%;
    animation: spinTo360 0.8s linear infinite;
}

/* Respect reduced-motion */
@media (prefers-reduced-motion: reduce) {
    .youtube-consent-btn,
    .youtube-consent-checkbox-label,
    .youtube-link-fallback {
        transition: none;
    }
    .youtube-embed-loading::after {
        animation: none;
    }
}

@media (prefers-reduced-motion: reduce) and (hover: hover) and (pointer: fine) {
    .youtube-consent-btn-primary:hover {
        transform: none;
    }
}

/* Link fallback styling */
.youtube-link-fallback {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: rgba(255, 0, 0, 0.1);
    border-radius: 6px;
    color: #ff4444;
    text-decoration: none;
    font-size: 13px;
    transition: all 0.2s ease;
}

@media (hover: hover) and (pointer: fine) {
    .youtube-link-fallback:hover {
        background: rgba(255, 0, 0, 0.2);
        color: #ff6666;
    }
}

.youtube-link-fallback svg {
    width: 16px;
    height: 16px;
    fill: currentColor;
}

/* Light Theme */
[data-theme="light"] .youtube-embed-container,
.light-theme .youtube-embed-container {
    background: var(--admin-hover, #f5f5f5);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

[data-theme="light"] .youtube-consent-placeholder,
.light-theme .youtube-consent-placeholder {
    background: linear-gradient(135deg, #f7f7f7 0%, #ececec 100%);
    border-color: var(--border-color, rgba(0, 0, 0, 0.08));
}

[data-theme="light"] .youtube-consent-title,
.light-theme .youtube-consent-title {
    color: var(--text-color, #1a1a1a);
}

[data-theme="light"] .youtube-consent-description,
.light-theme .youtube-consent-description {
    color: var(--text-color-secondary, #666666);
}

[data-theme="light"] .youtube-consent-checkbox-label,
.light-theme .youtube-consent-checkbox-label {
    color: var(--text-color-secondary, #666666);
}

@media (hover: hover) and (pointer: fine) {
    [data-theme="light"] .youtube-consent-checkbox-label:hover,
    .light-theme .youtube-consent-checkbox-label:hover {
        color: var(--text-color, #1a1a1a);
    }
}

[data-theme="light"] .youtube-consent-btn-primary:focus-visible,
.light-theme .youtube-consent-btn-primary:focus-visible {
    outline-color: #1a1a1a;
}

[data-theme="light"] .youtube-embed-loading,
.light-theme .youtube-embed-loading {
    background: var(--admin-hover, #f5f5f5);
}

[data-theme="light"] .youtube-embed-loading::after,
.light-theme .youtube-embed-loading::after {
    border-color: rgba(0, 0, 0, 0.1);
    border-top-color: #ff0000;
}

/* ---------------------------------------------------------------------------
   Responsive

   - >= 480px : icon + text + actions all fit comfortably; actions can sit on
     one row (checkbox + button).
   - < 480px  : tighten paddings, stack actions vertically, full-width button.
   - < 360px  : extra compact for very small widths (split-screen, sidebars).
   --------------------------------------------------------------------------- */
@media (max-width: 600px) {
    .youtube-embed-container {
        border-radius: 10px;
    }

    .youtube-embed-wrapper iframe {
        border-radius: 10px;
    }

    .youtube-consent-placeholder {
        border-radius: 10px;
    }

    .youtube-consent-content {
        padding: 24px 18px;
        gap: 12px;
        min-height: 240px;
    }

    .youtube-consent-icon {
        width: 48px;
        height: 48px;
    }

    .youtube-consent-icon svg {
        width: 28px;
        height: 28px;
    }

    .youtube-consent-title {
        font-size: 15px;
    }

    .youtube-consent-description {
        font-size: 12.5px;
    }
}

@media (max-width: 480px) {
    .youtube-consent-actions {
        flex-direction: column;
        gap: 12px;
    }

    .youtube-consent-btn {
        width: 100%;
        max-width: 280px;
        padding: 11px 20px;
    }
}

@media (max-width: 360px) {
    .youtube-consent-content {
        padding: 20px 14px;
        gap: 10px;
        min-height: 220px;
    }

    .youtube-consent-icon {
        width: 44px;
        height: 44px;
    }

    .youtube-consent-icon svg {
        width: 24px;
        height: 24px;
    }

    .youtube-consent-title {
        font-size: 14px;
    }

    .youtube-consent-description {
        font-size: 12px;
        line-height: 1.45;
    }

    .youtube-consent-btn {
        font-size: 13px;
        padding: 10px 16px;
    }

    .youtube-consent-checkbox-label {
        font-size: 12px;
    }
}
