* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html,
body {
    height: 100%;
}

body {
    font-family: Arial, sans-serif;
    background: #f7f4ef;
    color: #222;
}

body.admin-menu-open {
    overflow: hidden;
}

a {
    text-decoration: none;
    color: inherit;
}

/* ===== APP ===== */

.app {
    display: flex;
    min-height: 100vh;
    width: 100%;
}

/* ===== SIDEBAR ===== */

.admin-sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.35);
    opacity: 0;
    visibility: hidden;
    transition: 0.25s ease;
    z-index: 998;
}

.admin-sidebar-overlay.is-open {
    opacity: 1;
    visibility: visible;
}

.sidebar {
    width: 290px;
    background: #ffffff;
    border-right: 1px solid #ececec;
    flex-shrink: 0;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    z-index: 999;
}

.sidebar-inner {
    min-height: 100%;
    padding: 18px 16px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.sidebar-mobile-top {
    display: none;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 18px;
}

.sidebar-close {
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 12px;
    background: #f3e7eb;
    color: #7b0f2f;
    cursor: pointer;
    font-size: 18px;
}

/* ===== BRAND ===== */

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 28px;
    font-size: 24px;
    font-weight: bold;
    color: #7b0f2f;
}

.brand-desktop {
    display: flex;
}

.brand-logo {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    background: #7b0f2f;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 20px;
}

/* ===== MENU ===== */

.menu-section {
    margin-bottom: 20px;
}

.menu-title {
    font-size: 12px;
    text-transform: uppercase;
    color: #8c8c8c;
    margin: 16px 0 10px;
    padding-left: 10px;
}

.menu {
    list-style: none;
}

.menu li {
    margin-bottom: 8px;
}

.menu a {
    display: block;
    padding: 14px 16px;
    border-radius: 16px;
    color: #333;
    transition: 0.2s ease;
    font-size: 15px;
}

.menu a:hover {
    background: #f4e8ec;
    color: #7b0f2f;
}

.menu a.active {
    background: #8b0d2e;
    color: #fff;
    font-weight: bold;
}

/* ===== MAIN ===== */

.main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

/* ===== TOPBAR ===== */

.topbar {
    min-height: 78px;
    background: #ffffff;
    border-bottom: 1px solid #ececec;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 28px;
    gap: 20px;
    position: sticky;
    top: 0;
    z-index: 50;
}

.topbar-mobile-row {
    display: flex;
    align-items: center;
    gap: 14px;
}

.topbar-hamburger {
    display: none;
    width: 44px;
    height: 44px;
    border: none;
    border-radius: 12px;
    background: #f3e7eb;
    color: #7b0f2f;
    cursor: pointer;
    font-size: 22px;
    line-height: 1;
}

.topbar-left h1 {
    font-size: 26px;
    color: #7b0f2f;
}

.topbar-left p {
    font-size: 13px;
    color: #777;
    margin-top: 4px;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.topbar-badge {
    background: #8b0d2e;
    color: white;
    border-radius: 999px;
    padding: 10px 14px;
    font-size: 14px;
    font-weight: bold;
}

.topbar-icon {
    background: #8b0d2e;
    color: #fff;
    border-radius: 999px;
    padding: 10px 14px;
    font-size: 14px;
    min-width: 44px;
    text-align: center;
}

/* ===== CONTENT ===== */

.content {
    padding: 28px 32px;
    flex: 1;
}

/* ===== DASHBOARD CARDS ===== */

.cards {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 22px;
    margin-bottom: 24px;
}

.card {
    background: #fff;
    border-radius: 18px;
    padding: 24px;
    box-shadow: 0 4px 14px rgba(0,0,0,0.04);
    border: 1px solid #eee;
    min-width: 0;
}

.card h3 {
    font-size: 15px;
    color: #777;
    margin-bottom: 12px;
}

.card .value {
    font-size: 34px;
    font-weight: bold;
    color: #7b0f2f;
}

.card .sub {
    margin-top: 8px;
    color: #666;
    font-size: 14px;
    line-height: 1.5;
}

/* ===== SECTIONS ===== */

.section {
    background: #fff;
    border-radius: 18px;
    border: 1px solid #eee;
    padding: 24px;
    margin-bottom: 24px;
    box-shadow: 0 4px 14px rgba(0,0,0,0.04);
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 18px;
    gap: 14px;
    flex-wrap: wrap;
}

.section-header h2 {
    font-size: 20px;
    color: #7b0f2f;
}

/* ===== BUTTONS ===== */

.btn {
    display: inline-block;
    padding: 11px 16px;
    border-radius: 12px;
    background: #7b0f2f;
    color: #fff;
    border: none;
    cursor: pointer;
    font-size: 14px;
}

.btn-light {
    background: #f1e5e9;
    color: #7b0f2f;
}

.btn-danger {
    background: #b42318;
    color: #fff;
}

.btn-secondary {
    background: #f3f0f1;
    color: #7b0f2f;
}

/* ===== TABLE ===== */

.table-wrap {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

table th,
table td {
    padding: 14px 12px;
    text-align: left;
    border-bottom: 1px solid #eee;
    font-size: 14px;
}

table th {
    color: #7b0f2f;
    font-weight: bold;
    background: #faf7f8;
}

/* ===== BADGES ===== */

.badge {
    display: inline-block;
    padding: 6px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: bold;
}

.badge-success {
    background: #e6f7ec;
    color: #18794e;
}

.badge-warning {
    background: #fff3cd;
    color: #8a6d3b;
}

.badge-danger {
    background: #fde7e9;
    color: #b42318;
}

/* ===== ACTIONS ===== */

.actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.empty-state {
    padding: 30px;
    text-align: center;
    color: #777;
}

/* ===== FORMS ===== */

.form-grid {
    display: grid;
    gap: 18px;
}

.form-group {
    display: flex;
    flex-direction: column;
}

.form-group label {
    margin-bottom: 8px;
    color: #555;
    font-size: 14px;
    font-weight: 600;
}

.form-control,
.form-select,
.form-textarea {
    width: 100%;
    padding: 13px 14px;
    border: 1px solid #ddd;
    border-radius: 12px;
    outline: none;
    font-size: 14px;
    background: #fff;
}

.form-textarea {
    min-height: 120px;
    resize: vertical;
}

.form-control:focus,
.form-select:focus,
.form-textarea:focus {
    border-color: #7b0f2f;
}

.page-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.alert {
    padding: 14px 16px;
    border-radius: 14px;
    margin-bottom: 18px;
    font-size: 14px;
}

.alert-success {
    background: #e9f8ef;
    color: #18794e;
    border: 1px solid #cfead8;
}

.alert-error {
    background: #fdebec;
    color: #b42318;
    border: 1px solid #f4c7cb;
}

.inline-form {
    display: inline;
}

/* ===== SWITCH ===== */

.switch-field {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 6px;
}

.switch-input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
    pointer-events: none;
}

.switch-label {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 26px;
    border-radius: 999px;
    background: #d9d9d9;
    cursor: pointer;
    transition: background 0.25s ease, box-shadow 0.25s ease;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.12);
    flex-shrink: 0;
}

.switch-label::before {
    content: "";
    position: absolute;
    top: 3px;
    left: 3px;
    width: 19px;
    height: 19px;
    border-radius: 50%;
    background: #ffffff;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.18);
    transition: transform 0.25s ease, background 0.25s ease;
}

.switch-input:checked + .switch-label {
    background: #d9c7d9;
}

.switch-input:checked + .switch-label::before {
    transform: translateX(26px);
    background: #7b0f2f;
}

.switch-input:focus + .switch-label {
    outline: none;
    box-shadow: 0 0 0 4px rgba(123, 15, 47, 0.12);
}

.switch-text {
    font-size: 15px;
    font-weight: 600;
    color: #444;
    user-select: none;
}

/* ===== FOOTER ===== */

.footer-derechos {
    background: #0b0b2b;
    color: #fff;
    padding: 18px 20px;
    font-size: 14px;
    margin-top: 40px;
}

.footer-container {
    max-width: 1200px;
    margin: auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.footer-left {
    font-weight: 500;
}

.footer-center {
    opacity: 0.8;
}

.footer-right {
    font-size: 13px;
    opacity: 0.7;
}
.btn-danger {
    background: #b42318;
    color: #fff;
}
.form-help {
    display: block;
    margin-top: 8px;
    color: #777;
    font-size: 13px;
}

.teacher-cycles-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
    margin-top: 10px;
}

.cycle-checkbox {
    position: relative;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    border: 1px solid #e7d9de;
    border-radius: 14px;
    background: #fff;
    cursor: pointer;
    transition: all 0.2s ease;
    min-height: 54px;
}

.cycle-checkbox:hover {
    border-color: #7b0f2f;
    background: #faf5f7;
    box-shadow: 0 4px 12px rgba(123, 15, 47, 0.08);
}

.cycle-checkbox input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.cycle-box {
    width: 22px;
    height: 22px;
    border: 2px solid #7b0f2f;
    border-radius: 6px;
    background: #fff;
    display: inline-block;
    position: relative;
    flex-shrink: 0;
    transition: all 0.2s ease;
}

.cycle-text {
    font-size: 15px;
    font-weight: 600;
    color: #333;
    line-height: 1.3;
}

.cycle-checkbox input:checked + .cycle-box {
    background: #7b0f2f;
    border-color: #7b0f2f;
}

.cycle-checkbox input:checked + .cycle-box::after {
    content: "✓";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -56%);
    color: #fff;
    font-size: 14px;
    font-weight: bold;
}

.cycle-checkbox input:checked ~ .cycle-text {
    color: #7b0f2f;
}

.cycle-checkbox:has(input:checked) {
    border-color: #7b0f2f;
    background: #fcf7f9;
    box-shadow: 0 4px 14px rgba(123, 15, 47, 0.10);
}

@media (max-width: 768px) {
    .teacher-cycles-grid {
        grid-template-columns: 1fr;
    }
}
@media (max-width: 1100px) {
    .cards {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 768px) {
    .topbar-hamburger {
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        width: 280px;
        max-width: 85vw;
        height: 100vh;
        transform: translateX(-100%);
        transition: transform 0.28s ease;
        box-shadow: 0 10px 30px rgba(0,0,0,0.18);
        border-right: 1px solid #ececec;
    }

    .sidebar.is-open {
        transform: translateX(0);
    }

    .sidebar-mobile-top {
        display: flex;
    }

    .brand-desktop {
        display: none;
    }

    .topbar {
        height: auto;
        padding: 16px;
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }

    .topbar-right {
        flex-wrap: wrap;
        width: 100%;
    }

    .content {
        padding: 18px;
    }

    .cards {
        grid-template-columns: 1fr;
    }

    .footer-container {
        flex-direction: column;
        text-align: center;
    }
}