/* ============================================================
   Classroom Connect — Superadmin Panel Styles
   Requiere: common.css cargado previamente
   ============================================================ */

/* ============================================================
   WRAPPER PRINCIPAL
   ============================================================ */

.cm-sa-wrapper {
    font-family: 'DM Sans', system-ui, sans-serif;
    color: #1c1410;
    min-height: 100vh;
    background: #f5f0eb;
}

.cm-sa-wrapper *,
.cm-sa-wrapper input,
.cm-sa-wrapper button,
.cm-sa-wrapper textarea,
.cm-sa-wrapper select,
.cm-sa-wrapper table,
.cm-sa-wrapper th,
.cm-sa-wrapper td,
.cm-sa-wrapper label,
.cm-sa-wrapper a,
.cm-sa-wrapper p,
.cm-sa-wrapper h2,
.cm-sa-wrapper h3,
.cm-sa-wrapper small,
.cm-sa-wrapper span,
.cm-sa-wrapper div,
.cm-sa-wrapper form {
    box-sizing: border-box;
    font-family: 'DM Sans', system-ui, sans-serif;
}

/* ============================================================
   TOPBAR CON NAV INTEGRADA
   ============================================================ */

.cm-sa-topbar-ag {
    display: flex;
    align-items: center;
    background: #1c1410;
    padding: 0 20px;
    height: 48px;
    gap: 8px;
    position: sticky;
    top: 0;
    z-index: 100;
    flex-shrink: 0;
}

.cm-sa-logo {
    font-family: 'DM Serif Display', Georgia, serif;
    font-size: 16px;
    color: #ffffff;
    white-space: nowrap;
    margin-right: 4px;
}

.cm-sa-role {
    font-size: 10px;
    font-weight: 500;
    color: #d4712a;
    background: rgba(212, 113, 42, 0.15);
    padding: 2px 7px;
    border-radius: 20px;
    text-transform: uppercase;
    white-space: nowrap;
    margin-right: 4px;
}

.cm-sa-nav {
    display: flex;
    align-items: center;
    gap: 2px;
    flex: 1;
}

.cm-sa-nav a {
    font-size: 12.5px;
    font-weight: 500;
    color: #a0907e;
    text-decoration: none;
    padding: 5px 10px;
    border-radius: 6px;
    transition: background 0.15s, color 0.15s;
    white-space: nowrap;
}

.cm-sa-nav a:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.08);
    text-decoration: none;
}

.cm-sa-nav a.active {
    color: #d4712a;
    background: rgba(212, 113, 42, 0.12);
}

.cm-sa-right {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-left: auto;
}

.cm-sa-user {
    font-size: 12px;
    color: #f5c842;
    white-space: nowrap;
}

.cm-sa-logout {
    font-size: 11.5px;
    font-weight: 500;
    color: #e8e0d8;
    text-decoration: none;
    padding: 4px 10px;
    border: 1px solid rgba(232, 224, 216, 0.2);
    border-radius: 5px;
    white-space: nowrap;
    transition: background 0.15s;
}

.cm-sa-logout:hover {
    background: rgba(232, 224, 216, 0.1);
    color: #ffffff;
    text-decoration: none;
}

/* ============================================================
   CONTENT
   ============================================================ */

.cm-sa-content {
    max-width: 1100px;
    margin: 0 auto;
    padding: 32px 24px 60px;
}

/* ============================================================
   SECTION HEADER
   ============================================================ */

.cm-sa-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    gap: 16px;
}

.cm-sa-section-title {
    font-family: 'DM Serif Display', Georgia, serif;
    font-size: 24px;
    font-weight: 400;
    color: #1c1410;
    letter-spacing: -0.02em;
    margin: 0;
    padding: 0;
}

.cm-sa-badge {
    font-size: 12px;
    font-weight: 500;
    color: #a0907e;
    background: #ffffff;
    border: 1px solid #e8e0d8;
    padding: 4px 10px;
    border-radius: 20px;
    margin-left: auto;
}

.cm-sa-back {
    font-size: 13.5px;
    font-weight: 500;
    color: #a0907e;
    text-decoration: none;
    transition: color 0.2s;
}

.cm-sa-back:hover {
    color: #d4712a;
    text-decoration: none;
}

/* ============================================================
   ALERTS
   ============================================================ */

.cm-sa-alert {
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 14px;
    margin-bottom: 24px;
    line-height: 1.5;
}

.cm-sa-alert--success {
    background: #f0faf4;
    color: #1e7e4a;
    border-left: 3px solid #27ae60;
}

.cm-sa-alert--error {
    background: #fef2f0;
    color: #c0392b;
    border-left: 3px solid #e74c3c;
}

.cm-sa-error {
    color: #c0392b;
    font-size: 14px;
    padding: 12px 16px;
    background: #fef2f0;
    border-radius: 8px;
    border-left: 3px solid #e74c3c;
}

/* ============================================================
   TABLA
   ============================================================ */

.cm-sa-table-wrapper {
    background: #ffffff;
    border-radius: 12px;
    border: 1px solid #e8e0d8;
    overflow: hidden;
}

.cm-sa-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13.5px;
}

.cm-sa-table thead {
    background: #faf7f4;
    border-bottom: 1px solid #e8e0d8;
}

.cm-sa-table th {
    padding: 12px 16px;
    text-align: left;
    font-size: 11px;
    font-weight: 600;
    color: #a0907e;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    white-space: nowrap;
}

.cm-sa-table td {
    padding: 14px 16px;
    color: #1c1410;
    border-bottom: 1px solid #f0ebe5;
    vertical-align: middle;
}

.cm-sa-table tbody tr:last-child td {
    border-bottom: none;
}

.cm-sa-table tbody tr:hover td {
    background: #fdfcfb;
}

.cm-sa-row--inactive td {
    color: #a0907e;
}

.cm-sa-row--inactive .cm-sa-td-name strong {
    color: #a0907e;
}

.cm-sa-td-actions {
    white-space: nowrap;
}

.cm-sa-td-date {
    white-space: nowrap;
    color: #6b5c4e;
    font-size: 13px;
}

.cm-sa-muted {
    color: #c4b5a8;
}

/* ============================================================
   ESTADO VACÍO
   ============================================================ */

.cm-sa-empty {
    text-align: center;
    padding: 60px 20px;
    background: #ffffff;
    border-radius: 12px;
    border: 1px solid #e8e0d8;
    color: #6b5c4e;
}

.cm-sa-empty p {
    margin: 0 0 20px 0;
    font-size: 15px;
}

/* ============================================================
   BOTONES
   ============================================================ */

.cm-sa-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 9px 18px;
    border-radius: 8px;
    font-family: 'DM Sans', system-ui, sans-serif;
    font-size: 13.5px;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    border: none;
    transition: background 0.2s, color 0.2s, box-shadow 0.2s, transform 0.15s;
    white-space: nowrap;
}

.cm-sa-btn:hover {
    text-decoration: none;
    transform: translateY(-1px);
}

.cm-sa-btn:active {
    transform: translateY(0);
}

.cm-sa-btn:disabled {
    opacity: 0.65;
    cursor: not-allowed;
    transform: none;
}

.cm-sa-btn--sm {
    padding: 5px 11px;
    font-size: 12.5px;
    border-radius: 6px;
}

.cm-sa-btn--primary {
    background: linear-gradient(135deg, #d4712a 0%, #c4621a 100%);
    color: #ffffff;
    box-shadow: 0 2px 8px rgba(212, 113, 42, 0.28);
}

.cm-sa-btn--primary:hover {
    background: linear-gradient(135deg, #c4621a 0%, #b55310 100%);
    box-shadow: 0 4px 14px rgba(212, 113, 42, 0.38);
    color: #ffffff;
}

.cm-sa-btn--secondary {
    background: #1c1410;
    color: #ffffff;
}

.cm-sa-btn--secondary:hover {
    background: #2e2018;
    color: #ffffff;
}

.cm-sa-btn--outline {
    background: #ffffff;
    color: #6b5c4e;
    border: 1px solid #ddd5cb;
}

.cm-sa-btn--outline:hover {
    border-color: #d4712a;
    color: #d4712a;
    background: #fdf3eb;
}

.cm-sa-btn--ghost {
    background: transparent;
    color: #6b5c4e;
    border: 1px solid transparent;
}

.cm-sa-btn--ghost:hover {
    background: #f0ebe5;
    color: #1c1410;
}

.cm-sa-btn--warning {
    background: #fef3e2;
    color: #b45309;
    border: 1px solid #fcd98a;
}

.cm-sa-btn--warning:hover {
    background: #fde9c0;
    color: #92400e;
}

.cm-sa-btn--success {
    background: #f0faf4;
    color: #1e7e4a;
    border: 1px solid #a7f3c8;
}

.cm-sa-btn--success:hover {
    background: #dcfce7;
    color: #166534;
}

.cm-sa-btn--danger {
    background: #fef2f0;
    color: #c0392b;
    border: 1px solid #fdb5ae;
}

.cm-sa-btn--danger:hover {
    background: #fee2e2;
    color: #991b1b;
}

/* ============================================================
   STATUS BADGES
   ============================================================ */

.cm-sa-status {
    display: inline-block;
    font-size: 11.5px;
    font-weight: 600;
    padding: 3px 9px;
    border-radius: 20px;
    letter-spacing: 0.02em;
}

.cm-sa-status--active {
    background: #f0faf4;
    color: #1e7e4a;
    border: 1px solid #a7f3c8;
}

.cm-sa-status--inactive {
    background: #f5f0eb;
    color: #a0907e;
    border: 1px solid #ddd5cb;
}

.cm-sa-tag {
    display: inline-block;
    font-size: 12px;
    font-weight: 500;
    color: #d4712a;
    background: #fdf3eb;
    border: 1px solid #f9d4a8;
    padding: 3px 9px;
    border-radius: 20px;
}

/* ============================================================
   FORMULARIO
   ============================================================ */

.cm-sa-form-card {
    background: #ffffff;
    border-radius: 12px;
    border: 1px solid #e8e0d8;
    padding: 36px 40px;
}

.cm-sa-form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

.cm-sa-field {
    display: flex;
    flex-direction: column;
    gap: 7px;
}

.cm-sa-field--full {
    margin-bottom: 20px;
}

.cm-sa-field label {
    font-size: 13px;
    font-weight: 500;
    color: #6b5c4e;
    display: flex;
    align-items: center;
    gap: 6px;
}

.cm-sa-required {
    color: #c0392b;
    font-size: 13px;
}

.cm-sa-hint {
    font-size: 12px;
    font-weight: 400;
    color: #a0907e;
}

.cm-sa-field input,
.cm-sa-field textarea,
.cm-sa-field select {
    padding: 10px 14px;
    border-radius: 8px;
    border: 1.5px solid #ddd5cb;
    font-size: 14px;
    color: #1c1410;
    background: #fdfcfb;
    transition: border-color 0.2s, box-shadow 0.2s;
    width: 100%;
}

.cm-sa-field input:focus,
.cm-sa-field textarea:focus,
.cm-sa-field select:focus {
    border-color: #d4712a;
    box-shadow: 0 0 0 3px rgba(212, 113, 42, 0.15);
    outline: none;
    background: #ffffff;
}

.cm-sa-field textarea {
    resize: vertical;
    min-height: 100px;
    line-height: 1.5;
}

.cm-sa-field small {
    font-size: 12px;
    color: #a0907e;
}

.cm-sa-password-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.cm-sa-password-wrapper input {
    padding-right: 44px;
}

.cm-sa-form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 28px;
    padding-top: 24px;
    border-top: 1px solid #e8e0d8;
}

/* ============================================================
   FICHA DEL PROFESOR
   ============================================================ */

.cm-sa-profesor-header {
    display: flex;
    align-items: flex-start;
    gap: 20px;
    background: #ffffff;
    border-radius: 12px;
    border: 1px solid #e8e0d8;
    padding: 28px 32px;
    margin-bottom: 20px;
}

.cm-sa-profesor-avatar img {
    border-radius: 50%;
    width: 80px;
    height: 80px;
    object-fit: cover;
}

.cm-sa-profesor-info {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.cm-sa-profesor-info h3 {
    font-family: 'DM Serif Display', Georgia, serif;
    font-size: 22px;
    font-weight: 400;
    color: #1c1410;
    margin: 0;
    padding: 0;
    letter-spacing: -0.01em;
}

.cm-sa-profesor-info p {
    font-size: 14px;
    color: #6b5c4e;
    margin: 0;
    padding: 0;
}

.cm-sa-profesor-bio {
    background: #faf7f4;
    border-radius: 10px;
    border: 1px solid #e8e0d8;
    padding: 16px 20px;
    margin-bottom: 20px;
    font-size: 14px;
    color: #6b5c4e;
    line-height: 1.6;
}

.cm-sa-profesor-bio p {
    margin: 0;
    padding: 0;
}

/* ============================================================
   DETAIL GRID
   ============================================================ */

.cm-sa-detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px;
    margin-bottom: 28px;
}

.cm-sa-detail-item {
    background: #ffffff;
    border-radius: 10px;
    border: 1px solid #e8e0d8;
    padding: 16px 20px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.cm-sa-detail-label {
    font-size: 11px;
    font-weight: 600;
    color: #a0907e;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.cm-sa-detail-value {
    font-size: 14px;
    font-weight: 500;
    color: #1c1410;
}

/* ============================================================
   OPCIONES GRID (view-profesor)
   ============================================================ */

.cm-sa-opciones-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
}

.cm-sa-opcion-card {
    display: flex;
    flex-direction: column;
    gap: 6px;
    background: #ffffff;
    border: 1.5px solid #e8e0d8;
    border-radius: 12px;
    padding: 24px 20px;
    text-decoration: none;
    cursor: pointer;
    transition: border-color 0.2s, box-shadow 0.2s, transform 0.15s;
}

.cm-sa-opcion-card:hover {
    border-color: #d4712a;
    box-shadow: 0 4px 16px rgba(212, 113, 42, 0.12);
    transform: translateY(-2px);
    text-decoration: none;
}

.cm-sa-opcion-card--danger {
    border-color: #fdb5ae;
}

.cm-sa-opcion-card--danger:hover {
    border-color: #e74c3c;
    box-shadow: 0 4px 16px rgba(231, 76, 60, 0.12);
}

.cm-sa-opcion-icon {
    font-size: 24px;
    line-height: 1;
    margin-bottom: 4px;
    display: block;
}

.cm-sa-opcion-title {
    font-size: 14px;
    font-weight: 600;
    color: #1c1410;
    display: block;
}

.cm-sa-opcion-desc {
    font-size: 12.5px;
    color: #a0907e;
    line-height: 1.4;
    display: block;
}

/* ============================================================
   CAMPO SOLO LECTURA
   ============================================================ */

.cm-sa-input-readonly {
    background: #f5f0eb;
    color: #a0907e;
    cursor: not-allowed;
    border-color: #e8e0d8;
}

.cm-sa-input-readonly:focus {
    border-color: #e8e0d8;
    box-shadow: none;
    outline: none;
}

/* ============================================================
   PESTAÑAS (reutilizadas en superadmin)
   ============================================================ */

.cm-sa-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 20px;
    border-bottom: 2px solid #e8e0d8;
}

.cm-sa-tab {
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    padding: 10px 18px;
    font-family: 'DM Sans', system-ui, sans-serif;
    font-size: 13.5px;
    font-weight: 500;
    color: #6b5c4e;
    cursor: pointer;
    transition: color 0.2s, border-color 0.2s;
}

.cm-sa-tab:hover { color: #d4712a; }

.cm-sa-tab.active {
    color: #d4712a;
    border-bottom-color: #d4712a;
}

.cm-sa-tab-panel { display: none; }
.cm-sa-tab-panel:first-of-type { display: block; }

/* ============================================================
   CONFIGURACIÓN DE COBRO AL PROFESOR
   ============================================================ */

.cm-sa-cobro-bloque {
    margin-bottom: 8px;
}

.cm-sa-cobro-header {
    margin-bottom: 12px;
}

.cm-sa-checkbox-label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    color: #1c1410;
}

.cm-sa-checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: #d4712a;
    cursor: pointer;
}

.cm-sa-cobro-body {
    background: #faf7f4;
    border: 1px solid #e8e0d8;
    border-radius: 8px;
    padding: 16px 20px;
    margin-top: 8px;
}

.cm-sa-cobro-resumen {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 20px;
}

.cm-sa-cobro-resumen-item {
    padding: 8px 14px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
}

.cm-sa-cobro-resumen-item.activo {
    background: #f0faf4;
    color: #1e7e4a;
    border: 1px solid #a7f3c8;
}

.cm-sa-cobro-resumen-item.inactivo {
    background: #f5f0eb;
    color: #a0907e;
    border: 1px solid #e8e0d8;
}

.cm-sa-hint {
    font-size: 13.5px;
    color: #a0907e;
    margin: 0 0 20px 0;
    line-height: 1.5;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */

@media (max-width: 768px) {
    .cm-sa-topbar-ag {
        padding: 0 16px;
    }

    .cm-sa-nav {
        overflow-x: auto;
    }

    .cm-sa-content {
        padding: 20px 16px 40px;
    }

    .cm-sa-form-card {
        padding: 24px 20px;
    }

    .cm-sa-form-row {
        grid-template-columns: 1fr;
    }

    .cm-sa-table-wrapper {
        overflow-x: auto;
    }

    .cm-sa-section-header {
        flex-wrap: wrap;
    }

    .cm-sa-profesor-header {
        flex-direction: column;
        align-items: center;
        text-align: center;
        padding: 24px 20px;
    }

    .cm-sa-opciones-grid {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 480px) {
    .cm-sa-user {
        display: none;
    }

    .cm-sa-opciones-grid {
        grid-template-columns: 1fr;
    }

    .cm-sa-detail-grid {
        grid-template-columns: 1fr 1fr;
    }
}