﻿/* ============================================================
   Cloudy — UI Kit (componentes compartidos)
   Cargado por _AdminLayout.cshtml Y _Layout.cshtml
   ============================================================ */

/* ══════════════════════════════════════════════════════════
   ENCABEZADO DE PÁGINA
   ══════════════════════════════════════════════════════════ */
.cl-page-head,
.sc-page-head {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    padding-bottom: 1rem;
    margin-bottom: 1.1rem;
    border-bottom: 1px solid var(--cl-border, #e2e8f0);
}

    .cl-page-head-title,
    .sc-page-head > div:first-child {
        display: flex;
        align-items: flex-start;
        gap: 0.75rem;
        min-width: 0;
    }

        .cl-page-head-title > i,
        .sc-page-head h1 i {
            font-size: 1.5rem;
            color: var(--cl-brand-500, #0d6efd);
            margin-top: 2px;
            flex-shrink: 0;
            line-height: 1;
        }

        .cl-page-head-title h1,
        .sc-page-head h1 {
            font-size: 1.2rem;
            font-weight: 700;
            margin: 0;
            color: var(--cl-text, #0f172a);
            line-height: 1.2;
            letter-spacing: -0.01em;
            display: flex;
            align-items: center;
            gap: 0.6rem;
        }

        .cl-page-head-title p,
        .sc-page-head p {
            font-size: 0.8rem;
            color: var(--cl-text-muted, #64748b);
            margin: 0.15rem 0 0 0;
            line-height: 1.35;
        }

    .cl-page-head-actions,
    .sc-page-head .actions {
        display: flex;
        flex-wrap: wrap;
        gap: 0.5rem;
        align-items: center;
    }

@media (min-width: 768px) {
    .cl-page-head,
    .sc-page-head {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        padding-bottom: 1rem;
        margin-bottom: 1.25rem;
    }

        .cl-page-head-title h1,
        .sc-page-head h1 {
            font-size: 1.35rem;
        }

            .cl-page-head-title > i,
            .sc-page-head h1 i {
                font-size: 1.6rem;
            }

        .cl-page-head-actions,
        .sc-page-head .actions {
            flex-shrink: 0;
        }
}

@media (max-width: 575.98px) {
    .cl-page-head-actions .btn span,
    .sc-page-head .actions .btn span {
        display: none;
    }

    .cl-page-head-actions .btn,
    .sc-page-head .actions .btn {
        padding: 0.5rem 0.75rem;
    }
}

/* ══════════════════════════════════════════════════════════
   CARD
   ══════════════════════════════════════════════════════════ */
.sc-card {
    background: #fff;
    border: 1px solid var(--cl-border, #e2e8f0);
    border-radius: var(--cl-radius-lg, 1rem);
    overflow: hidden;
}

.sc-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.9rem 1.1rem;
    border-bottom: 1px solid var(--cl-border-2, #f1f5f9);
    flex-wrap: wrap;
    gap: 0.5rem;
}

    .sc-card-header h6 {
        margin: 0;
        font-weight: 600;
        font-size: 0.95rem;
        color: var(--cl-text, #0f172a);
        display: flex;
        align-items: center;
        gap: 0.5rem;
    }

.sc-count {
    background: var(--cl-surface-2, #f8fafc);
    color: var(--cl-text-muted, #64748b);
    border: 1px solid var(--cl-border-2, #f1f5f9);
    font-weight: 600;
    font-size: 0.72rem;
    padding: 0.32rem 0.7rem;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    white-space: nowrap;
}

/* ══════════════════════════════════════════════════════════
   TABLA
   ══════════════════════════════════════════════════════════ */
.sc-table {
    width: 100%;
    margin: 0;
    border-collapse: collapse;
    background: #fff;
}

    .sc-table thead th {
        background: #fafbfc;
        border-bottom: 1px solid var(--cl-border, #e2e8f0);
        font-weight: 700;
        font-size: 0.72rem;
        text-transform: uppercase;
        letter-spacing: 0.05em;
        color: #475569;
        padding: 0.75rem 1rem;
        text-align: left;
        white-space: nowrap;
        vertical-align: middle;
    }

    .sc-table tbody td {
        padding: 0.85rem 1rem;
        border-bottom: 1px solid var(--cl-border-2, #f1f5f9);
        vertical-align: middle;
        font-size: 0.9rem;
        color: var(--cl-text, #0f172a);
        background: #fff;
    }

    .sc-table tbody tr:last-child td {
        border-bottom: none;
    }

    .sc-table tbody tr:hover td {
        background: #fafbfc;
    }

/* Celda primaria */
.cl-cell-primary {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

    .cl-cell-primary strong {
        font-weight: 600;
        font-size: 0.9rem;
        color: var(--cl-text, #0f172a);
    }

    .cl-cell-primary small {
        font-size: 0.75rem;
        color: var(--cl-text-muted, #64748b);
        word-break: break-all;
    }

/* ══════════════════════════════════════════════════════════
   BADGES
   ══════════════════════════════════════════════════════════ */
.sc-tech {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.3rem 0.65rem;
    font-size: 0.72rem;
    font-weight: 600;
    border-radius: 6px;
    background: #eef2ff;
    color: #3730a3;
    border: 1px solid #e0e7ff;
    white-space: nowrap;
    line-height: 1.1;
}

.sc-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.35rem 0.7rem;
    font-size: 0.72rem;
    font-weight: 600;
    border-radius: 999px;
    white-space: nowrap;
    line-height: 1.1;
}

.sc-badge-active {
    background: rgba(25,135,84,0.10);
    color: #166534;
}

.sc-badge-inactive {
    background: rgba(108,117,125,0.10);
    color: #475569;
}

/* ══════════════════════════════════════════════════════════
   ACCIONES EN TABLA
   ══════════════════════════════════════════════════════════ */
.sc-actions {
    white-space: nowrap;
    text-align: right;
}

    .sc-actions .btn {
        width: 32px;
        height: 32px;
        padding: 0;
        margin-left: 0.15rem;
        border-radius: 6px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        border: 1px solid;
        background: transparent;
        transition: background 0.12s ease, color 0.12s ease, border-color 0.12s ease;
        vertical-align: middle;
    }

        .sc-actions .btn i {
            font-size: 0.9rem;
        }

    .sc-actions .btn-edit {
        border-color: #0d6efd;
        color: #0d6efd;
    }

        .sc-actions .btn-edit:hover {
            background: #eff6ff;
        }

    .sc-actions .btn-toggle {
        border-color: #f59e0b;
        color: #b45309;
    }

        .sc-actions .btn-toggle:hover {
            background: #fffbeb;
        }

    .sc-actions .btn-del {
        border-color: #fecaca;
        color: #dc3545;
    }

        .sc-actions .btn-del:hover {
            background: #fef2f2;
            border-color: #dc3545;
        }

/* ══════════════════════════════════════════════════════════
   BOTONES BASE
   ══════════════════════════════════════════════════════════ */
.sc-btn-primary {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 1rem;
    background: var(--cl-brand-500, #0d6efd);
    color: #fff;
    border: 1px solid var(--cl-brand-500, #0d6efd);
    border-radius: 6px;
    font-weight: 600;
    font-size: 0.85rem;
    min-height: 38px;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.12s ease;
}

    .sc-btn-primary:hover {
        background: var(--cl-brand-600, #0a58ca);
        border-color: var(--cl-brand-600, #0a58ca);
        color: #fff;
    }

.sc-btn-outline {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 0.9rem;
    background: #fff;
    color: var(--cl-text, #0f172a);
    border: 1px solid var(--cl-border, #e2e8f0);
    border-radius: 6px;
    font-weight: 500;
    font-size: 0.85rem;
    min-height: 38px;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.12s ease;
}

    .sc-btn-outline:hover {
        background: var(--cl-surface-2, #f8fafc);
        border-color: #cbd5e1;
        color: var(--cl-text, #0f172a);
    }

/* ══════════════════════════════════════════════════════════
   FILTROS
   ══════════════════════════════════════════════════════════ */
.sc-filters {
    padding: 0.9rem 1.1rem;
    background: #fff;
    border: 1px solid var(--cl-border, #e2e8f0);
    border-radius: var(--cl-radius-lg, 1rem);
    margin-bottom: 1rem;
}

    .sc-filters .form-label {
        font-size: 0.72rem;
        font-weight: 700;
        text-transform: uppercase;
        letter-spacing: 0.04em;
        color: var(--cl-text-muted, #64748b);
        margin-bottom: 0.3rem;
        display: block;
    }

    .sc-filters .form-control,
    .sc-filters .form-select {
        width: 100%;
        max-width: 100%;
        min-height: 38px;
        font-size: 0.875rem;
        border-radius: var(--cl-radius-sm, 0.5rem);
        border: 1px solid var(--cl-border, #e2e8f0);
        box-sizing: border-box;
    }

        .sc-filters .form-control:focus,
        .sc-filters .form-select:focus {
            outline: none;
            border-color: var(--cl-brand-500, #0d6efd);
            box-shadow: 0 0 0 3px rgba(13,110,253,.12);
        }

.sc-search {
    position: relative;
    display: block;
    width: 100%;
}

    .sc-search > i {
        position: absolute;
        left: 0.75rem;
        top: 50%;
        transform: translateY(-50%);
        color: var(--cl-text-subtle, #94a3b8);
        font-size: 0.95rem;
        pointer-events: none;
        line-height: 1;
        z-index: 1;
    }

    .sc-search .form-control {
        padding-left: 2.25rem !important;
    }

/* ══════════════════════════════════════════════════════════
   ESTADOS
   ══════════════════════════════════════════════════════════ */
.sc-empty {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--cl-text-muted, #64748b);
}

    .sc-empty i {
        font-size: 2.5rem;
        opacity: 0.35;
        display: block;
        margin-bottom: 0.75rem;
    }

    .sc-empty p {
        margin: 0 0 0.75rem 0;
        font-size: 0.9rem;
    }

.cl-loading {
    text-align: center;
    padding: 2.5rem 1rem;
    color: var(--cl-text-muted, #64748b);
}

/* ══════════════════════════════════════════════════════════
   MODAL (SweetAlert sc-modal)
   ══════════════════════════════════════════════════════════ */
.swal2-popup.sc-modal {
    width: 620px !important;
    max-width: calc(100vw - 32px) !important;
    max-height: calc(100vh - 32px) !important;
    border-radius: var(--cl-radius-lg, 1rem) !important;
    padding: 1.25rem !important;
    font-family: var(--cl-font, 'Inter', system-ui, sans-serif);
    display: flex !important;
    flex-direction: column !important;
    overflow: hidden !important;
    box-sizing: border-box;
}

@media (max-width: 767.98px) {
    .swal2-popup.sc-modal {
        width: 94vw !important;
        max-width: 94vw !important;
        max-height: calc(100vh - 24px) !important;
        padding: 1rem !important;
    }
}

.swal2-popup.sc-modal .swal2-title {
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--cl-text, #0f172a);
    padding: 0 0 0.5rem 0;
    text-align: left;
    flex-shrink: 0;
    margin: 0;
    line-height: 1.25;
}

.swal2-popup.sc-modal .swal2-html-container {
    margin: 0 !important;
    padding: 0 !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    max-height: calc(100vh - 220px);
    max-width: 100% !important;
    text-align: left;
    box-sizing: border-box;
    flex: 1 1 auto;
    min-height: 0;
}

.swal2-popup.sc-modal.sc-modal-lg {
    width: 900px !important;
    max-width: calc(100vw - 32px) !important;
}

/* Form dentro del modal */
.sc-form {
    text-align: left;
    width: 100%;
    box-sizing: border-box;
}

    .sc-form * {
        box-sizing: border-box;
    }

    .sc-form .row {
        display: flex;
        flex-wrap: wrap;
        margin-left: -0.375rem;
        margin-right: -0.375rem;
    }

        .sc-form .row > [class*="col-"] {
            padding-left: 0.375rem;
            padding-right: 0.375rem;
            margin-bottom: 0.75rem;
            min-width: 0;
            box-sizing: border-box;
        }

    .sc-form .col-12 {
        width: 100%;
    }

    .sc-form .col-md-6 {
        width: 100%;
    }

    .sc-form .col-md-4 {
        width: 100%;
    }

    .sc-form .col-md-8 {
        width: 100%;
    }

    .sc-form .col-md-3 {
        width: 100%;
    }

    .sc-form .col-6 {
        width: 50%;
    }

@media (min-width: 768px) {
    .sc-form .col-md-6 {
        width: 50%;
    }

    .sc-form .col-md-4 {
        width: 33.3333%;
    }

    .sc-form .col-md-8 {
        width: 66.6667%;
    }

    .sc-form .col-md-3 {
        width: 25%;
    }
}

.sc-form .form-label {
    display: block;
    font-size: 0.78rem;
    font-weight: 600;
    color: #334155;
    margin-bottom: 0.25rem;
    line-height: 1.2;
}

.sc-form .form-control,
.sc-form .form-select {
    display: block;
    width: 100%;
    max-width: 100%;
    min-height: 38px;
    font-size: 0.875rem;
    border-radius: var(--cl-radius-sm, 0.5rem);
    border: 1px solid var(--cl-border, #e2e8f0);
    background: #fff;
    padding: 0.4rem 0.7rem;
    box-sizing: border-box;
    color: var(--cl-text, #0f172a);
    font-family: inherit;
}

    .sc-form .form-control:focus,
    .sc-form .form-select:focus {
        outline: none;
        border-color: var(--cl-brand-500, #0d6efd);
        box-shadow: 0 0 0 3px rgba(13,110,253,.12);
    }

.sc-form textarea.form-control {
    min-height: 70px;
    resize: vertical;
}

.sc-form .form-check {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.sc-form .form-check-input {
    width: 34px;
    height: 18px;
    margin: 0;
    flex-shrink: 0;
}

.sc-form .form-check-label {
    font-size: 0.85rem;
    color: var(--cl-text, #0f172a);
}

.swal2-popup.sc-modal .swal2-actions {
    display: flex !important;
    gap: 0.5rem !important;
    margin-top: 1rem !important;
    flex-direction: column-reverse !important;
    width: 100% !important;
    justify-content: flex-end !important;
    flex-shrink: 0;
    padding-top: 0.75rem;
    border-top: 1px solid var(--cl-border-2, #f1f5f9);
    box-sizing: border-box;
}

    .swal2-popup.sc-modal .swal2-actions .btn {
        min-height: 40px !important;
        border-radius: 6px !important;
        padding: 0.45rem 1.1rem !important;
        font-weight: 600 !important;
        font-size: 0.85rem !important;
        width: 100% !important;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: 0.4rem;
    }

    .swal2-popup.sc-modal .swal2-actions .btn-primary {
        background: var(--cl-brand-500, #0d6efd) !important;
        border: 1px solid var(--cl-brand-500, #0d6efd) !important;
        color: #fff !important;
    }

    .swal2-popup.sc-modal .swal2-actions .btn-danger {
        background: var(--cl-danger, #dc3545) !important;
        border: 1px solid var(--cl-danger, #dc3545) !important;
        color: #fff !important;
    }

    .swal2-popup.sc-modal .swal2-actions .btn-outline-secondary {
        background: transparent !important;
        border: 1px solid var(--cl-border, #e2e8f0) !important;
        color: var(--cl-text, #0f172a) !important;
    }

@media (min-width: 768px) {
    .swal2-popup.sc-modal .swal2-actions {
        flex-direction: row !important;
    }

        .swal2-popup.sc-modal .swal2-actions .btn {
            width: auto !important;
        }
}
