/* ========================================
   Performance Budget Calculator — Styles
   Ice Blue Theme with Glassmorphism
   ======================================== */

:root {
    --primary: #74B9FF;
    --primary-hover: #5BA8F5;
    --primary-glow: rgba(116, 185, 255, 0.25);
    --secondary: #DFE6E9;
    --accent: #E17055;
    --accent-glow: rgba(225, 112, 85, 0.2);
    --green: #00B894;
    --yellow: #FDCB6E;
    --red: #E17055;
    --bg-primary: #0A121A;
    --bg-secondary: #0F1922;
    --bg-card: rgba(15, 25, 34, 0.75);
    --bg-input: rgba(10, 18, 26, 0.6);
    --border: rgba(116, 185, 255, 0.12);
    --border-hover: rgba(116, 185, 255, 0.3);
    --text-primary: #ECF0F1;
    --text-secondary: #B2BEC3;
    --text-muted: #636E72;
    --radius: 12px;
    --radius-sm: 8px;
    --shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font);
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    background-image:
        radial-gradient(ellipse at 30% 0%, rgba(116, 185, 255, 0.06) 0%, transparent 50%),
        radial-gradient(ellipse at 70% 100%, rgba(0, 184, 148, 0.04) 0%, transparent 50%);
}

.app {
    max-width: 800px;
    margin: 0 auto;
    padding: 2rem 1.5rem 4rem;
}

/* Header */
.header {
    text-align: center;
    margin-bottom: 1.5rem;
}

.logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    margin-bottom: 0.4rem;
}

.logo-icon {
    font-size: 1.8rem;
}

.logo h1 {
    font-size: 1.4rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary), var(--green));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.subtitle {
    color: var(--text-secondary);
    font-size: 0.85rem;
}

/* Actions Bar */
.actions-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1.25rem;
    justify-content: center;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.5rem 0.85rem;
    border: none;
    border-radius: var(--radius-sm);
    font-family: var(--font);
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
    white-space: nowrap;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), #A0D2FF);
    color: #0A121A;
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 16px var(--primary-glow);
}

.btn-secondary {
    background: rgba(116, 185, 255, 0.1);
    border: 1px solid rgba(116, 185, 255, 0.2);
    color: var(--text-primary);
}

.btn-secondary:hover {
    background: rgba(116, 185, 255, 0.18);
    border-color: var(--border-hover);
    transform: translateY(-1px);
}

.btn-ghost {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-secondary);
}

.btn-ghost:hover {
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-primary);
}

/* Cards */
.card {
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
    margin-bottom: 1rem;
}

.card-title {
    font-size: 0.95rem;
    font-weight: 700;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

/* Connection Row */
.connection-row {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
    flex-wrap: wrap;
}

.conn-btn {
    padding: 0.45rem 1rem;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text-secondary);
    border-radius: 100px;
    font-family: var(--font);
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition);
}

.conn-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.conn-btn.active {
    background: linear-gradient(135deg, rgba(116, 185, 255, 0.2), rgba(0, 184, 148, 0.1));
    border-color: var(--primary);
    color: var(--text-primary);
    box-shadow: 0 0 12px var(--primary-glow);
}

.conn-info {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.meta-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.2rem 0.55rem;
    background: rgba(116, 185, 255, 0.08);
    border: 1px solid rgba(116, 185, 255, 0.15);
    border-radius: 100px;
    font-size: 0.72rem;
    color: var(--text-secondary);
    font-weight: 500;
}

/* Metric Groups */
.metric-group {
    margin-bottom: 1.25rem;
}

.metric-group:last-child {
    margin-bottom: 0;
}

.metric-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.35rem;
}

.metric-header label {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.metric-value {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--primary);
    font-variant-numeric: tabular-nums;
}

/* Sliders */
.slider {
    width: 100%;
    -webkit-appearance: none;
    appearance: none;
    height: 6px;
    border-radius: 3px;
    background: linear-gradient(90deg, var(--green), var(--yellow), var(--red));
    outline: none;
    margin-bottom: 0.3rem;
}

.slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--text-primary);
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
    transition: transform 0.15s;
}

.slider::-webkit-slider-thumb:hover {
    transform: scale(1.15);
}

/* Scale Labels */
.metric-scale {
    display: flex;
    justify-content: space-between;
    font-size: 0.68rem;
    font-weight: 500;
    margin-bottom: 0.4rem;
}

.metric-scale .good {
    color: var(--green);
}

.metric-scale .needs {
    color: var(--yellow);
}

.metric-scale .poor {
    color: var(--red);
}

/* Bar Charts */
.bar-chart {
    margin-bottom: 0.3rem;
}

.bar-bg {
    width: 100%;
    height: 8px;
    background: rgba(116, 185, 255, 0.08);
    border-radius: 4px;
    overflow: hidden;
}

.bar-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.4s ease, background 0.3s ease;
}

.lcp-bar,
.ttfb-bar {
    background: linear-gradient(90deg, var(--green), var(--primary));
}

.inp-bar,
.tbt-bar {
    background: linear-gradient(90deg, var(--green), var(--yellow));
}

.cls-bar {
    background: linear-gradient(90deg, var(--green), var(--primary));
}

.js-bar {
    background: linear-gradient(90deg, var(--primary), #A0D2FF);
}

.css-bar {
    background: linear-gradient(90deg, #00CEC9, var(--green));
}

.img-bar {
    background: linear-gradient(90deg, var(--yellow), var(--accent));
}

.total-bar {
    background: linear-gradient(90deg, var(--primary), var(--accent));
}

.load-time {
    font-size: 0.72rem;
    color: var(--text-muted);
    font-style: italic;
}

/* Tips */
.tips-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.tip {
    padding: 0.65rem 0.85rem;
    background: rgba(116, 185, 255, 0.06);
    border: 1px solid rgba(116, 185, 255, 0.1);
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    color: var(--text-secondary);
    line-height: 1.5;
    transition: background var(--transition);
}

.tip:hover {
    background: rgba(116, 185, 255, 0.1);
}

.tip-icon {
    margin-right: 0.4rem;
}

.tip.good {
    border-color: rgba(0, 184, 148, 0.25);
}

.tip.warn {
    border-color: rgba(253, 203, 110, 0.25);
}

.tip.bad {
    border-color: rgba(225, 112, 85, 0.25);
}

/* Toast */
.toast {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    padding: 0.65rem 1.2rem;
    background: var(--bg-card);
    backdrop-filter: blur(16px);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-primary);
    font-size: 0.82rem;
    font-weight: 500;
    box-shadow: var(--shadow);
    opacity: 0;
    transition: all 0.3s ease;
    z-index: 1000;
    pointer-events: none;
}

.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.hidden {
    display: none !important;
}

@media (max-width: 600px) {
    .app {
        padding: 1rem 0.85rem 3rem;
    }

    .logo h1 {
        font-size: 1.1rem;
    }

    .actions-bar {
        justify-content: stretch;
    }

    .actions-bar .btn {
        flex: 1;
        justify-content: center;
        font-size: 0.75rem;
    }

    .connection-row {
        flex-wrap: wrap;
    }

    .conn-btn {
        flex: 1;
        text-align: center;
        min-width: 70px;
    }
}