* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: Arial, sans-serif;
    background: #f3f4f6;
    color: #111827;
}

/* LOGIN */

.login-body {
    min-height: 100vh;
    background: linear-gradient(135deg, #1f6feb, #6f42c1);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.login-card {
    width: 100%;
    max-width: 430px;
    background: white;
    border-radius: 24px;
    padding: 34px;
    box-shadow: 0 20px 50px rgba(0,0,0,0.25);
}

.login-card h1 {
    margin-top: 0;
    margin-bottom: 8px;
    color: #111827;
}

.login-card p {
    color: #6b7280;
    margin-bottom: 24px;
}

.logo-zone {
    width: 100%;
    min-height: 120px;
    border-radius: 18px;
    background: #f3f4f6;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 22px;
    overflow: hidden;
    position: relative;
}

.login-logo-zone {
    min-height: 130px;
}

.logo-img {
    width: auto;
    max-width: 260px;
    max-height: 120px;
    object-fit: contain;
    display: block;
}

.logo-placeholder {
    position: absolute;
    color: #64748b;
    font-weight: bold;
    pointer-events: none;
    z-index: 0;
}

.logo-img:not([style*="display: none"]) + .logo-placeholder {
    display: none;
}

.error {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fecaca;
    border-radius: 10px;
    padding: 12px;
    margin-bottom: 18px;
}

.small {
    margin-top: 18px;
    font-size: 13px;
    color: #6b7280;
}

.small a {
    color: #1f6feb;
    font-weight: bold;
    text-decoration: none;
}

/* TOPBAR */

.topbar {
    background: white;
    border-bottom: 1px solid #e5e7eb;
    padding: 16px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 10;
}

.brand {
    font-weight: bold;
    font-size: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.brand-logo {
    width: 42px;
    height: 42px;
    max-width: 42px;
    max-height: 42px;
    object-fit: contain;
    border-radius: 8px;
}

.logout {
    color: #d93025;
    text-decoration: none;
    font-weight: bold;
}

/* LAYOUT */

.layout {
    display: grid;
    grid-template-columns: 250px 1fr;
    min-height: calc(100vh - 65px);
}

.sidebar {
    background: #111827;
    padding: 22px;
    color: white;
}

.sidebar-image-zone {
    width: 100%;
    min-height: 110px;
    border-radius: 16px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background: rgba(255,255,255,0.06);
    position: relative;
}

.sidebar-logo {
    width: auto;
    max-width: 150px;
    max-height: 100px;
    object-fit: contain;
    display: block;
}

.sidebar-placeholder {
    position: absolute;
    color: #9ca3af;
    font-size: 13px;
    pointer-events: none;
}

.sidebar-logo:not([style*="display: none"]) + .sidebar-placeholder {
    display: none;
}

.sidebar a {
    display: block;
    color: #d1d5db;
    text-decoration: none;
    padding: 12px 14px;
    border-radius: 10px;
    margin-bottom: 8px;
    font-weight: bold;
}

.sidebar a:hover,
.sidebar a.active {
    background: #1f6feb;
    color: white;
}

.main {
    padding: 28px;
    max-width: 1100px;
    width: 100%;
}

/* CARDS */

.card {
    background: white;
    padding: 26px;
    border-radius: 16px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.08);
    margin-bottom: 24px;
}

.hero {
    background: linear-gradient(135deg, #1f6feb, #6f42c1);
    color: white;
}

.hero h1 {
    color: white;
}

.hero p {
    color: #eef2ff;
}

.hero-content {
    display: grid;
    grid-template-columns: 1fr 260px;
    gap: 24px;
    align-items: center;
}

.hero-image-zone,
.mini-image-zone {
    border-radius: 16px;
    background: rgba(255,255,255,0.15);
    min-height: 150px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
}

.hero-img,
.mini-img {
    width: 100%;
    height: 100%;
    max-width: 100%;
    object-fit: cover;
    display: block;
}

.hero-placeholder,
.mini-placeholder {
    position: absolute;
    font-weight: bold;
    color: rgba(255,255,255,0.85);
    text-align: center;
    padding: 10px;
    pointer-events: none;
}

.hero-img:not([style*="display: none"]) + .hero-placeholder,
.mini-img:not([style*="display: none"]) + .mini-placeholder {
    display: none;
}

.page-header-card {
    display: grid;
    grid-template-columns: 1fr 220px;
    gap: 22px;
    align-items: center;
}

.page-header-card .mini-image-zone {
    min-height: 130px;
    background: #f3f4f6;
}

.page-header-card .mini-placeholder {
    color: #64748b;
}

h1, h2, h3 {
    margin-top: 0;
}

.grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
}

.big-link {
    display: block;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 16px;
    padding: 24px;
    text-decoration: none;
    color: #111827;
    box-shadow: 0 2px 10px rgba(0,0,0,0.06);
}

.big-link:hover {
    border-color: #1f6feb;
    transform: translateY(-1px);
}

.big-link strong {
    display: block;
    font-size: 20px;
    margin-bottom: 8px;
}

.big-link span {
    color: #6b7280;
}

/* FORMULARIOS */

label {
    font-weight: bold;
    display: block;
    margin-top: 14px;
    margin-bottom: 7px;
}

input, textarea, button, select {
    width: 100%;
    padding: 12px;
    border-radius: 10px;
    border: 1px solid #d1d5db;
    font-size: 15px;
    margin-bottom: 14px;
}

textarea {
    min-height: 300px;
    font-family: Consolas, monospace;
}

button,
.button-link {
    background: #1f6feb;
    color: white;
    border: none;
    cursor: pointer;
    font-weight: bold;
    text-decoration: none;
    display: inline-block;
    text-align: center;
    padding: 12px 16px;
    border-radius: 10px;
}

button:hover,
.button-link:hover {
    background: #1958bd;
}

.danger-button,
.danger-link {
    background: #d93025;
}

.danger-button:hover,
.danger-link:hover {
    background: #aa2119;
}

.info {
    background: #e8f1ff;
    border: 1px solid #bfdbfe;
    padding: 13px;
    border-radius: 10px;
    margin-bottom: 16px;
}

.warning {
    background: #fff7ed;
    border: 1px solid #fed7aa;
    padding: 13px;
    border-radius: 10px;
    margin-bottom: 16px;
}

/* MATERIALES */

.material-item {
    display: grid;
    grid-template-columns: 1fr 210px;
    gap: 18px;
    padding: 18px;
    border: 1px solid #e5e7eb;
    border-radius: 14px;
    margin-bottom: 14px;
    background: #fafafa;
}

.material-item a {
    color: #1f6feb;
    font-weight: bold;
}

.muted {
    color: #6b7280;
}

.pill {
    display: inline-block;
    padding: 5px 9px;
    border-radius: 999px;
    background: #e8f1ff;
    color: #1f6feb;
    font-size: 12px;
    font-weight: bold;
}

code {
    background: #f3f4f6;
    padding: 2px 5px;
    border-radius: 5px;
}

/* DIRECCIÓN */

.direccion-topbar {
    background: #0f172a;
    color: white;
}

.direccion-topbar .logout {
    color: #fecaca;
}

.direccion-sidebar {
    background: #020617;
}

.student-card {
    display: grid;
    grid-template-columns: 1fr 170px;
    gap: 18px;
    padding: 18px;
    border: 1px solid #e5e7eb;
    border-radius: 14px;
    margin-bottom: 14px;
    background: #fafafa;
}

.student-card h3 {
    margin-bottom: 6px;
}

.student-details {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px 18px;
    margin-top: 12px;
    color: #374151;
}

.student-notes {
    background: #fff7ed;
    border: 1px solid #fed7aa;
    border-radius: 10px;
    padding: 10px;
    margin-top: 12px;
    color: #7c2d12;
}

.student-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.student-actions form {
    margin: 0;
}

.student-actions button,
.student-actions .button-link {
    width: 100%;
}

.payment-box {
    background: #f8fafc;
    border: 1px solid #dbeafe;
    border-radius: 14px;
    padding: 18px;
    margin: 18px 0;
}

/* RESPONSIVE */

@media (max-width: 1100px) {
    .main {
        padding: 22px;
    }

    .hero-content {
        grid-template-columns: 1fr;
    }

    .hero-image-zone {
        min-height: 190px;
    }
}

@media (max-width: 850px) {
    .topbar {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

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

    .sidebar {
        display: flex;
        gap: 8px;
        overflow-x: auto;
        align-items: center;
        padding: 14px;
    }

    .sidebar a {
        white-space: nowrap;
        margin-bottom: 0;
        font-size: 14px;
    }

    .sidebar-image-zone {
        min-width: 90px;
        height: 70px;
        min-height: 70px;
        margin-bottom: 0;
    }

    .main {
        padding: 16px;
    }

    .card {
        padding: 20px;
    }

    .grid,
    .page-header-card {
        grid-template-columns: 1fr;
    }

    .material-item,
    .student-card {
        grid-template-columns: 1fr;
    }

    .student-details {
        grid-template-columns: 1fr;
    }

    .hero-image-zone,
    .mini-image-zone {
        min-height: 160px;
    }

    .brand {
        font-size: 17px;
    }
}

@media (max-width: 520px) {
    .login-card {
        padding: 24px;
        border-radius: 18px;
    }

    .main {
        padding: 12px;
    }

    .card {
        padding: 16px;
        border-radius: 14px;
    }

    .big-link {
        padding: 18px;
    }

    input, textarea, button, select {
        font-size: 16px;
    }

    .sidebar a {
        font-size: 13px;
        padding: 10px 12px;
    }
}


/* Limpieza: ya no usamos huecos extra de imágenes */
.hero-content {
    display: block;
}

.page-header-card {
    display: block;
}

.hero-image-zone,
.mini-image-zone,
.hero-placeholder,
.mini-placeholder {
    display: none !important;
}


/* Logo ajustado automáticamente */

.brand-logo {
    width: 42px !important;
    height: 42px !important;
    max-width: 42px !important;
    max-height: 42px !important;
    object-fit: contain !important;
}

.sidebar-logo {
    width: auto !important;
    max-width: 150px !important;
    max-height: 100px !important;
    object-fit: contain !important;
}

.logo-img {
    width: auto !important;
    max-width: 260px !important;
    max-height: 120px !important;
    object-fit: contain !important;
}
