/* =============================================
   YouTube Engagement Rate Calculator — Stylesheet
   ============================================= */

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

.ytec-wrapper {
    font-family: 'DM Sans', sans-serif;
    max-width: 640px;
    margin: 2rem auto;
    background: #ffffff;
    border: 1px solid #f0f0f0;
    border-radius: 20px;
    padding: 2rem;
    box-shadow: 0 2px 24px rgba(0,0,0,0.06);
}

/* Header */
.ytec-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 1.75rem;
}

.ytec-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: #111;
    margin: 0;
}

/* Search */
.ytec-search-wrap {
    margin-bottom: 1.25rem;
}

.ytec-label {
    display: block;
    font-size: 0.82rem;
    font-weight: 500;
    color: #444;
    margin-bottom: 6px;
}

.ytec-input-row {
    display: flex;
    gap: 8px;
}

.ytec-input {
    flex: 1;
    padding: 0.7rem 1rem;
    border: 1.5px solid #e8e8e8;
    border-radius: 10px;
    font-family: 'DM Sans', sans-serif;
    font-size: 0.95rem;
    color: #111;
    background: #fafafa;
    outline: none;
    transition: border-color 0.2s;
}

.ytec-input:focus {
    border-color: #FF0000;
    background: #fff;
}

.ytec-input::placeholder {
    color: #c8c8c8;
}

.ytec-hint-text {
    font-size: 0.78rem;
    color: #aaa;
    margin-top: 6px;
}

/* Button */
.ytec-calc-btn {
    padding: 0.7rem 1.25rem;
    background: #FF0000;
    color: #fff;
    border: none;
    border-radius: 10px;
    font-family: 'DM Sans', sans-serif;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.2s, transform 0.15s;
    display: flex;
    align-items: center;
    gap: 6px;
}

.ytec-calc-btn:hover {
    background: #cc0000;
    transform: translateY(-1px);
}

.ytec-calc-btn:active {
    transform: translateY(0);
}

.ytec-calc-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

/* Spinner */
.ytec-spinner {
    animation: ytec-spin 0.8s linear infinite;
}

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

/* Error */
.ytec-error {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #fef0f0;
    border: 1px solid #fcc;
    border-radius: 10px;
    padding: 0.75rem 1rem;
    font-size: 0.85rem;
    color: #c0392b;
    margin-bottom: 1rem;
}

/* Results */
.ytec-results {
    margin-top: 1.5rem;
    animation: ytec-fadein 0.35s ease;
}

@keyframes ytec-fadein {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* Channel card */
.ytec-channel-card {
    display: flex;
    align-items: center;
    gap: 12px;
    background: #f8f8f8;
    border-radius: 14px;
    padding: 1rem;
    margin-bottom: 1.25rem;
}

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

.ytec-channel-name {
    font-size: 1rem;
    font-weight: 600;
    color: #111;
}

.ytec-channel-meta {
    font-size: 0.8rem;
    color: #888;
    margin-top: 3px;
}

/* Results grid */
.ytec-results-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
}

.ytec-result-card {
    background: #f8f8f8;
    border-radius: 14px;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    text-align: center;
}

.ytec-result-main {
    grid-column: 1 / -1;
    background: linear-gradient(135deg, rgba(255,0,0,0.06), rgba(255,0,0,0.03));
    border: 1.5px solid rgba(255,0,0,0.15);
}

.ytec-result-secondary {
    grid-column: span 1;
    background: #f8f8f8;
    border: 1px solid #efefef;
}

.ytec-label-tag {
    display: inline-block;
    font-size: 0.65rem;
    font-weight: 600;
    background: #FF0000;
    color: #fff;
    padding: 1px 7px;
    border-radius: 20px;
    letter-spacing: 0.03em;
    vertical-align: middle;
    margin-left: 4px;
}

.ytec-result-label {
    font-size: 0.75rem;
    color: #888;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.ytec-result-value {
    font-size: 2.4rem;
    font-weight: 600;
    color: #FF0000;
    line-height: 1;
}

.ytec-result-value.ytec-secondary {
    font-size: 1.4rem;
    color: #333;
}

.ytec-result-badge {
    font-size: 0.75rem;
    font-weight: 600;
    padding: 3px 12px;
    border-radius: 20px;
    background: #eee;
    color: #666;
}

.ytec-result-badge.ytec-badge-poor     { background: #ffe0e0; color: #c0392b; }
.ytec-result-badge.ytec-badge-average  { background: #fff3d4; color: #c07a00; }
.ytec-result-badge.ytec-badge-good     { background: #d6f5e3; color: #1a7a40; }
.ytec-result-badge.ytec-badge-excellent{ background: #ffe8e8; color: #990000; }

.ytec-result-note {
    font-size: 0.72rem;
    color: #aaa;
}

/* Benchmark */
.ytec-benchmark {
    background: #f8f8f8;
    border-radius: 14px;
    padding: 1.25rem;
    margin-bottom: 1.25rem;
}

.ytec-benchmark-title {
    font-size: 0.82rem;
    font-weight: 600;
    color: #555;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 0.9rem;
}

.ytec-benchmark-bars {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 0.75rem;
}

.ytec-bench-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.ytec-bench-label {
    font-size: 0.82rem;
    color: #666;
    width: 58px;
    flex-shrink: 0;
}

.ytec-bench-bar {
    flex: 1;
    height: 8px;
    background: #ebebeb;
    border-radius: 10px;
    overflow: hidden;
}

.ytec-bench-fill {
    height: 100%;
    border-radius: 10px;
}

.ytec-bench-poor     { background: #e74c3c; }
.ytec-bench-avg      { background: #f39c12; }
.ytec-bench-good     { background: #27ae60; }
.ytec-bench-excellent{ background: #FF0000; }

.ytec-bench-range {
    font-size: 0.78rem;
    color: #999;
    width: 52px;
    text-align: right;
    flex-shrink: 0;
}

.ytec-bench-note {
    font-size: 0.75rem;
    color: #999;
    line-height: 1.5;
}

/* Videos table */
.ytec-videos-wrap {
    margin-bottom: 1.25rem;
}

.ytec-videos-title {
    font-size: 0.82rem;
    font-weight: 600;
    color: #555;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 0.75rem;
}

.ytec-videos-table-wrap {
    overflow-x: auto;
    border-radius: 12px;
    border: 1px solid #f0f0f0;
}

.ytec-videos-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.82rem;
}

.ytec-videos-table th {
    background: #f8f8f8;
    padding: 0.6rem 0.75rem;
    text-align: left;
    font-weight: 600;
    color: #555;
    white-space: nowrap;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.ytec-videos-table td {
    padding: 0.6rem 0.75rem;
    border-top: 1px solid #f5f5f5;
    color: #333;
    vertical-align: middle;
}

.ytec-videos-table tr:hover td {
    background: #fafafa;
}

.ytec-video-title {
    max-width: 220px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: #111;
    font-weight: 500;
}

.ytec-eng-rate {
    font-weight: 600;
    color: #FF0000;
}

/* Reset */
.ytec-reset-btn {
    width: 100%;
    padding: 0.7rem;
    background: transparent;
    border: 1.5px solid #e8e8e8;
    border-radius: 10px;
    font-family: 'DM Sans', sans-serif;
    font-size: 0.9rem;
    color: #999;
    cursor: pointer;
    transition: border-color 0.2s, color 0.2s;
}

.ytec-reset-btn:hover {
    border-color: #FF0000;
    color: #FF0000;
}

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

/* Responsive */
@media (max-width: 540px) {
    .ytec-wrapper {
        padding: 1.25rem;
        border-radius: 16px;
        margin: 1rem;
    }

    .ytec-input-row {
        flex-direction: column;
    }

    .ytec-results-grid {
        grid-template-columns: 1fr 1fr;
    }

    .ytec-result-main {
        grid-column: 1 / -1;
    }

    .ytec-result-value {
        font-size: 2rem;
    }

    .ytec-result-value.ytec-secondary {
        font-size: 1.2rem;
    }
}
