/* ===== YOUTUBE TRAFFIC ANALYZER - DARK THEME WITH GOLD HEADER ===== */

#yt-analyzer-app, #yt-analyzer-app * {
    margin: 0; padding: 0; box-sizing: border-box;
}

#yt-analyzer-app {
    max-width: 100%; width: 100%; margin: 0 auto; padding: 15px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: #0a0a0f; color: #e0e0e0; line-height: 1.5; border-radius: 16px; overflow: hidden;
}

/* ===== HEADER WITH ART ===== */
.yt-header { 
    text-align: center; 
    padding: 25px 10px 15px; 
    margin-bottom: 15px;
    background: linear-gradient(180deg, #0f0f1a 0%, #0a0a0f 100%);
    border-bottom: 1px solid #1a1a2e;
    position: relative;
}

.yt-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #FF0000, #fcd34d, #FF0000);
    background-size: 200% 100%;
    animation: yt-header-glow 4s linear infinite;
}

@keyframes yt-header-glow {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

.yt-header .yt-header-icon {
    font-size: clamp(36px, 6vw, 48px);
    color: #FF0000;
    display: block;
    margin-bottom: 6px;
    text-shadow: 0 0 30px rgba(255,0,0,0.3);
}

.yt-header h1 {
    font-size: clamp(22px, 5vw, 34px);
    font-weight: 900;
    margin-bottom: 4px;
    line-height: 1.2;
    letter-spacing: -0.5px;
}

.yt-header .yt-gradient-text {
    background: linear-gradient(135deg, #fcd34d 0%, #f59e0b 50%, #fbbf24 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: none;
    position: relative;
}

.yt-header .yt-gradient-text::after {
    content: '📊';
    font-size: 20px;
    -webkit-text-fill-color: initial;
    margin-left: 6px;
    display: inline-block;
    animation: yt-bounce 2s ease-in-out infinite;
}

@keyframes yt-bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-5px); }
}

.yt-header p {
    font-size: clamp(12px, 2.5vw, 15px);
    color: #888;
    margin-top: 4px;
}

.yt-header .highlight { color: #ff4444; font-weight: 600; }
.yt-header .highlight-blue { color: #3EA6FF; font-weight: 600; }
.yt-header .highlight-green { color: #1DB954; font-weight: 600; }
.yt-header .highlight-orange { color: #FFA500; font-weight: 600; }

/* ===== MODE SELECTOR ===== */
.yt-mode-selector {
    display: flex;
    gap: 6px;
    justify-content: center;
    margin-bottom: 15px;
    background: #1a1a1a;
    padding: 4px;
    border-radius: 25px;
    width: fit-content;
    margin-left: auto;
    margin-right: auto;
}

.yt-mode-btn {
    padding: 10px 18px;
    border-radius: 22px;
    cursor: pointer;
    font-weight: 600;
    font-size: clamp(11px, 2.5vw, 13px);
    border: none;
    background: transparent;
    color: #999;
    transition: all 0.3s;
    white-space: nowrap;
}

.yt-mode-btn.active {
    background: #FF0000;
    color: #fff;
}

.yt-mode-btn:hover:not(.active) {
    color: #fff;
    background: #252525;
}

/* ===== API SECTION ===== */
.yt-api-section { display: none; margin-bottom: 15px; }
.yt-api-section.show { display: block; }

.yt-api-panel {
    background: linear-gradient(135deg, #1a1a2e, #16213e);
    border: 1px solid #2a2a3e;
    border-radius: 14px;
    padding: 16px;
    transition: all 0.3s ease;
}

.yt-api-panel.configured { border-color: #1DB954; }
.yt-api-panel.error { border-color: #FF0000; }

.yt-api-title {
    font-size: clamp(12px, 2.5vw, 14px);
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.yt-api-title i { color: #FFD700; }

.yt-api-help-toggle {
    background: none;
    border: none;
    color: #666;
    cursor: pointer;
    font-size: 11px;
    margin-left: auto;
    padding: 4px 8px;
    transition: color 0.3s;
}

.yt-api-help-toggle:hover { color: #3EA6FF; }

.yt-api-help-box {
    display: none;
    margin-bottom: 12px;
    padding: 10px 14px;
    background: rgba(62,166,255,0.06);
    border-left: 2px solid #3EA6FF;
    border-radius: 0 6px 6px 0;
    font-size: 11px;
    color: #aaa;
    line-height: 1.6;
}

.yt-api-help-box a { color: #3EA6FF; text-decoration: underline; }

.yt-api-row {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
    margin-bottom: 12px;
}

.yt-api-field label {
    display: block;
    font-size: 11px;
    color: #ccc;
    margin-bottom: 4px;
    font-weight: 500;
}

.yt-api-field label i { margin-right: 3px; }

.yt-api-input-wrap {
    position: relative;
    display: flex;
    align-items: center;
}

.yt-api-input {
    width: 100%;
    padding: 10px 36px 10px 12px;
    background: #1a1a1a;
    border: 1px solid #333;
    border-radius: 8px;
    color: #fff;
    font-size: 12px;
    font-family: 'Courier New', monospace;
    transition: all 0.3s;
}

.yt-api-input:focus { outline: none; border-color: #FF0000; }
.yt-api-input.saved { border-color: #1DB954; background: #0a1a0a; }

.yt-api-eye-btn {
    position: absolute;
    right: 8px;
    background: none;
    border: none;
    color: #666;
    cursor: pointer;
    padding: 6px;
    font-size: 12px;
    transition: color 0.3s;
}

.yt-api-eye-btn:hover { color: #fff; }

.yt-api-hint { font-size: 9px; color: #666; margin-top: 3px; }

.yt-api-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
}

.yt-api-status {
    font-size: 11px;
    margin-top: 8px;
    padding: 6px 10px;
    border-radius: 8px;
    display: inline-block;
}

.status-success { background: rgba(29,185,84,0.12); color: #4ade80; }
.status-error { background: rgba(255,0,0,0.12); color: #ff6b6b; }
.status-testing { background: rgba(62,166,255,0.12); color: #60a5fa; }
.status-saved { background: rgba(29,185,84,0.08); color: #4ade80; }

/* ===== BUTTONS ===== */
.yt-btn {
    padding: 8px 14px;
    border-radius: 20px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    font-size: clamp(10px, 2vw, 12px);
    transition: all 0.3s;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
}

.yt-btn-red { background: linear-gradient(135deg, #FF0000, #cc0000); color: #fff; }
.yt-btn-red:hover { box-shadow: 0 3px 15px rgba(255,0,0,0.25); transform: translateY(-1px); }

.yt-btn-green { background: linear-gradient(135deg, #1DB954, #169c46); color: #fff; }
.yt-btn-green:hover { box-shadow: 0 3px 15px rgba(29,185,84,0.25); transform: translateY(-1px); }

.yt-btn-blue { background: linear-gradient(135deg, #3EA6FF, #1a73e8); color: #fff; }
.yt-btn-blue:hover { box-shadow: 0 3px 15px rgba(62,166,255,0.25); transform: translateY(-1px); }

.yt-btn-outline { background: transparent; border: 1px solid #444; color: #fff; }
.yt-btn-outline:hover { border-color: #FF0000; color: #FF0000; }

.yt-btn-full { width: 100%; justify-content: center; padding: 12px 16px; font-size: 13px; }

/* ===== INPUT CARDS ===== */
.yt-input-card {
    background: #1a1a1a;
    border: 1px solid #333;
    border-radius: 14px;
    padding: 16px;
    margin-bottom: 15px;
}

.yt-input-row {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.yt-url-input {
    width: 100%;
    padding: 12px 14px;
    background: #252525;
    border: 1px solid #333;
    border-radius: 10px;
    color: #fff;
    font-size: clamp(12px, 2.5vw, 14px);
    transition: border-color 0.3s;
}

.yt-url-input:focus { outline: none; border-color: #FF0000; }
.yt-url-input::placeholder { color: #666; }

.yt-examples {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 8px;
    align-items: center;
}

.yt-example-label { font-size: 10px; color: #666; margin-right: 2px; }

.yt-example-chip {
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 10px;
    cursor: pointer;
    background: #252525;
    color: #aaa;
    border: 1px solid #333;
    transition: all 0.3s;
    white-space: nowrap;
}

.yt-example-chip:hover { border-color: #FF0000; color: #ff4444; background: rgba(255,0,0,0.08); }

/* ===== LOADING ===== */
.yt-loading { display: none; text-align: center; padding: 30px 20px; }
.yt-loading.show { display: block; }

.yt-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #333;
    border-top-color: #FF0000;
    border-radius: 50%;
    animation: yt-spin 1s linear infinite;
    margin: 0 auto 15px;
}

@keyframes yt-spin { to { transform: rotate(360deg); } }

.yt-loading-text { color: #999; font-size: 14px; }
.yt-loading-detail { font-size: 11px; color: #666; margin-top: 3px; }

/* ===== RESULTS ===== */
.yt-results { display: none; }
.yt-results.show { display: block; }

/* ===== VIDEO BANNER ===== */
.yt-video-banner {
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: #1a1a1a;
    border: 1px solid #333;
    border-radius: 14px;
    padding: 12px;
    margin-bottom: 12px;
}

.yt-video-thumb {
    width: 100%;
    border-radius: 10px;
    aspect-ratio: 16/9;
    object-fit: cover;
    background: #252525;
}

.yt-video-info h3 {
    font-size: clamp(13px, 3vw, 17px);
    margin-bottom: 4px;
    line-height: 1.3;
}

.yt-video-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    font-size: 10px;
    color: #999;
    margin-bottom: 6px;
}

.yt-video-meta span {
    display: flex;
    align-items: center;
    gap: 4px;
    background: #252525;
    padding: 4px 8px;
    border-radius: 12px;
}

.yt-video-meta i { color: #FF0000; font-size: 9px; }

.yt-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.yt-tag {
    padding: 3px 8px;
    border-radius: 10px;
    font-size: 9px;
    background: rgba(62,166,255,0.12);
    color: #60a5fa;
    border: 1px solid rgba(62,166,255,0.15);
}

/* ===== STATS GRID ===== */
.yt-stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    margin-bottom: 12px;
}

.yt-stat-card {
    background: #1a1a1a;
    border: 1px solid #333;
    border-radius: 12px;
    padding: 12px 8px;
    text-align: center;
    transition: all 0.3s;
}

.yt-stat-card:hover { border-color: #555; transform: translateY(-1px); }

.yt-stat-card i { font-size: 18px; margin-bottom: 4px; display: block; }
.yt-stat-value { font-size: clamp(14px, 3.5vw, 20px); font-weight: 800; display: block; }
.yt-stat-label { font-size: 9px; color: #888; text-transform: uppercase; letter-spacing: 0.3px; margin-top: 2px; }

.stat-red i { color: #FF0000; }
.stat-green i { color: #1DB954; }
.stat-orange i { color: #FFA500; }
.stat-blue i { color: #3EA6FF; }
.stat-purple i { color: #8884D8; }

/* ===== GRADE ===== */
.yt-grade {
    display: inline-block;
    padding: 1px 6px;
    border-radius: 8px;
    font-size: 9px;
    font-weight: 700;
    margin-left: 4px;
}

.grade-a { background: rgba(29,185,84,0.2); color: #4ade80; }
.grade-b { background: rgba(29,185,84,0.12); color: #4ade80; }
.grade-c { background: rgba(255,165,0,0.2); color: #fbbf24; }
.grade-d { background: rgba(255,0,0,0.2); color: #ff6b6b; }

/* ===== TABS ===== */
.yt-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 12px;
    overflow-x: auto;
    scrollbar-width: none;
    padding-bottom: 3px;
}

.yt-tabs::-webkit-scrollbar { display: none; }

.yt-tab-btn {
    padding: 7px 14px;
    border-radius: 16px;
    font-size: clamp(10px, 2vw, 12px);
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    background: #1a1a1a;
    color: #999;
    border: 1px solid #333;
    transition: all 0.3s;
    flex-shrink: 0;
}

.yt-tab-btn:hover { background: #252525; color: #fff; }
.yt-tab-btn.active { background: #FF0000; color: #fff; border-color: #FF0000; }

.yt-tab-panel { display: none; }
.yt-tab-panel.active { display: block; animation: yt-fadeIn 0.3s ease; }

@keyframes yt-fadeIn {
    from { opacity: 0; transform: translateY(5px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ===== CARDS ===== */
.yt-card {
    background: #1a1a1a;
    border: 1px solid #333;
    border-radius: 12px;
    padding: 14px;
    margin-bottom: 12px;
}

.yt-card h3 {
    font-size: clamp(12px, 2.5vw, 14px);
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.yt-card h3 i { color: #FF0000; font-size: 14px; }

.yt-chart { width: 100%; min-height: 250px; }

/* ===== TABLES ===== */
.yt-table-wrap { overflow-x: auto; margin: 0 -14px; padding: 0 14px; }

.yt-table {
    width: 100%;
    min-width: 400px;
    border-collapse: collapse;
    font-size: 11px;
}

.yt-table th {
    text-align: left;
    padding: 8px 10px;
    border-bottom: 1px solid #333;
    color: #999;
    font-size: 9px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.yt-table td {
    padding: 8px 10px;
    border-bottom: 1px solid #222;
}

.yt-table tr:hover td { background: rgba(255,255,255,0.02); }

.yt-source-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
    margin-right: 6px;
    vertical-align: middle;
}

.yt-mini-bar {
    width: 50px;
    height: 4px;
    background: #333;
    border-radius: 2px;
    overflow: hidden;
    display: inline-block;
    vertical-align: middle;
    margin-right: 6px;
}

.yt-mini-fill {
    height: 100%;
    border-radius: 2px;
    transition: width 1s ease;
}

.yt-conf {
    display: inline-block;
    padding: 2px 6px;
    border-radius: 8px;
    font-size: 9px;
    font-weight: 700;
}

.conf-high { background: rgba(29,185,84,0.15); color: #4ade80; }
.conf-med { background: rgba(255,165,0,0.15); color: #fbbf24; }
.conf-low { background: rgba(255,0,0,0.15); color: #ff6b6b; }

/* ===== BREAKDOWN GRID ===== */
.yt-breakdown-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 12px;
}

.yt-breakdown-item {
    background: #252525;
    border: 1px solid #333;
    border-radius: 10px;
    padding: 10px 12px;
    transition: all 0.3s;
}

.yt-breakdown-item:hover { border-color: #555; transform: translateY(-1px); }

.yt-breakdown-header {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 4px;
}

.yt-breakdown-icon {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    flex-shrink: 0;
}

.yt-breakdown-name { font-weight: 600; font-size: 11px; }
.yt-breakdown-value { font-size: clamp(12px, 2.5vw, 16px); font-weight: 800; font-family: 'Courier New', monospace; }
.yt-breakdown-pct { font-size: 10px; color: #999; }

.yt-breakdown-bar {
    height: 3px;
    background: #333;
    border-radius: 2px;
    margin-top: 6px;
    overflow: hidden;
}

.yt-breakdown-bar-fill {
    height: 100%;
    border-radius: 2px;
    transition: width 1s ease;
}

.yt-trend-up { color: #4ade80; }
.yt-trend-down { color: #ff6b6b; }
.yt-trend-stable { color: #fbbf24; }

/* ===== ORGANIC/EXTERNAL ===== */
.yt-organic-external {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 12px;
}

.yt-oe-card {
    background: #1a1a1a;
    border: 1px solid #333;
    border-radius: 12px;
    padding: 14px;
    text-align: center;
}

.yt-oe-card h4 {
    font-size: 11px;
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
}

.yt-oe-value {
    font-size: clamp(16px, 3.5vw, 24px);
    font-weight: 800;
    display: block;
}

.yt-oe-sub { font-size: 9px; color: #888; margin-top: 2px; }

/* ===== SEO GRID ===== */
.yt-seo-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 6px;
}

.yt-seo-item {
    background: #252525;
    padding: 10px;
    border-radius: 8px;
    text-align: center;
}

.yt-seo-item .seo-label {
    font-size: 9px;
    color: #888;
    display: block;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.yt-seo-item .seo-val {
    font-size: 15px;
    font-weight: 700;
    display: block;
    margin-top: 2px;
}

/* ===== TIPS ===== */
.yt-tip {
    border-left: 2px solid;
    padding: 10px 12px;
    border-radius: 0 8px 8px 0;
    margin-bottom: 6px;
    background: rgba(255,255,255,0.02);
}

.yt-tip-title { font-weight: 700; font-size: 11px; margin-bottom: 2px; }
.yt-tip-text { font-size: 10px; color: #aaa; }
.yt-tip-action { font-size: 9px; font-weight: 600; margin-top: 3px; }

/* ===== ERROR ===== */
.yt-error {
    display: none;
    text-align: center;
    padding: 30px 20px;
}

.yt-error.show { display: block; }

.yt-error-icon {
    font-size: 40px;
    color: #FFA500;
    margin-bottom: 10px;
    display: block;
}

.yt-error h3 { font-size: 16px; margin-bottom: 6px; }
.yt-error p { color: #999; font-size: 12px; margin-bottom: 12px; }

/* ===== FOOTER ===== */
.yt-footer {
    text-align: center;
    padding: 15px 10px;
    font-size: 9px;
    color: #555;
    margin-top: 8px;
    border-top: 1px solid #222;
}

.yt-footer a { color: #3EA6FF; text-decoration: none; }

/* ===== TOAST ===== */
.yt-toast {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    padding: 10px 20px;
    border-radius: 20px;
    color: #fff;
    font-size: 12px;
    font-weight: 600;
    z-index: 9999;
    display: none;
    background: #1DB954;
    box-shadow: 0 8px 25px rgba(0,0,0,0.5);
}

.yt-toast.show { display: block; animation: yt-fadeIn 0.3s ease; }
.yt-toast.error { background: #FF0000; }
.yt-toast.info { background: #3EA6FF; }

/* ===== RESPONSIVE ===== */
@media (min-width: 480px) {
    #yt-analyzer-app { padding: 18px; }
    .yt-stats-grid { grid-template-columns: repeat(4, 1fr); }
    .yt-api-row { grid-template-columns: 1fr 1fr; }
    .yt-video-banner { flex-direction: row; }
    .yt-video-thumb { width: 160px; flex-shrink: 0; }
    .yt-seo-grid { grid-template-columns: repeat(3, 1fr); }
    .yt-breakdown-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (min-width: 768px) {
    #yt-analyzer-app { padding: 20px; border-radius: 18px; }
    .yt-input-row { flex-direction: row; }
    .yt-input-row .yt-btn-full { width: auto; min-width: 130px; flex-shrink: 0; }
    .yt-video-thumb { width: 200px; }
    .yt-card { padding: 18px; }
    .yt-header { padding: 30px 15px 20px; }
    .yt-breakdown-grid { grid-template-columns: repeat(4, 1fr); }
}

@media (min-width: 1024px) {
    #yt-analyzer-app { padding: 25px; }
    .yt-video-thumb { width: 240px; }
    .yt-breakdown-grid { grid-template-columns: repeat(5, 1fr); }
}