/* CapVPN — Professional Tool V2 Styles */

.tool-page-v2 {
    padding: 3rem 0;
}

.tool-header-v2 {
    text-align: center;
    max-width: 720px;
    margin: 0 auto 2rem;
}

.tool-header-v2 .section-label {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    color: var(--primary);
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 0.75rem;
}

.tool-header-v2 h1 {
    font-size: clamp(1.9rem, 5vw, 2.7rem);
    margin-bottom: 0.75rem;
    letter-spacing: -0.02em;
}

.tool-header-v2 .lead {
    color: var(--text-2);
    font-size: 1.05rem;
    line-height: 1.7;
}

.container-md {
    max-width: 840px;
}

.tool-card-v2 {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border);
    border-radius: 1.2rem;
    padding: 2rem;
    margin-bottom: 1.5rem;
}

.tool-card-v2 h3 {
    font-size: 1.2rem;
    margin-bottom: 0.75rem;
}

.tool-servers {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.tool-server-chip {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border);
    color: var(--text-2);
    padding: 0.45rem 1rem;
    border-radius: 2rem;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 500;
    transition: 0.2s;
}

.tool-server-chip:hover,
.tool-server-chip.active {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}

.tool-gauge {
    width: 220px;
    height: 220px;
    margin: 0 auto 1.5rem;
    border-radius: 50%;
    background: conic-gradient(
        var(--primary) calc(var(--gauge, 0) * 1%),
        rgba(255, 255, 255, 0.08) 0
    );
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    transition: background 0.2s;
}

.tool-gauge-inner {
    width: 170px;
    height: 170px;
    border-radius: 50%;
    background: var(--bg-1);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.tool-gauge-val {
    font-size: 3.2rem;
    font-weight: 800;
    line-height: 1;
    color: var(--text-1);
}

.tool-gauge-unit {
    font-size: 0.9rem;
    color: var(--text-2);
    margin-bottom: 0.25rem;
}

.tool-gauge-label {
    font-size: 0.85rem;
    color: var(--primary);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.tool-progress-bar {
    width: 100%;
    height: 8px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 1.5rem;
}

.tool-progress-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--primary), var(--accent));
    border-radius: 4px;
    transition: width 0.4s ease;
}

.tool-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 1rem;
    margin-bottom: 1.75rem;
}

.tool-stat {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border);
    border-radius: 0.8rem;
    padding: 1rem;
    text-align: center;
}

.tool-stat-val {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text-1);
    margin-bottom: 0.25rem;
}

.tool-stat-val.protected { color: var(--emerald); }
.tool-stat-val.exposed { color: var(--rose); }

.tool-stat-lbl {
    font-size: 0.78rem;
    color: var(--text-2);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.tool-btn-v2 {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    background: var(--primary);
    color: #fff;
    border: none;
    padding: 0.9rem 2rem;
    border-radius: 0.65rem;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    text-decoration: none;
}

.tool-btn-v2:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 8px 22px rgba(0, 209, 109, 0.25);
}

.tool-btn-v2:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.text-center {
    text-align: center;
}

.text-muted {
    color: var(--text-2);
    font-size: 0.95rem;
    line-height: 1.7;
}

/* What Is My IP */
.ip-hero-label {
    font-size: 0.85rem;
    color: var(--text-2);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 0.5rem;
}

.ip-hero {
    font-family: var(--font-mono, monospace);
    font-size: clamp(1.8rem, 6vw, 2.8rem);
    font-weight: 800;
    color: var(--text-1);
    word-break: break-all;
    margin-bottom: 0.5rem;
}

.ip-hero-meta {
    color: var(--text-2);
    font-size: 0.95rem;
}

#detail-protected.protected { color: var(--emerald); font-weight: 700; }
#detail-protected.exposed { color: var(--rose); font-weight: 700; }

/* Security scanner findings */
.scan-findings {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.finding {
    border-left: 4px solid var(--text-2);
    background: rgba(255, 255, 255, 0.03);
    border-radius: 0 0.6rem 0.6rem 0;
    padding: 1rem 1.25rem;
}

.finding-high { border-left-color: var(--rose); }
.finding-medium { border-left-color: var(--amber); }
.finding-low { border-left-color: var(--cyan); }
.finding-good { border-left-color: var(--emerald); }

.finding-title {
    font-weight: 700;
    margin-bottom: 0.35rem;
    color: var(--text-1);
}

.finding-desc {
    font-size: 0.9rem;
    color: var(--text-2);
    line-height: 1.6;
}

.scan-details-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 0.75rem;
}

.scan-detail-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    padding: 0.8rem 1rem;
    font-size: 0.9rem;
}

.scan-detail-row span:first-child {
    color: var(--text-2);
}

.scan-detail-row span:last-child {
    color: var(--text-1);
    font-weight: 600;
    text-align: right;
    max-width: 55%;
    word-break: break-all;
    font-family: var(--font-mono, monospace);
}

.report-lock {
    text-align: center;
    max-width: 520px;
    margin: 0 auto;
}

.report-lock-icon {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: rgba(0, 209, 255, 0.1);
    color: var(--primary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1rem;
}

.report-form {
    display: flex;
    gap: 0.75rem;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 1.25rem;
}

.report-form .form-input {
    flex: 1;
    min-width: 220px;
    background: var(--bg-1);
    border: 1px solid var(--border);
    color: var(--text-1);
    padding: 0.85rem 1rem;
    border-radius: 0.5rem;
    outline: none;
}

.report-form .form-input:focus {
    border-color: var(--primary);
}

.report-msg {
    margin-top: 1rem;
    font-size: 0.9rem;
    min-height: 1.5em;
}

.report-msg.success { color: var(--emerald); }
.report-msg.error { color: var(--rose); }

.scan-cta-btns {
    display: flex;
    gap: 0.75rem;
    justify-content: center;
    flex-wrap: wrap;
}

/* Leak test result boxes */
.leak-result {
    color: var(--text-2);
    font-size: 0.95rem;
}

.leak-box {
    border-radius: 0.6rem;
    padding: 1rem 1.25rem;
    line-height: 1.7;
}

.leak-box strong {
    display: block;
    margin-bottom: 0.35rem;
    color: var(--text-1);
}

.leak-good {
    background: rgba(16, 185, 129, 0.08);
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.leak-bad {
    background: rgba(244, 63, 94, 0.08);
    border: 1px solid rgba(244, 63, 94, 0.2);
}

.leak-warn {
    background: rgba(245, 158, 11, 0.08);
    border: 1px solid rgba(245, 158, 11, 0.2);
}

.status-badge {
    display: inline-block;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    padding: 0.2rem 0.55rem;
    border-radius: 999px;
}

/* Password checker */
.toggle-vis {
    position: absolute;
    right: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-2);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.toggle-vis:hover { color: var(--primary); }

.checks-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 0.75rem;
}

.check-item {
    font-size: 0.9rem;
    color: var(--text-2);
    padding: 0.6rem 0.85rem;
    border-radius: 0.5rem;
    background: rgba(255,255,255,0.03);
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.check-item::before {
    content: "";
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--text-2);
}

.check-item.pass { color: var(--emerald); border-color: rgba(16,185,129,0.25); }
.check-item.pass::before { background: var(--emerald); }
.check-item.fail { color: var(--rose); border-color: rgba(244,63,94,0.25); }
.check-item.fail::before { background: var(--rose); }

.hidden {
    display: none !important;
}

@media (max-width: 600px) {
    .tool-card-v2 { padding: 1.25rem; }
    .tool-gauge { width: 170px; height: 170px; }
    .tool-gauge-inner { width: 130px; height: 130px; }
    .tool-gauge-val { font-size: 2.4rem; }
    .scan-detail-row { flex-direction: column; align-items: flex-start; gap: 0.35rem; }
    .scan-detail-row span:last-child { text-align: left; max-width: 100%; }
}

/* ─── REDESIGNED SPEED TEST & PING TEST ─── */

/* Phase pills */
.speed-phase-bar,
.ping-phase-bar {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 1.75rem;
    flex-wrap: wrap;
}

.speed-phase,
.ping-phase {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.45rem 0.9rem;
    border-radius: 2rem;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border);
    color: var(--text-2);
    font-size: 0.82rem;
    font-weight: 600;
    transition: 0.25s;
}

.speed-phase i,
.ping-phase i {
    width: 14px;
    height: 14px;
}

.speed-phase.active,
.ping-phase.active {
    background: rgba(0, 209, 255, 0.12);
    border-color: var(--primary);
    color: var(--text-1);
    box-shadow: 0 0 18px rgba(0, 209, 255, 0.12);
}

.speed-phase.done,
.ping-phase.done {
    background: rgba(16, 185, 129, 0.12);
    border-color: var(--emerald);
    color: var(--emerald);
}

/* Gauge pulse */
.tool-gauge.is-pulse {
    animation: gaugePulse 1.5s ease-in-out infinite;
}

@keyframes gaugePulse {
    0%, 100% { box-shadow: 0 0 0 rgba(0, 209, 255, 0); }
    50% { box-shadow: 0 0 28px rgba(0, 209, 255, 0.22); }
}

/* Live chart */
.tool-live-chart {
    width: 100%;
    max-width: 420px;
    height: 70px;
    display: flex;
    align-items: flex-end;
    gap: 3px;
    margin-top: 1.25rem;
}

.tool-live-bar {
    flex: 1;
    background: linear-gradient(180deg, var(--primary), var(--violet));
    border-radius: 3px 3px 0 0;
    min-height: 2px;
    opacity: 0.9;
    transition: height 0.08s linear;
}

/* Server cards */
.tool-server-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.tool-server-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    padding: 0.85rem 0.75rem;
    border-radius: 0.75rem;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border);
    color: var(--text-1);
    cursor: pointer;
    transition: 0.2s;
    font-size: 0.9rem;
    font-weight: 600;
}

.tool-server-card span {
    font-size: 0.75rem;
    color: var(--text-2);
    font-weight: 500;
}

.tool-server-card:hover,
.tool-server-card.active {
    border-color: var(--primary);
    background: rgba(0, 209, 255, 0.08);
}

/* Actions */
.tool-actions {
    display: flex;
    justify-content: center;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-top: 1.5rem;
}

.tool-actions .tool-btn-v2 {
    min-width: 150px;
}

/* Result summary */
.speed-summary,
.ping-verdict {
    display: none;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border);
    border-radius: 0.8rem;
    padding: 1.25rem;
    margin-top: 1.5rem;
    text-align: center;
}

.speed-summary.show,
.ping-verdict.show {
    display: block;
}

.speed-summary h3,
.ping-verdict h3 {
    margin-bottom: 0.35rem;
    font-size: 1.15rem;
}

.speed-summary p,
.ping-verdict p {
    color: var(--text-2);
    font-size: 0.9rem;
    margin: 0;
}

/* Ping test specific */
.ping-log {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin: 1.25rem 0;
    max-height: 220px;
    overflow-y: auto;
    padding-right: 0.25rem;
}

.ping-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.85rem;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    padding: 0.6rem 0.9rem;
    animation: fadeIn 0.25s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: translateY(0); }
}

.ping-row .ping-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--primary);
    flex-shrink: 0;
}

.ping-row .ping-ms {
    margin-left: auto;
    font-weight: 700;
    font-family: var(--font-mono, monospace);
}

.ping-row.slow .ping-ms { color: var(--amber); }
.ping-row.bad .ping-ms { color: var(--rose); }
.ping-row.good .ping-ms { color: var(--emerald); }

.ping-spark {
    display: flex;
    align-items: flex-end;
    gap: 2px;
    height: 28px;
    margin-left: 0.75rem;
}

.ping-spark span {
    width: 4px;
    border-radius: 2px;
    background: var(--primary);
    min-height: 2px;
}

/* Spinning loader icon */
.spin {
    animation: spin 1s linear infinite;
}

@media (max-width: 600px) {
    .tool-live-chart { height: 55px; }
    .speed-phase, .ping-phase { font-size: 0.75rem; padding: 0.4rem 0.7rem; }
    .ping-spark { display: none; }
}
