/* assets/css/style.css */
/* Core custom CSS to supplement Tailwind CSS CDN */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:ital,wght@0,200..800;1,200..800&family=Sora:wght@100..800&display=swap');

:root {
    --primary: #004ac6;
    --primary-container: #2563eb;
    --secondary: #006686;
    --secondary-container: #7ed4fd;
    --tertiary: #3750a0;
    --on-surface: #191c1e;
    --on-surface-variant: #434655;
    --outline: #737686;
    --outline-variant: #c3c6d7;
    --surface: #f7f9fb;
    --surface-container: #eceef0;
    --surface-container-lowest: #ffffff;
    --error: #ba1a1a;
}

body {
    font-family: 'Plus Jakarta Sans', sans-serif;
    background-color: var(--surface);
}

button,
input[type="submit"],
input[type="button"],
input[type="reset"],
select,
textarea {
    font-family: 'Plus Jakarta Sans', sans-serif;
}

/* —— Selector de archivos (plataforma) —— */
.bita-file-picker {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.625rem;
    width: 100%;
    padding: 0.625rem 0.875rem;
    border: 1px solid var(--outline-variant, #c3c6d7);
    border-radius: 0.75rem;
    background: #fff;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.bita-file-picker:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--primary) 15%, transparent);
}

.bita-file-picker__input {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.bita-file-picker__btn {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.5rem 0.875rem;
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: 0.75rem;
    font-weight: 700;
    line-height: 1.25;
    color: var(--primary);
    background: color-mix(in srgb, var(--primary) 12%, white);
    border-radius: 0.625rem;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.15s ease;
    flex-shrink: 0;
    user-select: none;
}

.bita-file-picker__btn:hover {
    background: color-mix(in srgb, var(--primary) 20%, white);
}

.bita-file-picker__btn:active {
    transform: scale(0.98);
}

.bita-file-picker__btn .material-symbols-outlined {
    font-size: 1.125rem;
    opacity: 1 !important;
}

.bita-file-picker__name {
    flex: 1;
    min-width: 0;
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: 0.8125rem;
    color: #94a3b8;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.bita-file-picker__name.is-selected {
    color: var(--on-surface-variant, #434655);
    font-weight: 500;
}

/* Fallback si JS no corre: estilizar el botón nativo */
input[type="file"]:not(.bita-file-picker__input) {
    width: 100%;
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: 0.8125rem;
    color: var(--on-surface-variant, #434655);
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--outline-variant, #c3c6d7);
    border-radius: 0.75rem;
    background: #fff;
    cursor: pointer;
}

input[type="file"]:not(.bita-file-picker__input)::file-selector-button,
input[type="file"]:not(.bita-file-picker__input)::-webkit-file-upload-button {
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-weight: 700;
    font-size: 0.75rem;
    padding: 0.5rem 0.875rem;
    margin-right: 0.75rem;
    border: none;
    border-radius: 0.625rem;
    background: color-mix(in srgb, var(--primary) 12%, white);
    color: var(--primary);
    cursor: pointer;
    transition: background 0.2s ease;
}

input[type="file"]:not(.bita-file-picker__input)::file-selector-button:hover,
input[type="file"]:not(.bita-file-picker__input)::-webkit-file-upload-button:hover {
    background: color-mix(in srgb, var(--primary) 20%, white);
}

/* —— Toggle mostrar/ocultar contraseña —— */
.bita-password-wrap {
    position: relative;
    display: block;
    width: 100%;
}

input.bita-password-input {
    padding-right: 2.75rem !important;
}

.bita-password-toggle {
    position: absolute;
    inset-block: 0;
    right: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding-inline: 0.75rem;
    color: var(--outline, #737686);
    background: transparent;
    border: 0;
    cursor: pointer;
    transition: color 0.15s ease;
}

.bita-password-toggle:hover {
    color: var(--on-surface, #191c1e);
}

.bita-password-toggle:focus-visible {
    outline: 2px solid color-mix(in srgb, var(--primary) 45%, transparent);
    outline-offset: 2px;
    border-radius: 0.375rem;
}

.bita-password-toggle .material-symbols-outlined {
    font-size: 1.25rem;
    line-height: 1;
}

h1, h2, h3, h4, h5, h6 {
    font-family: 'Sora', sans-serif;
}

/* Material Symbols — ocultar nombres de ligadura hasta que cargue la fuente */
.material-symbols-outlined {
    font-family: 'Material Symbols Outlined';
    font-weight: normal;
    font-style: normal;
    font-size: 24px;
    line-height: 1;
    letter-spacing: normal;
    text-transform: none;
    display: inline-block;
    white-space: nowrap;
    word-wrap: normal;
    direction: ltr;
    -webkit-font-smoothing: antialiased;
    font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;
    opacity: 0;
    transition: opacity 0.12s ease;
}

html.icons-ready .material-symbols-outlined {
    opacity: 1;
}

.icon-fill {
    font-variation-settings: 'FILL' 1, 'wght' 400, 'GRAD' 0, 'opsz' 24;
}

/* Premium Glass Panel */
.glass-panel {
    background: rgba(255, 255, 255, 0.75);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.5);
}

/* Ambient shadows for card elevations */
.ambient-shadow {
    box-shadow: 0 20px 40px -10px rgba(37, 99, 235, 0.06);
}

.ambient-shadow-hover {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.ambient-shadow-hover:hover {
    box-shadow: 0 30px 50px -15px rgba(37, 99, 235, 0.1);
    transform: translateY(-2px);
}

/* Mesh background for Auth and Landing pages */
.bg-mesh {
    background-color: #f7f9fb;
    background-image: 
        radial-gradient(at 80% 0%, hsla(217, 100%, 94%, 1) 0px, transparent 50%),
        radial-gradient(at 0% 50%, hsla(213, 100%, 96%, 1) 0px, transparent 50%);
}

.bg-pattern {
    background-image: radial-gradient(#c3c6d7 1px, transparent 1px);
    background-size: 40px 40px;
}

/* Hide scrollbars but keep functionality */
.no-scrollbar::-webkit-scrollbar {
    display: none;
}
.no-scrollbar {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

/* Patina-inspired mesh background */
.bg-mesh-patina {
    background-color: #f7f9fb;
    background-image: 
        radial-gradient(circle at 50% -20%, rgba(219, 39, 119, 0.07) 0%, transparent 45%),
        radial-gradient(circle at 15% 25%, rgba(37, 99, 235, 0.05) 0%, transparent 35%),
        radial-gradient(circle at 85% 65%, rgba(124, 58, 237, 0.04) 0%, transparent 40%);
}

/* FAQ Accordion Styles */
.faq-accordion-item {
    border-bottom: 1px solid rgba(226, 232, 240, 0.8);
}
.faq-accordion-trigger {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    padding: 1.5rem 0.5rem;
    text-align: left;
    font-weight: 600;
    color: #0f172a;
    font-family: 'Sora', sans-serif;
    transition: color 0.2s;
}
.faq-accordion-trigger:hover {
    color: #004ac6;
}
.faq-accordion-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s cubic-bezier(0.4, 0, 0.2, 1), padding 0.3s ease-out;
    padding: 0 0.5rem;
    color: #434655;
    font-size: 0.925rem;
    line-height: 1.6;
}
.faq-accordion-item.active .faq-accordion-content {
    max-height: 300px;
    padding-bottom: 1.5rem;
}
.faq-accordion-icon {
    transition: transform 0.3s ease;
}
.faq-accordion-item.active .faq-accordion-icon {
    transform: rotate(45deg);
    color: #004ac6;
}

/* --- Smooth Platform Animations --- */

/* Modal Backdrop & Dialog Animations */
@keyframes modalBackdropFadeIn {
    from {
        opacity: 0;
        backdrop-filter: blur(0px);
        -webkit-backdrop-filter: blur(0px);
    }
    to {
        opacity: 1;
        backdrop-filter: blur(8px);
        -webkit-backdrop-filter: blur(8px);
    }
}

@keyframes modalContentScaleUp {
    from {
        opacity: 0;
        transform: scale(0.92) translateY(20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* Target fixed modals when they are visible (i.e. do not have the 'hidden' class) */
.fixed.inset-0.z-50:not(.hidden) {
    animation: modalBackdropFadeIn 0.35s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.fixed.inset-0.z-50:not(.hidden) > div {
    animation: modalContentScaleUp 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

/* Modal Closing Animations */
@keyframes modalBackdropFadeOut {
    from {
        opacity: 1;
        backdrop-filter: blur(8px);
        -webkit-backdrop-filter: blur(8px);
    }
    to {
        opacity: 0;
        backdrop-filter: blur(0px);
        -webkit-backdrop-filter: blur(0px);
    }
}

@keyframes modalContentScaleDown {
    from {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
    to {
        opacity: 0;
        transform: scale(0.92) translateY(20px);
    }
}

.fixed.inset-0.z-50.modal-closing {
    animation: modalBackdropFadeOut 0.25s cubic-bezier(0.3, 0, 0.2, 1) forwards !important;
}

.fixed.inset-0.z-50.modal-closing > div {
    animation: modalContentScaleDown 0.25s cubic-bezier(0.3, 0, 0.2, 1) forwards !important;
}

/* Dropdowns Animation (e.g. notifications dropdown) */
@keyframes dropdownFadeIn {
    from {
        opacity: 0;
        transform: translateY(8px) scale(0.97);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

#notifications-dropdown:not(.hidden) {
    animation: dropdownFadeIn 0.25s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    transform-origin: top right;
}

/* General Page Entrance Fade */
@keyframes pageFadeIn {
    from {
        opacity: 0;
        transform: translateY(4px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

main {
    animation: pageFadeIn 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* Button & Card Micro-interactions */
button, a {
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.bg-white.rounded-2xl.shadow-md {
    opacity: 0;
    animation: containerFadeUp 0.5s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.bg-white.rounded-2xl.shadow-md:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 24px -10px rgba(0, 74, 198, 0.08);
}

/* KPIs & Containers Load Animation */
@keyframes containerFadeUp {
    from {
        opacity: 0;
        transform: translateY(12px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Minimalist Stagger Effect for Grid Items */
.grid > div:nth-child(1) { animation-delay: 0.04s; }
.grid > div:nth-child(2) { animation-delay: 0.08s; }
.grid > div:nth-child(3) { animation-delay: 0.12s; }
.grid > div:nth-child(4) { animation-delay: 0.16s; }
.grid > div:nth-child(5) { animation-delay: 0.2s; }
.grid > div:nth-child(6) { animation-delay: 0.24s; }
.grid > div:nth-child(n+7) { animation-delay: 0.28s; }

/* Asistencia móvil para preceptores */
.attendance-status-btn {
    display: block;
    text-align: center;
    padding: 0.75rem 0.5rem;
    border-radius: 0.75rem;
    border: 1px solid #e2e8f0;
    background: #fff;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    cursor: pointer;
    transition: all 0.15s ease;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.attendance-status-option input:checked + .attendance-status-presente {
    background: #f0fdf4;
    color: #15803d;
    border-color: #86efac;
}

.attendance-status-option input:checked + .attendance-status-ausente {
    background: #fef2f2;
    color: #b91c1c;
    border-color: #fca5a5;
}

.attendance-status-option input:checked + .attendance-status-tarde {
    background: #fefce8;
    color: #a16207;
    border-color: #fde047;
}

.attendance-mobile-card {
    transition: box-shadow 0.2s ease;
}

.attendance-mobile-card:active {
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--primary) 15%, transparent);
}

/* Institution branding overrides (uses --primary from institution_theme.php) */
.text-primary { color: var(--primary) !important; }
.bg-primary { background-color: var(--primary) !important; }
.border-primary { border-color: var(--primary) !important; }
.bg-primary-container,
.hover\:bg-primary-container:hover { background-color: var(--primary-container) !important; }
.hover\:bg-blue-700:hover { background-color: var(--primary-container) !important; }
.text-blue-600 { color: var(--primary) !important; }
.bg-blue-100 { background-color: color-mix(in srgb, var(--primary) 12%, white) !important; }
.border-primary\/20,
.border-primary\/30,
.border-primary\/40,
.hover\:border-primary\/50:hover { border-color: color-mix(in srgb, var(--primary) 30%, transparent) !important; }
.ring-primary { --tw-ring-color: var(--primary) !important; }
.peer-checked\:border-primary:peer:checked ~ * { border-color: var(--primary) !important; }
.focus\:border-primary:focus { border-color: var(--primary) !important; }
.focus\:ring-primary\/20:focus { --tw-ring-color: color-mix(in srgb, var(--primary) 20%, transparent) !important; }

/* —— Modo demo: selector de perfiles estilo Apple —— */
body.demo-mode main {
    padding-bottom: 7.5rem !important;
}

.demo-banner {
    background: rgba(254, 243, 199, 0.92);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    color: #92400e;
    font-size: 0.75rem;
    font-weight: 600;
    text-align: center;
    padding: 0.4rem 1rem;
    border-bottom: 1px solid rgba(251, 191, 36, 0.35);
    position: sticky;
    top: 0;
    z-index: 45;
}

.demo-profile-switcher {
    position: fixed;
    bottom: calc(1rem + env(safe-area-inset-bottom, 0px));
    left: 50%;
    transform: translateX(-50%);
    z-index: 50;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.4rem;
    max-width: calc(100vw - 1.5rem);
    pointer-events: none;
}

.demo-profile-switcher__pill {
    pointer-events: auto;
    background: rgba(255, 255, 255, 0.55);
    backdrop-filter: blur(24px) saturate(1.4);
    -webkit-backdrop-filter: blur(24px) saturate(1.4);
    border: 1px solid rgba(255, 255, 255, 0.55);
    border-radius: 9999px;
    box-shadow:
        0 12px 40px rgba(15, 23, 42, 0.14),
        0 2px 8px rgba(15, 23, 42, 0.06),
        inset 0 1px 0 rgba(255, 255, 255, 0.7);
    padding: 0.35rem;
    max-width: 100%;
}

.demo-profile-switcher__track {
    position: relative;
    display: flex;
    align-items: stretch;
    gap: 0.15rem;
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.demo-profile-switcher__track::-webkit-scrollbar {
    display: none;
}

.demo-profile-switcher__thumb {
    position: absolute;
    top: 0;
    left: 0;
    z-index: 0;
    border-radius: 9999px;
    background: rgba(255, 255, 255, 0.95);
    box-shadow: 0 2px 10px rgba(15, 23, 42, 0.1);
    opacity: 0;
    pointer-events: none;
    will-change: transform, width, height;
    transition:
        transform 0.32s cubic-bezier(0.32, 0.72, 0, 1),
        width 0.32s cubic-bezier(0.32, 0.72, 0, 1),
        height 0.32s cubic-bezier(0.32, 0.72, 0, 1),
        opacity 0.18s ease;
}

.demo-profile-switcher__thumb.is-ready {
    opacity: 1;
}

.demo-profile-switcher__form {
    position: relative;
    z-index: 1;
    margin: 0;
    flex-shrink: 0;
}

.demo-profile-switcher__segment {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.1rem;
    min-width: 4.25rem;
    padding: 0.45rem 0.7rem;
    border: none;
    border-radius: 9999px;
    background: transparent;
    color: rgba(15, 23, 42, 0.55);
    cursor: pointer;
    transition: color 0.22s ease, transform 0.22s ease;
    font-family: inherit;
}

.demo-profile-switcher__segment .material-symbols-outlined {
    font-size: 1.35rem;
    opacity: 1 !important;
    transition: transform 0.22s cubic-bezier(0.32, 0.72, 0, 1);
}

.demo-profile-switcher__label {
    font-size: 0.625rem;
    font-weight: 700;
    letter-spacing: 0.01em;
    line-height: 1.1;
    white-space: nowrap;
}

.demo-profile-switcher__segment:hover:not(.is-active):not(:disabled) {
    color: rgba(15, 23, 42, 0.85);
}

.demo-profile-switcher__segment.is-active {
    background: transparent;
    color: var(--primary);
    transform: scale(1.02);
}

.demo-profile-switcher__segment.is-active .material-symbols-outlined {
    transform: scale(1.06);
}

.demo-profile-switcher[data-switching="1"] {
    pointer-events: none;
}

.demo-profile-switcher[data-switching="1"] .demo-profile-switcher__pill {
    pointer-events: none;
}

@media (max-width: 480px) {
    .demo-profile-switcher__segment {
        min-width: 3.6rem;
        padding: 0.4rem 0.5rem;
    }

    .demo-profile-switcher__label {
        font-size: 0.55rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    .demo-profile-switcher__thumb,
    .demo-profile-switcher__segment,
    .demo-profile-switcher__segment .material-symbols-outlined {
        transition: none !important;
    }
}

