/* ===========================
   Layout general
   =========================== */
* {
    box-sizing: border-box;
}

body {
    margin: 0;
    padding: 0;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: #020617;
    color: #e5e7eb;
}

/* Fondo suave */
.cw-background {
    position: fixed;
    inset: 0;
    background:
        radial-gradient(circle at top left, rgba(56, 189, 248, 0.18), transparent 55%),
        radial-gradient(circle at bottom right, rgba(34, 197, 94, 0.16), transparent 55%);
    z-index: -1;
}

/* Header */
.cw-header {
    position: sticky;
    top: 0;
    z-index: 10;
    backdrop-filter: blur(14px);
    background: linear-gradient(to right, rgba(15,23,42,0.95), rgba(15,23,42,0.85));
    border-bottom: 1px solid rgba(148,163,184,0.25);
    padding: 10px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.cw-logo {
    font-weight: 700;
    letter-spacing: 0.04em;
    font-size: 18px;
    color: #e5e7eb;
}
.cw-logo span {
    color: #38bdf8;
}

.cw-nav a {
    margin-left: 18px;
    text-decoration: none;
    color: #cbd5f5;
    font-size: 14px;
    padding: 6px 10px;
    border-radius: 999px;
    border: 1px solid transparent;
}
.cw-nav a:hover {
    border-color: rgba(148,163,184,0.6);
    background: rgba(15,23,42,0.9);
}

.cw-nav {
    display: flex;
    align-items: center;
    gap: 6px;
}

.cw-nav-dropdown {
    position: relative;
    display: inline-block;
}

.cw-nav-parent {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.cw-nav-parent::after {
    content: "▾";
    font-size: 11px;
    opacity: 0.8;
}

.cw-nav-menu {
    position: absolute;
    top: 36px;
    left: 0;
    background: rgba(15,23,42,0.96);
    border: 1px solid rgba(148,163,184,0.25);
    border-radius: 12px;
    min-width: 180px;
    box-shadow: 0 16px 30px rgba(0,0,0,0.28);
    display: none;
    padding: 8px;
    z-index: 20;
}

.cw-nav-menu a {
    display: block;
    margin: 0;
    padding: 8px 10px;
    border-radius: 8px;
    font-size: 13px;
}

.cw-nav-dropdown:hover .cw-nav-menu {
    display: block;
}

.cw-nav-dropdown.open .cw-nav-menu {
    display: block;
}

@media (max-width: 768px) {
    .cw-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .cw-nav {
        width: 100%;
        flex-wrap: wrap;
        justify-content: flex-start;
    }

    .cw-nav a {
        margin-left: 0;
        margin-right: 10px;
        padding: 10px 12px;
    }

    .cw-nav-dropdown {
        position: static;
    }

    .cw-nav-menu {
        position: static;
        margin-top: 6px;
        width: 100%;
    }
}

/* Main + footer */
.cw-main {
    max-width: 1180px;
    margin: 24px auto 40px auto;
    padding: 0 16px 32px 16px;
}

.cw-footer {
    text-align: center;
    padding: 12px 0 20px 0;
    font-size: 12px;
    opacity: 0.7;
}

/* ===========================
   Títulos y secciones
   =========================== */
.cw-title {
    font-size: 26px;
    font-weight: 700;
    margin-bottom: 6px;
}

.cw-subtitle {
    opacity: 0.7;
    margin-bottom: 20px;
    font-size: 14px;
}

.cw-subtitle.small {
    font-size: 13px;
}

.section-title {
    margin-top: 32px;
    margin-bottom: 12px;
    font-size: 20px;
    font-weight: 600;
}

.cw-separator {
    margin: 20px 0;
    border: 0;
    border-top: 1px dashed rgba(148,163,184,0.35);
}

/* ===========================
   Grid de tarjetas
   =========================== */
.cw-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 18px;
    margin-bottom: 20px;
}

.cw-card {
    background: rgba(15,23,42,0.95);
    padding: 16px 16px 14px 16px;
    border-radius: 14px;
    text-decoration: none;
    color: #e5e7eb;
    box-shadow: 0 12px 25px rgba(15,23,42,0.75);
    transition: 0.2s transform, 0.2s box-shadow, 0.2s background;
    border: 1px solid rgba(30,64,175,0.25);
}
.cw-card h2 {
    font-size: 15px;
    margin: 0 0 8px 0;
}
.cw-card p {
    margin: 0;
    font-size: 13px;
    opacity: 0.8;
}
.cw-card:hover {
    background: rgba(15,23,42,0.9);
    transform: translateY(-3px);
    box-shadow: 0 18px 35px rgba(15,23,42,0.9);
}

.cw-tag {
    display: inline-block;
    margin-top: 10px;
    color: #38bdf8;
    font-size: 12px;
}

/* ===========================
   Estado API keys
   =========================== */
.status-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px,1fr));
    gap: 12px;
    margin-bottom: 20px;
}

.status-item {
    padding: 12px;
    border-radius: 10px;
    text-align: center;
    background: rgba(15,23,42,0.92);
    border: 1px solid rgba(51,65,85,0.8);
    font-size: 13px;
}
.status-item.ok {
    border-left: 4px solid #22c55e;
}
.status-item.fail {
    border-left: 4px solid #ef4444;
}

.status-name {
    display: block;
    margin-bottom: 4px;
    letter-spacing: 0.06em;
    font-size: 12px;
    opacity: 0.8;
}
.status-state {
    font-weight: 600;
}

/* ===========================
   Frecuencias / settings
   =========================== */
.freq-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 14px;
    margin-bottom: 24px;
}

.freq-item {
    background: rgba(15,23,42,0.95);
    border-radius: 12px;
    padding: 12px 14px;
    border: 1px solid rgba(30,64,175,0.45);
    font-size: 13px;
}
.freq-item h3 {
    margin: 0 0 8px 0;
    font-size: 13px;
    letter-spacing: 0.06em;
    opacity: 0.9;
}
.freq-info {
    margin: 2px 0;
    font-size: 12px;
}

.settings-form {
    max-width: 450px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 20px;
}

.settings-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(15,23,42,0.96);
    padding: 8px 10px;
    border-radius: 8px;
    border: 1px solid rgba(31,41,55,0.9);
    font-size: 13px;
}
.settings-row label {
    margin-right: 10px;
}
.settings-row input[type="number"] {
    width: 90px;
    background: #020617;
    border-radius: 6px;
    border: 1px solid rgba(148,163,184,0.6);
    color: #e5e7eb;
    padding: 4px 6px;
    font-size: 13px;
}

/* Botón genérico */
.cw-btn {
    background: #22c55e;
    color: white;
    padding: 9px 16px;
    border-radius: 999px;
    border: none;
    cursor: pointer;
    font-weight: 600;
    font-size: 13px;
    box-shadow: 0 8px 18px rgba(22,163,74,0.5);
}
.cw-btn:hover {
    background: #16a34a;
}

/* Botones fetch */
.fetch-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 6px;
    margin-bottom: 20px;
}

/* ===========================
   Tabla genérica
   =========================== */
.cw-table {
    width: 100%;
    border-collapse: collapse;
    background: rgba(15,23,42,0.96);
    border-radius: 12px;
    overflow: hidden;
    font-size: 13px;
}
.cw-table thead {
    background: rgba(30,64,175,0.35);
}
.cw-table th,
.cw-table td {
    padding: 8px 10px;
    border-bottom: 1px solid rgba(30,64,175,0.3);
}
.cw-table tbody tr:nth-child(even) {
    background: rgba(15,23,42,0.93);
}

/* ===========================
   Fear & Greed Widget
   =========================== */
.fng-widget {
    margin-top: 12px;
    margin-bottom: 24px;
}

.fng-box {
    padding: 18px 18px 14px 18px;
    border-radius: 16px;
    background: radial-gradient(circle at top left, rgba(34,197,94,0.25), rgba(15,23,42,0.98));
    border: 1px solid rgba(34,197,94,0.5);
    width: 280px;
    color: #bbf7d0;
    backdrop-filter: blur(8px);
    box-shadow: 0 0 25px rgba(34,197,94,0.3);
    font-size: 13px;
}
.fng-box p {
    margin: 4px 0;
}

/* LED circular */
.led {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    margin-bottom: 10px;
    animation: blink 1.3s infinite ease-in-out;
}
.led-red {
    background: #ef4444;
    box-shadow: 0 0 10px #ef4444;
}
.led-yellow {
    background: #facc15;
    box-shadow: 0 0 10px #facc15;
}
.led-green {
    background: #22c55e;
    box-shadow: 0 0 10px #22c55e;
}

@keyframes blink {
    0%   { opacity: .4; transform: scale(0.85); }
    50%  { opacity: 1;   transform: scale(1.05); }
    100% { opacity: .4;  transform: scale(0.85); }
}

/* ===========================
   Kraken widget (mini-charts)
   =========================== */
.kraken-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 14px;
    margin-top: 12px;
}

.kraken-card {
    background: rgba(15,23,42,0.96);
    border-radius: 14px;
    padding: 10px 12px 10px 12px;
    border: 1px solid rgba(51,65,85,0.85);
    box-shadow: 0 10px 24px rgba(15,23,42,0.85);
    display: flex;
    flex-direction: column;
    min-height: 140px;
}
.kraken-card h3 {
    margin: 0 0 6px 0;
    font-size: 13px;
    letter-spacing: 0.05em;
    opacity: 0.9;
}
.kraken-card canvas {
    flex: 1;
}

/* Mensajes pequeños / error */
.small-note {
    font-size: 12px;
    opacity: 0.75;
}

.error-text {
    color: #f97373;
    font-size: 12px;
    margin-top: 6px;
}

/* Responsive tweaks */
@media (max-width: 640px) {
    .cw-main {
        padding: 0 10px 24px 10px;
    }
    .freq-grid {
        grid-template-columns: 1fr;
    }
    .kraken-card {
        min-height: 120px;
    }
}
