/* ============================================
   shared.css - Estilos compartidos entre páginas
   Extraídos de múltiples archivos para eliminar
   duplicación exacta.
   ============================================ */

/* === Validación de RUT (data-rut inputs) === */
input[data-rut].is-valid {
    border-color: #28a745 !important;
    box-shadow: 0 0 0 0.15rem rgba(40, 167, 69, 0.15) !important;
}

input[data-rut].is-invalid {
    border-color: #dc3545 !important;
    box-shadow: 0 0 0 0.15rem rgba(220, 53, 69, 0.15) !important;
}

.rut-mensaje {
    font-size: 0.78rem;
    margin-top: 4px;
    display: block;
    min-height: 1.2em;
    line-height: 1.2;
}

.rut-mensaje-error {
    color: #dc3545;
}

.rut-mensaje-ok {
    color: #28a745;
}

/* === Fondo borroso (login + home_selector) === */
.blur-bg {
    background-image: url("../images/fondo_ulagos.9537eb05904c.webp");
    background-size: cover;
    background-position: center;
    filter: blur(6px);
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
}

/* === Main Card (base + docente + attendance) === */
.main-card {
    border: none;
    border-radius: 14px;
    box-shadow: 0 4px 12px rgba(0, 61, 166, 0.1);
    background: white;
    overflow: hidden;
    border-left: 4px solid var(--ulagos-blue);
    transition: all 0.3s ease;
}

.main-card:hover {
    box-shadow: 0 8px 20px rgba(0, 61, 166, 0.15);
}

.main-card h1 {
    color: var(--ulagos-blue);
    font-weight: 600;
}

/* === Staff Hero Card (Contraparte, Docente, Profesional, Tutor) === */
.staff-hero-card {
    position: relative;
    overflow: hidden;
    background-color: rgba(0,40,110,1) !important;
    border-left: none !important;
}

.staff-hero-card h1 {
    color: #ffffff !important;
}

.hero-card-nombre {
    display: inline-block;
    background: rgba(0, 0, 0, 0.3);
    padding: 4px 14px;
    border-radius: 8px;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    max-width: 100%;
}

.staff-hero-imagen {
    position: absolute;
    top: 0;
    right: 0;
    height: 100%;
    width: 80%;
    max-width: 720px;
    z-index: 0;
    pointer-events: none;
}

.staff-hero-imagen img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: right center;
    display: block;
    -webkit-mask-image: linear-gradient(to right, transparent 0%, black 15%);
    mask-image: linear-gradient(to right, transparent 0%, black 15%);
}

.staff-hero-card .card-body {
    z-index: 1;
}

.staff-hero-card .card-body h1,
.staff-hero-card .card-body p,
.staff-hero-card .card-body .breadcrumb-item,
.staff-hero-card .card-body .breadcrumb-item a {
    color: #ffffff !important;
}

.staff-hero-card .card-body .breadcrumb-item.active {
    color: rgba(255,255,255,0.75) !important;
}

.staff-hero-card .btn-outline-light {
    border-color: rgba(255,255,255,0.5);
}

.staff-hero-card .btn-outline-light:hover {
    background-color: rgba(255,255,255,0.1);
    border-color: #ffffff;
}

@media (max-width: 768px) {
    .staff-hero-imagen {
        display: none;
    }
}

/* === Section Card (docente + attendance) === */
.section-card {
    background: white;
    border-radius: 14px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    margin-bottom: 1.5rem;
    overflow: hidden;
}

.section-card-body {
    display: flex;
    align-items: center;
    padding: 0.75rem 1.25rem;
    gap: 1rem;
}

.section-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    flex-shrink: 0;
}

.section-info {
    flex: 1;
}

.section-title {
    font-size: 1rem;
    font-weight: 600;
    margin: 0;
    line-height: 1.3;
}

.section-subtitle {
    font-size: 0.7rem;
    color: #6c757d;
    margin: 0;
    line-height: 1.3;
}

/* === Drive Grid + Cards (base + docente + attendance) === */
.drive-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 1rem;
    margin-top: 0.5rem;
    width: 100%;
}

.drive-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 1rem 0.5rem;
    background: #f8f9fa;
    border-radius: 12px;
    text-decoration: none;
    transition: all 0.3s ease;
    border: 1px solid #e9ecef;
    min-width: 0;
}

.drive-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
    background: white;
    border-color: #dee2e6;
    text-decoration: none;
}

.drive-icon {
    font-size: 2.5rem;
    margin-bottom: 0.75rem;
}

.drive-name {
    font-size: 0.8rem;
    color: #495057;
    word-break: break-word;
    overflow-wrap: break-word;
    max-width: 100%;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Colores por tipo de archivo */
.drive-card .fa-file-video,
.drive-card .fa-video {
    color: #dc3545;
}

.drive-card .fa-file-pdf {
    color: #e74c3c;
}

.drive-card .fa-file-powerpoint,
.drive-card .fa-chalkboard {
    color: #e67e22;
}

.drive-card .fa-file-word,
.drive-card .fa-file-alt,
.drive-card .fa-file-lines {
    color: #2c7da0;
}

.drive-card .fa-file-excel,
.drive-card .fa-table {
    color: #27ae60;
}

.drive-card .fa-folder {
    color: #f39c12;
}

.drive-card .fa-image,
.drive-card .fa-file-image {
    color: #8e44ad;
}

.drive-card .fa-music,
.drive-card .fa-file-audio {
    color: #1abc9c;
}

.drive-card .fa-file-archive {
    color: #95a5a6;
}

.drive-card .fa-file {
    color: #6c757d;
}

/* Responsive drive grid */
@media (max-width: 768px) {
    .drive-grid {
        grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
        gap: 0.75rem;
    }

    .drive-icon {
        font-size: 2rem;
    }

    .drive-name {
        font-size: 0.7rem;
    }

    .section-card-body {
        padding: 0.6rem 1rem;
    }

    .section-icon {
        width: 32px;
        height: 32px;
        font-size: 1rem;
    }

    .section-title {
        font-size: 0.9rem;
    }

    .section-subtitle {
        font-size: 0.65rem;
    }
}

@media (max-width: 576px) {
    .drive-grid {
        grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
        gap: 0.5rem;
    }

    .drive-card {
        padding: 0.75rem 0.25rem;
    }

    .drive-icon {
        font-size: 1.6rem;
    }

    .drive-name {
        font-size: 0.65rem;
    }
}

/* === Badge Colors (base + calendar) === */
.badge-blue {
    background: var(--ulagos-blue);
    color: white;
}

.badge-green {
    background: var(--ulagos-green);
    color: white;
}

.badge-yellow {
    background: var(--ulagos-yellow);
    color: #333;
}

.badge-orange {
    background: var(--ulagos-orange);
    color: white;
}

.badge-purple {
    background: var(--ulagos-purple);
    color: white;
}

.badge-red {
    background: var(--ulagos-red);
    color: white;
}

/* === Animaciones compartidas (calendar + home_prog + home_preu + attendance) === */
@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOutRight {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

@keyframes pulseDot {
    0%   { box-shadow: 0 0 0 0 rgba(154, 214, 74, 0.7); }
    70%  { box-shadow: 0 0 0 8px rgba(154, 214, 74, 0); }
    100% { box-shadow: 0 0 0 0 rgba(154, 214, 74, 0); }
}

@keyframes slideUpPanel {
    from { transform: translateY(100%); opacity: 0; }
    to   { transform: translateY(0);   opacity: 1; }
}

/* === Banner YouTube (home_prog + home_preu - 100% idéntico) === */
.banner-youtube {
    border: none;
    border-radius: 14px;
    box-shadow: 0 4px 12px rgba(0, 61, 166, 0.1);
    background: linear-gradient(135deg, #003366 0%, #005aa0 60%, #003f7a 100%);
    overflow: hidden;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    height: 100%;
    width: 100%;
    text-decoration: none;
    cursor: pointer;
    margin-bottom: 0;
    margin-top: 0.5rem;
}

.banner-youtube:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 28px rgba(0, 61, 166, 0.2);
}

.banner-youtube-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    flex-shrink: 0;
    height: 90px;
    width: 100%;
    position: relative;
    overflow: hidden;
}

.banner-youtube-inner::before {
    content: '';
    position: absolute;
    top: -40px;
    right: -40px;
    width: 200px;
    height: 200px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.04);
    pointer-events: none;
}

.banner-youtube-inner::after {
    content: '';
    position: absolute;
    bottom: -60px;
    left: 30%;
    width: 260px;
    height: 260px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.03);
    pointer-events: none;
}

.banner-content {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    z-index: 1;
    flex: 1;
    min-width: 0;
    transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
    transform-origin: left center;
}

.banner-youtube:hover .banner-content {
    transform: translateX(-4px) scale(1.01);
}

.banner-play-icon {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.12);
    border: 2px solid rgba(255, 255, 255, 0.25);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.3s ease;
}

.banner-youtube:hover .banner-play-icon {
    background: #ff0000;
    border-color: #ff0000;
    transform: translateX(-3px) scale(1.05);
}

.banner-play-icon i {
    font-size: 1.3rem;
    color: white;
}

.banner-texto {
    min-width: 0;
    flex: 1;
}

.banner-titulo {
    color: white;
    font-size: 0.95rem;
    font-weight: 700;
    margin: 0 0 0.2rem;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    word-break: break-word;
}

.banner-subtitulo {
    color: rgba(255, 255, 255, 0.75);
    font-size: 0.7rem;
    margin: 0;
    line-height: 1.35;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.banner-mascota {
    height: 70px;
    width: auto;
    padding-right: 4px;
    object-fit: contain;
    object-position: center;
    flex-shrink: 0;
    z-index: 1;
    transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
    transform-origin: right center;
    filter: drop-shadow(-2px 0 8px rgba(0, 0, 0, 0.15));
}

.banner-youtube:hover .banner-mascota {
    transform: translateY(-3px) scale(1.02);
}

/* Responsive banner YouTube */
@media (max-width: 768px) {
    .banner-youtube-inner {
        height: 80px;
        padding: 0.5rem 0.75rem;
    }

    .banner-play-icon {
        width: 36px;
        height: 36px;
    }

    .banner-play-icon i {
        font-size: 1rem;
    }

    .banner-titulo {
        font-size: 0.8rem;
        -webkit-line-clamp: 2;
        line-clamp: 2;
    }

    .banner-subtitulo {
        font-size: 0.6rem;
        -webkit-line-clamp: 1;
        line-clamp: 1;
    }

    .banner-mascota {
        height: 55px;
    }
}

@media (min-width: 768px) and (max-width: 992px) {
    .banner-youtube-inner {
        height: 85px;
    }

    .banner-titulo {
        font-size: 0.85rem;
    }

    .banner-subtitulo {
        font-size: 0.65rem;
    }

    .banner-mascota {
        height: 65px;
    }
}

@media (max-width: 576px) {
    .banner-youtube-inner {
        min-height: 80px;
    }

    .banner-content {
        padding: 1rem 0.75rem 1rem 1rem;
        gap: 0.75rem;
    }

    .banner-play-icon {
        width: 44px;
        height: 44px;
    }

    .banner-play-icon i {
        font-size: 1.25rem;
    }

    .banner-titulo {
        font-size: 1rem;
    }

    .banner-subtitulo {
        display: none;
    }

    .banner-mascota {
        height: 80px;
        padding-right: 4px;
    }
}

/* === Panel Clase Activa - Estructura base (home_prog + home_preu) === */
.panel-clase-activa {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 1040;
    color: white;
    padding: 0.85rem 1.25rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    animation: slideUpPanel 0.4s ease;
}

.panel-clase-activa .panel-info {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    min-width: 0;
}

.panel-clase-activa .pulse-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
    animation: pulseDot 1.8s infinite;
}

.panel-clase-activa .panel-texto {
    font-size: 0.88rem;
    line-height: 1.3;
    min-width: 0;
}

.panel-clase-activa .panel-texto strong {
    display: block;
    font-size: 0.95rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.panel-clase-activa .panel-texto span {
    opacity: 0.8;
    font-size: 0.78rem;
}

.btn-marcar-panel {
    border: none;
    border-radius: 8px;
    padding: 0.5rem 1.1rem;
    font-weight: 700;
    font-size: 0.85rem;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
    flex-shrink: 0;
    transition: background 0.2s, transform 0.15s;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    position: relative;
    overflow: hidden;
}

.btn-marcar-panel:hover {
    transform: scale(1.03);
}

/* Estados del botón de marcaje */
.btn-loading-content {
    display: flex;
    align-items: center;
    gap: 6px;
    position: relative;
    z-index: 1;
}

.btn-progress-bar {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: rgba(255, 255, 255, 0.3);
    overflow: hidden;
}

.btn-progress-fill {
    height: 100%;
    width: 0%;
    background: white;
    animation: btnProgressFill 15s linear forwards;
}

@keyframes btnProgressFill {
    0% { width: 0%; }
    10% { width: 30%; }
    50% { width: 60%; }
    80% { width: 85%; }
    100% { width: 95%; }
}

.btn-marcando {
    pointer-events: none;
    cursor: wait;
}

.btn-exito {
    background: #28a745 !important;
    color: white !important;
    pointer-events: none;
}

.btn-success-content {
    justify-content: center;
}

.btn-local {
    background: linear-gradient(135deg, #ffc107, #ffca28) !important;
    color: #333 !important;
    pointer-events: none;
}

.btn-ya-marcado-panel {
    background: rgba(255, 255, 255, 0.15);
    color: white;
    border: 1.5px solid rgba(255, 255, 255, 0.35);
    border-radius: 8px;
    padding: 0.5rem 1.1rem;
    font-size: 0.85rem;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
    flex-shrink: 0;
    cursor: default;
}

.panel-acciones {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    flex-shrink: 0;
    flex-wrap: nowrap;
}

.btn-zoom-panel {
    background: rgba(255, 255, 255, 0.15);
    color: white;
    border: 1.5px solid rgba(255, 255, 255, 0.35);
    border-radius: 8px;
    padding: 0.5rem 1.1rem;
    font-weight: 600;
    font-size: 0.85rem;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
    flex-shrink: 0;
    transition: background 0.2s, transform 0.15s;
}

.btn-zoom-panel:hover {
    background: rgba(255, 255, 255, 0.25);
    color: white;
    transform: scale(1.03);
}

/* Responsive panel clase activa */
@media (max-width: 576px) {
    .panel-clase-activa {
        padding: 0.7rem 1rem;
        gap: 0.75rem;
    }

    .panel-clase-activa .panel-texto strong {
        font-size: 0.85rem;
    }

    .btn-marcar-panel,
    .btn-ya-marcado-panel {
        font-size: 0.8rem;
        padding: 0.45rem 0.9rem;
    }

    .panel-acciones {
        gap: 0.4rem;
        width: 100%;
        justify-content: flex-end;
    }

    .btn-zoom-texto {
        font-size: 0.72rem;
    }

    .btn-zoom-panel,
    .btn-marcar-panel,
    .btn-ya-marcado-panel {
        padding: 0.45rem 0.7rem;
        font-size: 0.72rem;
    }
}

/* === Notificaciones de asistencia (home_prog + home_preu) === */
.attendance-notification {
    position: fixed;
    bottom: 100px;
    right: 20px;
    z-index: 9999999999 !important;
    animation: slideInRight 0.3s ease;
}

.attendance-notification .notification-content {
    padding: 12px 20px;
    border-radius: 8px;
    color: white;
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 500;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.attendance-notification-success .notification-content {
    background: #76BC21;
}

.attendance-notification-error .notification-content {
    background: #CA3625;
}

.attendance-notification-warning .notification-content {
    background: linear-gradient(135deg, #ff9800 0%, #f57c00 100%);
}

.attendance-notification-hide {
    animation: slideOutRight 0.3s ease;
}

@media (max-width: 768px) {
    .attendance-notification {
        bottom: 80px;
        right: 10px;
        left: 10px;
    }

    .attendance-notification .notification-content {
        padding: 10px 16px;
        font-size: 0.9rem;
        justify-content: center;
    }
}
