@import url('https://fonts.googleapis.com/css2?family=Bricolage+Grotesque:opsz,wght@12..96,400;12..96,600;12..96,700&family=DM+Sans:wght@400;500;700&display=swap');

:root {
    --yt-primary: #FF0000;
    --yt-primary-dark: #CC0000;
    --yt-primary-light: #FF3333;
    --yt-secondary: #065FD4;
    --yt-background: #FFFFFF;
    --yt-surface: #F9FAFB;
    --yt-border: #E5E7EB;
    --yt-text-primary: #111827;
    --yt-text-secondary: #6B7280;
    --yt-text-muted: #9CA3AF;
    --yt-success: #10B981;
    --yt-warning: #F59E0B;
    --yt-gradient: linear-gradient(135deg, #FF0000 0%, #CC0000 100%);
    --yt-shadow-sm: 0 1px 2px 0 rgba(0,0,0,0.05);
    --yt-shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -1px rgba(0,0,0,0.06);
    --yt-shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -2px rgba(0,0,0,0.05);
    --yt-shadow-xl: 0 20px 25px -5px rgba(0,0,0,0.1), 0 10px 10px -5px rgba(0,0,0,0.04);
}

/* ── Base ────────────────────────────────────────────────────── */

.yt-watch-time-calculator {
    font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    max-width: 640px;
    margin: 0 auto;
    padding: 20px;
    box-sizing: border-box;
}

.yt-watch-time-calculator * {
    box-sizing: border-box;
}

.yt-calc-container {
    background: var(--yt-background);
    border-radius: 24px;
    box-shadow: var(--yt-shadow-xl);
    overflow: hidden;
    border: 1px solid var(--yt-border);
    position: relative;
}

.yt-calc-container::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 5px;
    background: var(--yt-gradient);
    z-index: 1;
}

/* ── Header ──────────────────────────────────────────────────── */

.yt-calc-header {
    background: linear-gradient(135deg, #FAFAFA 0%, #F5F5F5 100%);
    padding: 36px 32px 28px;
    text-align: center;
}

.yt-header-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 16px;
    background: var(--yt-gradient);
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    box-shadow: 0 8px 16px rgba(255,0,0,0.3);
    transform: rotate(-3deg);
    animation: iconFloat 3s ease-in-out infinite;
}

@keyframes iconFloat {
    0%, 100% { transform: rotate(-3deg) translateY(0px); }
    50%       { transform: rotate(-3deg) translateY(-6px); }
}

.yt-header-icon svg { width: 36px; height: 36px; }

.yt-calc-title {
    font-family: 'Bricolage Grotesque', sans-serif;
    font-size: 26px;
    font-weight: 700;
    color: var(--yt-text-primary);
    margin: 0;
    letter-spacing: -0.5px;
}

/* ── Body ────────────────────────────────────────────────────── */

.yt-calc-body {
    padding: 32px;
}

/* ── Channel lookup ──────────────────────────────────────────── */

.yt-channel-lookup {
    margin-bottom: 28px;
    padding: 20px;
    background: #f8f9ff;
    border: 1.5px solid #e0e4ff;
    border-radius: 14px;
}

.yt-channel-input-row {
    display: flex;
    gap: 10px;
    margin-top: 10px;
}

.yt-channel-input-row .yt-input {
    flex: 1;
    min-width: 0; /* prevents overflow */
    padding-right: 16px !important; /* no suffix inside this one */
}

.yt-fetch-btn {
    flex-shrink: 0;
    background: #FF0000 !important;
    color: #fff !important;
    border: none !important;
    padding: 0 22px !important;
    border-radius: 10px !important;
    font-weight: 700 !important;
    font-size: 14px !important;
    font-family: 'DM Sans', sans-serif !important;
    cursor: pointer !important;
    white-space: nowrap !important;
    height: 50px !important;
    transition: opacity .15s !important;
}

.yt-fetch-btn:hover   { opacity: .85 !important; }
.yt-fetch-btn:disabled { opacity: .5 !important; cursor: not-allowed !important; }

.yt-fetch-error {
    margin-top: 10px;
    color: #c00;
    font-size: 13px;
    padding: 10px 14px;
    background: #fff0f0;
    border-radius: 8px;
    border: 1px solid #fcc;
    line-height: 1.4;
}

.yt-channel-card {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-top: 14px;
    padding: 14px;
    background: #fff;
    border: 1.5px solid #c7d2fe;
    border-radius: 10px;
}

.yt-channel-thumb {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.yt-channel-name {
    font-weight: 700;
    font-size: 14px;
    color: #1a1a2e;
}

.yt-channel-stats {
    font-size: 12px;
    color: #666;
    margin-top: 2px;
    line-height: 1.5;
}

.yt-lookup-divider {
    text-align: center;
    margin: 18px 0 0;
    position: relative;
    font-size: 12px;
    color: #aaa;
}

.yt-lookup-divider::before {
    content: "";
    position: absolute;
    left: 0; right: 0; top: 50%;
    height: 1px;
    background: #e0e4ff;
}

.yt-lookup-divider span {
    background: #f8f9ff;
    padding: 0 12px;
    position: relative;
}

/* ── Input fields — single column, full width ─────────────────── */

.yt-input-group {
    margin-bottom: 22px;
}

.yt-label {
    display: flex;
    flex-direction: column;
    gap: 3px;
    margin-bottom: 8px;
}

.label-text {
    font-size: 14px;
    font-weight: 600;
    color: var(--yt-text-primary);
}

.label-helper {
    font-size: 12px;
    color: var(--yt-text-secondary);
}

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

.yt-input {
    width: 100% !important;
    padding: 13px 70px 13px 16px !important;
    font-size: 15px !important;
    border: 2px solid var(--yt-border) !important;
    border-radius: 10px !important;
    background: var(--yt-surface) !important;
    color: var(--yt-text-primary) !important;
    font-family: 'DM Sans', sans-serif !important;
    font-weight: 500 !important;
    transition: border-color .2s, box-shadow .2s !important;
    box-sizing: border-box !important;
}

.yt-input:focus {
    outline: none !important;
    border-color: var(--yt-primary) !important;
    background: #fff !important;
    box-shadow: 0 0 0 3px rgba(255,0,0,0.1) !important;
}

.input-suffix {
    position: absolute;
    right: 14px;
    font-size: 13px;
    font-weight: 500;
    color: var(--yt-text-muted);
    pointer-events: none;
}

/* ── Calculate button ────────────────────────────────────────── */

.yt-calc-button {
    width: 100% !important;
    padding: 15px 24px !important;
    background: var(--yt-gradient) !important;
    color: white !important;
    border: none !important;
    border-radius: 12px !important;
    font-size: 16px !important;
    font-weight: 700 !important;
    font-family: 'DM Sans', sans-serif !important;
    cursor: pointer !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 10px !important;
    margin-top: 24px !important;
    box-shadow: 0 4px 12px rgba(255,0,0,0.3) !important;
    transition: transform .2s, box-shadow .2s !important;
}

.yt-calc-button:hover {
    transform: translateY(-2px) !important;
    box-shadow: 0 8px 20px rgba(255,0,0,0.4) !important;
}

.button-text { position: relative; z-index: 1; }
.button-icon { font-size: 18px; }

/* ── Results ─────────────────────────────────────────────────── */

.yt-results {
    padding: 28px 32px 32px;
    background: linear-gradient(135deg, #FAFAFA 0%, #F9FAFB 100%);
    border-top: 1px solid var(--yt-border);
    animation: slideDown .35s ease-out;
}

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-16px); }
    to   { opacity: 1; transform: translateY(0); }
}

.yt-results-header h3 {
    font-family: 'Bricolage Grotesque', sans-serif;
    font-size: 18px;
    font-weight: 700;
    color: var(--yt-text-primary);
    margin: 0 0 20px;
    text-align: center;
}

.yt-results-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 14px;
    margin-bottom: 20px;
}

.yt-result-card {
    background: white;
    border-radius: 14px;
    padding: 20px 14px;
    text-align: center;
    border: 1px solid var(--yt-border);
    box-shadow: var(--yt-shadow-sm);
    animation: cardPop .4s ease-out backwards;
}

.yt-result-card:nth-child(1) { animation-delay: .05s; }
.yt-result-card:nth-child(2) { animation-delay: .1s; }
.yt-result-card:nth-child(3) { animation-delay: .15s; }
.yt-result-card:nth-child(4) { animation-delay: .2s; }

@keyframes cardPop {
    from { opacity: 0; transform: scale(.9) translateY(10px); }
    to   { opacity: 1; transform: scale(1) translateY(0); }
}

.result-icon  { font-size: 28px; margin-bottom: 6px; }

.result-value {
    font-size: 24px;
    font-weight: 700;
    color: var(--yt-text-primary);
    font-family: 'Bricolage Grotesque', sans-serif;
    line-height: 1.2;
    margin-bottom: 4px;
}

.result-label {
    font-size: 11px;
    color: var(--yt-text-secondary);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.milestone-card {
    grid-column: span 2;
}

.milestone-card .result-value { font-size: 18px; }

.result-detail {
    margin-top: 6px;
    font-size: 12px;
    color: var(--yt-text-secondary);
    line-height: 1.4;
}

/* ── Progress bar ────────────────────────────────────────────── */

.yt-progress-section {
    background: white;
    border-radius: 14px;
    padding: 20px;
    border: 1px solid var(--yt-border);
    animation: cardPop .4s ease-out .25s backwards;
}

.progress-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    font-size: 13px;
    font-weight: 600;
    color: var(--yt-text-primary);
}

.progress-percentage {
    color: var(--yt-primary);
    font-family: 'Bricolage Grotesque', sans-serif;
    font-size: 15px;
}

.progress-bar {
    height: 10px;
    background: #E5E7EB;
    border-radius: 100px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--yt-gradient);
    border-radius: 100px;
    transition: width 1s cubic-bezier(.4,0,.2,1);
}

.progress-footer {
    margin-top: 8px;
    font-size: 12px;
    color: var(--yt-text-secondary);
    text-align: center;
}

/* ── Mobile ──────────────────────────────────────────────────── */

@media (max-width: 540px) {
    .yt-watch-time-calculator { padding: 10px; }
    .yt-calc-header           { padding: 28px 20px 22px; }
    .yt-calc-title            { font-size: 22px; }
    .yt-calc-body,
    .yt-results               { padding: 22px 18px; }
    .yt-results-grid          { grid-template-columns: repeat(2, 1fr); gap: 10px; }
    .yt-channel-input-row     { flex-direction: column; }
    .yt-fetch-btn             { width: 100% !important; height: 44px !important; }
    .result-value             { font-size: 20px; }
}
