/* ═══════════════════════════════════════════════════════════════════════════
   WINLEDGER LICENCIAS PORTAL — Dark Theme
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── Variables ────────────────────────────────────────────────────────────── */
:root {
    --bg: #0d1117;
    --surface: #161b22;
    --surface-2: #21262d;
    --surface-3: #2d333b;
    --border: #30363d;
    --border-2: #444c56;
    --accent: #0078D4;
    --accent-h: #005a9e;
    --accent-soft: rgba(0, 120, 212, 0.12);
    --text: #cdd9e5;
    --text-muted: #768390;
    --text-faint: #4d5566;
    --green: #2ea043;
    --green-soft: rgba(46, 160, 67, 0.15);
    --amber: #d29922;
    --amber-soft: rgba(210, 153, 34, 0.15);
    --red: #da3633;
    --red-soft: rgba(218, 54, 51, 0.15);
    --blue-soft: rgba(0, 120, 212, 0.15);
    --gray-soft: rgba(120, 131, 144, 0.15);
    --radius: 8px;
    --radius-lg: 12px;
    --sidebar-w: 220px;
    --topbar-h: 52px;
    --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
    --font-mono: 'Consolas', 'Cascadia Code', 'Fira Code', monospace;
}

/* ── Reset ────────────────────────────────────────────────────────────────── */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html, body {
    height: 100%;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font);
    font-size: 14px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

a {
    color: var(--accent);
    text-decoration: none;
}

    a:hover {
        text-decoration: underline;
    }

/* ═══════════════════════════════════════════════════════════════════════════
   LAYOUT SHELL
   ═══════════════════════════════════════════════════════════════════════════ */

.layout-shell {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/* ── Sidebar ──────────────────────────────────────────────────────────────── */
.sidebar {
    width: var(--sidebar-w);
    min-width: var(--sidebar-w);
    background: var(--surface);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    padding: 0;
    overflow-y: auto;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 18px 20px 16px;
    border-bottom: 1px solid var(--border);
    font-size: 16px;
    font-weight: 600;
    color: var(--text);
    letter-spacing: 0.2px;
}

.nav-links {
    padding: 12px 8px;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    border-radius: var(--radius);
    color: var(--text-muted);
    font-size: 13.5px;
    font-weight: 500;
    transition: background 0.15s, color 0.15s;
    text-decoration: none;
}

    .nav-link:hover {
        background: var(--surface-2);
        color: var(--text);
        text-decoration: none;
    }

    .nav-link.active {
        background: var(--accent-soft);
        color: var(--accent);
    }

.nav-icon {
    font-size: 16px;
    width: 18px;
    text-align: center;
    flex-shrink: 0;
}

.nav-footer {
    padding: 14px 20px;
    border-top: 1px solid var(--border);
}

.nav-version {
    font-size: 11px;
    color: var(--text-faint);
    letter-spacing: 0.4px;
}

/* ── Main Content ─────────────────────────────────────────────────────────── */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.topbar {
    height: var(--topbar-h);
    min-height: var(--topbar-h);
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
}

.topbar-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 14px;
}

.topbar-user {
    font-size: 13px;
    color: var(--text-muted);
}

.btn-logout {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-muted);
    border-radius: var(--radius);
    padding: 5px 12px;
    font-size: 12px;
    cursor: pointer;
    transition: border-color 0.15s, color 0.15s;
}

    .btn-logout:hover {
        border-color: var(--border-2);
        color: var(--text);
    }

.page-body {
    flex: 1;
    overflow-y: auto;
    padding: 28px 32px;
}

/* ═══════════════════════════════════════════════════════════════════════════
   PAGE HEADER
   ═══════════════════════════════════════════════════════════════════════════ */

.page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 24px;
    gap: 16px;
}

.page-title {
    font-size: 22px;
    font-weight: 600;
    color: var(--text);
    line-height: 1.3;
}

.page-subtitle {
    display: block;
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 3px;
}

/* ═══════════════════════════════════════════════════════════════════════════
   CARDS
   ═══════════════════════════════════════════════════════════════════════════ */

.section-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px 24px;
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.section-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
}

/* ═══════════════════════════════════════════════════════════════════════════
   DASHBOARD — STAT CARDS
   ═══════════════════════════════════════════════════════════════════════════ */

.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
}

@media (max-width: 1000px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
}

.stat-icon {
    width: 44px;
    height: 44px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
}

.stat-blue {
    background: var(--blue-soft);
    color: var(--accent);
}

.stat-green {
    background: var(--green-soft);
    color: var(--green);
}

.stat-amber {
    background: var(--amber-soft);
    color: var(--amber);
}

.stat-red {
    background: var(--red-soft);
    color: var(--red);
}

.stat-body {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.stat-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--text);
    line-height: 1;
}

.stat-label {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 4px;
}

/* ═══════════════════════════════════════════════════════════════════════════
   TABLE
   ═══════════════════════════════════════════════════════════════════════════ */

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13.5px;
}

    .data-table th {
        text-align: left;
        padding: 10px 14px;
        font-size: 11px;
        font-weight: 600;
        text-transform: uppercase;
        letter-spacing: 0.6px;
        color: var(--text-muted);
        border-bottom: 1px solid var(--border);
    }

    .data-table td {
        padding: 11px 14px;
        border-bottom: 1px solid var(--border);
        vertical-align: middle;
    }

    .data-table tbody tr:hover td {
        background: var(--surface-2);
    }

    .data-table tbody tr:last-child td {
        border-bottom: none;
    }

.row-revocada td {
    opacity: 0.55;
}

.table-info {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 12px;
    padding: 0 2px;
}

.actions-cell {
    display: flex;
    gap: 6px;
    align-items: center;
}

/* ═══════════════════════════════════════════════════════════════════════════
   FORMS
   ═══════════════════════════════════════════════════════════════════════════ */

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 16px;
}

.form-label {
    font-size: 12.5px;
    font-weight: 600;
    color: var(--text);
}

.form-input {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-family: var(--font);
    font-size: 13.5px;
    padding: 9px 12px;
    width: 100%;
    transition: border-color 0.15s, box-shadow 0.15s;
    outline: none;
    appearance: none;
    -webkit-appearance: none;
}

    .form-input:focus {
        border-color: var(--accent);
        box-shadow: 0 0 0 3px rgba(0, 120, 212, 0.15);
    }

    .form-input::placeholder {
        color: var(--text-faint);
    }

    .form-input[type="date"]::-webkit-calendar-picker-indicator {
        filter: invert(0.6);
        cursor: pointer;
    }

select.form-input {
    cursor: pointer;
}

textarea.form-input {
    resize: vertical;
    min-height: 70px;
}

.form-hint {
    font-size: 11.5px;
    color: var(--text-muted);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.validation-msg {
    font-size: 11.5px;
    color: var(--red);
    margin-top: 2px;
}

/* ═══════════════════════════════════════════════════════════════════════════
   BUTTONS
   ═══════════════════════════════════════════════════════════════════════════ */

.btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: var(--radius);
    padding: 9px 18px;
    font-size: 13.5px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.15s;
    white-space: nowrap;
    font-family: var(--font);
}

    .btn-primary:hover {
        background: var(--accent-h);
        text-decoration: none;
        color: #fff;
    }

    .btn-primary:disabled {
        opacity: 0.5;
        cursor: not-allowed;
    }

.btn-ghost {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    background: transparent;
    color: var(--text-muted);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 9px 18px;
    font-size: 13.5px;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
    font-family: var(--font);
}

    .btn-ghost:hover {
        background: var(--surface-2);
        color: var(--text);
        border-color: var(--border-2);
        text-decoration: none;
    }

.btn-danger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--red);
    color: #fff;
    border: none;
    border-radius: var(--radius);
    padding: 9px 18px;
    font-size: 13.5px;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.15s;
    font-family: var(--font);
}

    .btn-danger:hover {
        opacity: 0.85;
    }

.btn-icon {
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-muted);
    width: 30px;
    height: 30px;
    font-size: 14px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background 0.12s, color 0.12s;
    text-decoration: none;
}

    .btn-icon:hover {
        background: var(--surface-2);
        color: var(--text);
        border-color: var(--border-2);
        text-decoration: none;
    }

.btn-danger-icon:hover {
    background: var(--red-soft);
    color: var(--red);
    border-color: var(--red);
}

.btn-copy {
    background: var(--surface-3);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-muted);
    padding: 5px 12px;
    font-size: 12px;
    cursor: pointer;
    white-space: nowrap;
    flex-shrink: 0;
    transition: background 0.12s, color 0.12s;
    font-family: var(--font);
}

    .btn-copy:hover {
        background: var(--border);
        color: var(--text);
    }

.btn-chip {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 20px;
    color: var(--text-muted);
    padding: 3px 10px;
    font-size: 12px;
    cursor: pointer;
    transition: background 0.12s, color 0.12s;
    font-family: var(--font);
}

    .btn-chip:hover {
        background: var(--accent-soft);
        color: var(--accent);
        border-color: var(--accent);
    }

.w-full {
    width: 100%;
}

/* ═══════════════════════════════════════════════════════════════════════════
   BADGES
   ═══════════════════════════════════════════════════════════════════════════ */

.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    border-radius: 20px;
    font-size: 11.5px;
    font-weight: 600;
    white-space: nowrap;
}

.badge-green {
    background: var(--green-soft);
    color: #3fb950;
}

.badge-amber {
    background: var(--amber-soft);
    color: #e3b341;
}

.badge-red {
    background: var(--red-soft);
    color: #f85149;
}

.badge-blue {
    background: var(--blue-soft);
    color: #79c0ff;
}

.badge-gray {
    background: var(--gray-soft);
    color: var(--text-muted);
}

/* ═══════════════════════════════════════════════════════════════════════════
   MODALS
   ═══════════════════════════════════════════════════════════════════════════ */

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(1, 4, 9, 0.75);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(2px);
    padding: 20px;
}

.modal-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 28px;
    width: 100%;
    max-width: 520px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.5);
}

.modal-sm {
    max-width: 380px;
}

.modal-title {
    font-size: 17px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 18px;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 20px;
}

/* ═══════════════════════════════════════════════════════════════════════════
   ALERTS
   ═══════════════════════════════════════════════════════════════════════════ */

.alert-error {
    background: var(--red-soft);
    border: 1px solid rgba(218, 54, 51, 0.3);
    border-radius: var(--radius);
    color: #f85149;
    padding: 10px 14px;
    font-size: 13px;
    margin-bottom: 12px;
    display: flex;
    gap: 8px;
    align-items: flex-start;
}

/* ═══════════════════════════════════════════════════════════════════════════
   GENERAR LICENCIA — Layout especial
   ═══════════════════════════════════════════════════════════════════════════ */

.gen-layout {
    display: grid;
    grid-template-columns: 1fr 420px;
    gap: 24px;
    align-items: start;
}

@media (max-width: 1100px) {
    .gen-layout {
        grid-template-columns: 1fr;
    }
}

.gen-form-panel {
}

.gen-result-panel {
    position: sticky;
    top: 0;
}

.result-placeholder {
    background: var(--surface);
    border: 1px dashed var(--border-2);
    border-radius: var(--radius-lg);
    padding: 48px 24px;
    text-align: center;
    color: var(--text-muted);
}

.result-placeholder-icon {
    font-size: 40px;
    margin-bottom: 12px;
    opacity: 0.4;
}

.result-card {
}

.result-header {
    margin-bottom: 16px;
}

.result-detail {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 20px;
}

.detail-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 7px 0;
    border-bottom: 1px solid var(--border);
    font-size: 13px;
    gap: 12px;
}

    .detail-row:last-child {
        border-bottom: none;
    }

.detail-label {
    font-size: 11.5px;
    color: var(--text-muted);
    flex-shrink: 0;
}

.key-display-label {
    font-size: 11.5px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.key-display {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px 14px;
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

    .key-display code {
        font-family: var(--font-mono);
        font-size: 11px;
        color: #79c0ff;
        word-break: break-all;
        line-height: 1.7;
        flex: 1;
    }

.quick-dates {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    margin-top: -8px;
}

.modules-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.module-check {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 13px;
    color: var(--text);
    cursor: pointer;
    padding: 7px 10px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    transition: border-color 0.12s;
}

    .module-check:hover {
        border-color: var(--accent);
    }

    .module-check input[type="checkbox"] {
        width: 15px;
        height: 15px;
        accent-color: var(--accent);
        cursor: pointer;
    }

/* ═══════════════════════════════════════════════════════════════════════════
   FILTERS BAR
   ═══════════════════════════════════════════════════════════════════════════ */

.filters-bar {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
    margin-bottom: 4px;
}

.search-bar {
    margin-bottom: 16px;
}

/* ═══════════════════════════════════════════════════════════════════════════
   HARDWARE ID
   ═══════════════════════════════════════════════════════════════════════════ */

.hw-id {
    font-family: var(--font-mono);
    font-size: 12px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 2px 7px;
    color: #79c0ff;
    letter-spacing: 1.2px;
}

/* ═══════════════════════════════════════════════════════════════════════════
   MISC
   ═══════════════════════════════════════════════════════════════════════════ */

.text-muted {
    color: var(--text-muted);
}

.text-amber {
    color: var(--amber);
}

.empty-state {
    text-align: center;
    color: var(--text-muted);
    padding: 40px 20px;
    font-size: 13.5px;
}

.loading-spinner {
    text-align: center;
    color: var(--text-muted);
    padding: 32px;
    font-size: 13.5px;
}

.not-found {
    text-align: center;
    padding: 80px 20px;
    color: var(--text-muted);
}

/* ═══════════════════════════════════════════════════════════════════════════
   LOGIN PAGE
   ═══════════════════════════════════════════════════════════════════════════ */

.login-shell {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg);
    padding: 20px;
}

.login-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 42px 40px;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.45);
}

.login-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 6px;
}

.login-brand-name {
    font-size: 22px;
    font-weight: 700;
    color: var(--text);
}

.login-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 4px;
    margin-top: 16px;
}

.login-subtitle {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 24px;
}

/* ═══════════════════════════════════════════════════════════════════════════
   SCROLLBAR
   ═══════════════════════════════════════════════════════════════════════════ */

::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--border-2);
    border-radius: 3px;
}

    ::-webkit-scrollbar-thumb:hover {
        background: var(--text-faint);
    }

/* ═══════════════════════════════════════════════════════════════════════════
   CONTRATO INFO BADGE (GenerarLicencia)
   ═══════════════════════════════════════════════════════════════════════════ */
.contrato-info {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    border-radius: var(--radius);
    font-size: 13px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.contrato-ok {
    background: var(--green-soft);
    border: 1px solid rgba(46, 160, 67, 0.3);
    color: #3fb950;
}

.contrato-agotado {
    background: var(--red-soft);
    border: 1px solid rgba(218, 54, 51, 0.3);
    color: #f85149;
}

/* ═══════════════════════════════════════════════════════════════════════════
   BARRA DE PROGRESO DE LICENCIAS (Contratos.razor)
   ═══════════════════════════════════════════════════════════════════════════ */

.license-bar {
    width: 80px;
    height: 6px;
    background: var(--surface-3);
    border-radius: 3px;
    overflow: hidden;
    flex-shrink: 0;
}

.license-bar-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.3s ease;
}

.bar-green {
    background: var(--green);
}

.bar-amber {
    background: var(--amber);
}

.bar-red {
    background: var(--red);
}

.text-red {
    color: var(--red);
}
