
:root {
    --safe-area-inset-top: 0px;
    --safe-area-inset-bottom: 0px;
    --safe-area-inset-left: 0px;
    --safe-area-inset-right: 0px;

    --primary-color: #4338ca;
    --primary-dark: #2980b9;
    --secondary-color: #2c3e50;
    --light-color: #ecf0f1;
    --danger-color: #e74c3c;
    --success-color: #2ecc71;
    --border-radius: 8px;
    --box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    --transition: all 0.3s ease;
}
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #f5f5f5;
    height: 100vh;
    overflow: hidden;
}

.container {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

header {
    background: #4f46e5;
    color: white;
    padding: 0.8rem 1rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.8rem;
}

header h1 {
    font-size: 1.3rem;
    font-weight: 600;
}

.controls {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    flex: 1;
    justify-content: flex-end;
}

#currentUrl {
    font-size: 0.8rem;
    opacity: 0.9;
    max-width: 300px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

button {
    padding: 0.4rem 0.8rem;
    border: none;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    cursor: pointer;
    font-size: 0.8rem;
    transition: all 0.2s;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

button:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-1px);
}

button:active {
    transform: translateY(0);
}

button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

main {
    flex: 1;
    position: relative;
    background: white;
}

#webFrame {
    width: 100%;
    height: 100%;
    border: none;
    background: white;
}

.loading {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: white;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    transition: opacity 0.3s;
}

.loading.hidden {
    opacity: 0;
    pointer-events: none;
}

.spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid #181824;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
    margin-bottom: 1rem;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading p {
    color: #666;
    font-size: 1rem;
}

@media (max-width: 768px) {
    header {
        flex-direction: column;
        text-align: center;
        gap: 0.5rem;
    }
    
    .controls {
        justify-content: center;
        width: 100%;
    }
    
    #currentUrl {
        max-width: 200px;
        font-size: 0.7rem;
    }
    
    button {
        padding: 0.3rem 0.6rem;
        font-size: 0.7rem;
    }
}

@media (max-width: 480px) {
    header {
        padding: 0.6rem;
    }
    
    header h1 {
        font-size: 1.1rem;
    }
    
    /* #currentUrl {
        display: none;
    } */
}

/* off-line */
/* Estilos para la página offline */
.offline-page {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: white;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
}

.offline-content {
    text-align: center;
    padding: 2rem;
    max-width: 400px;
}

.select-estudio{
    text-align: center;
    padding: 2rem;
    max-width: 400px;
    width: calc(100% - 40px);
    display: block;
    margin: auto;
}

.offline-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
}

.offline-page h2 {
    color: #666;
    margin-bottom: 1rem;
    font-size: 1.5rem;
}

.offline-page p {
    color: #888;
    margin-bottom: 2rem;
    line-height: 1.5;
}

.offline-status {
    display: flex;
    justify-content: center;
    gap: 2rem;
    margin-bottom: 2rem;
}

.status-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.status-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #e53e3e; /* Rojo por defecto (offline) */
}

.status-dot.online {
    background: #38a169; /* Verde (online) */
}

.status-dot.checking {
    background: #d69e2e; /* Amarillo (verificando) */
}

.retry-button {
    background: #4f46e5;
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-size: 1rem;
    cursor: pointer;
    transition: background 0.2s;
}

.retry-button:hover {
    background: var(--primary-color);
}

.retry-button:disabled {
    background: #9ca3af;
    cursor: not-allowed;
}

/* Asegurar que el iframe esté oculto cuando se muestre offline */
.offline-page:not(.hidden) ~ #webFrame {
    display: none;
}

.d-none{
    display: none;
}
/* END off-line */


/* Header seguro con notch */
.app-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    padding-top: var(--safe-area-inset-top);
    background: #ffffff;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    z-index: 1000;
}

/* Contenido principal */
.main-content {
    margin-top: calc(60px + var(--safe-area-inset-top));
    margin-bottom: calc(60px + var(--safe-area-inset-bottom));
    padding-left: var(--safe-area-inset-left);
    padding-right: var(--safe-area-inset-right);
    min-height: calc(100vh - 120px - var(--safe-area-inset-top) - var(--safe-area-inset-bottom));
}

/* Footer seguro */
.app-footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    padding-bottom: var(--safe-area-inset-bottom);
    background: #ffffff;
    border-top: 1px solid #e0e0e0;
}

/* Para elementos full-screen */
.full-screen-element {
    padding-top: var(--safe-area-inset-top);
    padding-bottom: var(--safe-area-inset-bottom);
    padding-left: var(--safe-area-inset-left);
    padding-right: var(--safe-area-inset-right);
}

/* #installButton {
    position: fixed;
    bottom: 20px;
    right: 20px;
    padding: 12px 20px;
    background: #007bff;
    color: white;
    border: none;
    border-radius: 25px;
    cursor: pointer;
    font-size: 14px;
    font-weight: bold;
    box-shadow: 0 4px 12px rgba(0, 123, 255, 0.3);
    z-index: 1000;
    transition: all 0.3s ease;
}

#installButton:hover {
    background: #0056b3;
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 123, 255, 0.4);
} */

/* --------------- */

.div_noframe{
    background-color: #f5f7fa;
    color: var(--secondary-color);
    line-height: 1.6;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
}

.container_intalled {
    width: 100%;
    max-width: 450px;
    background-color: white;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    padding: 30px;
    margin-bottom: 20px;
}

.logo {
    text-align: center;
    margin-bottom: 25px;
}

.search-btn {
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: var(--border-radius);
    padding: 12px 20px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    width: 100%;
    margin-top: 10px;
}

.search-btn:hover {
    background-color: var(--primary-dark);
}

.alert_info{
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    line-height: 1;
    background-color: rgb(235 235 235);
    padding: 10px;
    border-radius: 10px;
    color: #686868;
    text-align: justify;
    font-style: italic;
    font-size: 14px;
}

.alert_warning{
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    line-height: 1;
    background-color: rgb(242 232 214);
    padding: 10px;
    border-radius: 10px;
    color: orange;
    text-align: justify;
    font-style: italic;
    font-size: 14px;
}
