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

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

.tkec-wrapper {
    font-family: 'DM Sans', sans-serif;
    max-width: 580px;
    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 */
.tkec-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 1.5rem;
}

.tkec-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: #111;
    margin: 0;
    line-height: 1.2;
}

/* Hint text */
.tkec-hint-text {
    font-size: 0.82rem;
    color: #888;
    margin-bottom: 1rem;
    line-height: 1.5;
}

/* Mode Toggle */
.tkec-mode-toggle {
    display: flex;
    background: #f5f5f5;
    border-radius: 12px;
    padding: 4px;
    margin-bottom: 1.75rem;
    gap: 4px;
}

.tkec-mode-btn {
    flex: 1;
    padding: 0.55rem 1rem;
    border: none;
    border-radius: 9px;
    font-family: 'DM Sans', sans-serif;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    background: transparent;
    color: #888;
    transition: all 0.2s ease;
}

.tkec-mode-btn.tkec-active {
    background: #ffffff;
    color: #111;
    box-shadow: 0 1px 6px rgba(0,0,0,0.1);
}

/* Fields */
.tkec-fields {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.tkec-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.tkec-field-full {
    grid-column: 1 / -1;
}

.tkec-label {
    font-size: 0.82rem;
    font-weight: 500;
    color: #444;
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.tkec-badge-label {
    font-size: 0.68rem;
    font-weight: 500;
    background: #010101;
    color: #fff;
    padding: 1px 7px;
    border-radius: 20px;
    letter-spacing: 0.02em;
}

.tkec-input {
    padding: 0.65rem 0.9rem;
    border: 1.5px solid #e8e8e8;
    border-radius: 10px;
    font-family: 'DM Sans', sans-serif;
    font-size: 0.95rem;
    color: #111;
    background: #fafafa;
    transition: border-color 0.2s, background 0.2s;
    outline: none;
    -moz-appearance: textfield;
}

.tkec-input::-webkit-outer-spin-button,
.tkec-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
}

.tkec-input:focus {
    border-color: #010101;
    background: #fff;
}

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

/* Calculate Button */
.tkec-calc-btn {
    width: 100%;
    padding: 0.85rem;
    background: #010101;
    color: #fff;
    border: none;
    border-radius: 12px;
    font-family: 'DM Sans', sans-serif;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    letter-spacing: 0.01em;
    transition: opacity 0.2s, transform 0.15s;
    position: relative;
    overflow: hidden;
}

.tkec-calc-btn::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, #69C9D0, #EE1D52);
    opacity: 0;
    transition: opacity 0.3s;
}

.tkec-calc-btn:hover::before {
    opacity: 1;
}

.tkec-calc-btn span {
    position: relative;
    z-index: 1;
}

.tkec-calc-btn:hover {
    transform: translateY(-1px);
}

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

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

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

.tkec-results-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
}

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

.tkec-result-main {
    grid-column: 1 / -1;
    background: linear-gradient(135deg, rgba(105,201,208,0.1), rgba(238,29,82,0.08));
    border: 1.5px solid rgba(238,29,82,0.15);
}

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

.tkec-result-value {
    font-size: 2.4rem;
    font-weight: 600;
    background: linear-gradient(135deg, #69C9D0, #EE1D52);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1;
}

.tkec-result-value.tkec-secondary {
    font-size: 1.5rem;
    background: linear-gradient(135deg, #555, #888);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

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

.tkec-result-badge.tkec-badge-poor     { background: #ffe0e0; color: #c0392b; }
.tkec-result-badge.tkec-badge-average  { background: #fff3d4; color: #c07a00; }
.tkec-result-badge.tkec-badge-good     { background: #d6f5e3; color: #1a7a40; }
.tkec-result-badge.tkec-badge-excellent{ background: #d6f5f8; color: #0a7a85; }

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

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

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

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

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

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

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

.tkec-bench-poor     { background: #e74c3c; }
.tkec-bench-avg      { background: #f39c12; }
.tkec-bench-good     { background: #27ae60; }
.tkec-bench-excellent{ background: linear-gradient(90deg, #69C9D0, #EE1D52); }

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

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

/* Reset */
.tkec-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;
}

.tkec-reset-btn:hover {
    border-color: #010101;
    color: #010101;
}

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

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

    .tkec-fields {
        grid-template-columns: 1fr;
    }

    .tkec-field-full {
        grid-column: 1;
    }

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

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

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