/* ===============================
   ESTILOS PWA PARA RESERVA BARCO
   =============================== */

/* Variables CSS para PWA */
:root {
    --pwa-primary: #007bff;
    --pwa-secondary: #00bcd4;
    --pwa-success: #28a745;
    --pwa-warning: #ffc107;
    --pwa-danger: #dc3545;
    --pwa-light: #f8f9fa;
    --pwa-dark: #343a40;
    --pwa-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    --pwa-shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.15);
    --pwa-border-radius: 12px;
    --pwa-transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ===============================
   BOTÓN DE INSTALACIÓN PWA
   =============================== */
.pwa-install-button {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
    display: none;
    animation: bounceIn 0.6s ease-out;
}

.pwa-install-button button {
    background: linear-gradient(135deg, var(--pwa-primary), var(--pwa-secondary));
    border: none;
    color: white;
    padding: 15px 25px;
    border-radius: var(--pwa-border-radius);
    box-shadow: var(--pwa-shadow-lg);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--pwa-transition);
    display: flex;
    align-items: center;
    gap: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.pwa-install-button button:hover {
    transform: translateY(-3px);
    box-shadow: 0 15px 35px rgba(0, 123, 255, 0.4);
    background: linear-gradient(135deg, #0056b3, #008ba3);
}

.pwa-install-button button:active {
    transform: translateY(-1px);
}

.pwa-install-button i {
    font-size: 18px;
    animation: pulse 2s infinite;
}

/* ===============================
   BANNER DE ACTUALIZACIÓN
   =============================== */
.pwa-update-banner {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: linear-gradient(90deg, var(--pwa-primary), var(--pwa-secondary));
    color: white;
    padding: 15px;
    z-index: 10000;
    box-shadow: var(--pwa-shadow);
    transform: translateY(-100%);
    transition: transform 0.3s ease-in-out;
}

.update-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    max-width: 1200px;
    margin: 0 auto;
}

.update-info {
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 500;
}

.update-info i {
    font-size: 20px;
    animation: bounce 1s infinite;
}

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

.btn-update {
    background: rgba(255, 255, 255, 0.2);
    border: 2px solid rgba(255, 255, 255, 0.3);
    color: white;
    padding: 8px 16px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: var(--pwa-transition);
}

.btn-update:hover {
    background: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.5);
}

.btn-dismiss {
    background: transparent;
    border: none;
    color: white;
    font-size: 20px;
    cursor: pointer;
    padding: 5px 10px;
    border-radius: 50%;
    transition: var(--pwa-transition);
}

.btn-dismiss:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* ===============================
   MODAL DE INSTRUCCIONES
   =============================== */
.pwa-install-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10001;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease-out;
}

.modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(5px);
}

.modal-content {
    background: white;
    border-radius: var(--pwa-border-radius);
    box-shadow: var(--pwa-shadow-lg);
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
    animation: slideInUp 0.4s ease-out;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid #e9ecef;
}

.modal-header h3 {
    margin: 0;
    color: var(--pwa-primary);
    font-size: 1.5rem;
    font-weight: 700;
}

.modal-header button {
    background: none;
    border: none;
    font-size: 24px;
    color: #6c757d;
    cursor: pointer;
    padding: 5px;
    border-radius: 50%;
    transition: var(--pwa-transition);
}

.modal-header button:hover {
    background: #f8f9fa;
    color: var(--pwa-danger);
}

.modal-body {
    padding: 20px;
}

.install-instructions {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.instruction-item {
    display: flex;
    gap: 15px;
    align-items: flex-start;
}

.step-number {
    background: linear-gradient(135deg, var(--pwa-primary), var(--pwa-secondary));
    color: white;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    flex-shrink: 0;
}

.step-content h4 {
    margin: 0 0 8px 0;
    color: var(--pwa-dark);
    font-size: 1.1rem;
    font-weight: 600;
}

.step-content p {
    margin: 0;
    color: #6c757d;
    line-height: 1.5;
    font-size: 0.95rem;
}

/* ===============================
   PROMOCIÓN DE INSTALACIÓN
   =============================== */
.pwa-install-promotion {
    position: fixed;
    bottom: 20px;
    left: 20px;
    right: 20px;
    background: white;
    border-radius: var(--pwa-border-radius);
    box-shadow: var(--pwa-shadow-lg);
    padding: 20px;
    z-index: 9998;
    animation: slideInUp 0.5s ease-out;
    border: 2px solid var(--pwa-primary);
}

.promotion-content {
    display: flex;
    align-items: center;
    gap: 15px;
}

.promotion-icon {
    background: linear-gradient(135deg, var(--pwa-primary), var(--pwa-secondary));
    color: white;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    flex-shrink: 0;
}

.promotion-text {
    flex: 1;
}

.promotion-text h4 {
    margin: 0 0 5px 0;
    color: var(--pwa-primary);
    font-size: 1.2rem;
    font-weight: 700;
}

.promotion-text p {
    margin: 0;
    color: #6c757d;
    font-size: 0.9rem;
}

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

.promotion-actions button {
    padding: 8px 16px;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    font-weight: 600;
    transition: var(--pwa-transition);
    font-size: 0.9rem;
}

.promotion-actions button:first-child {
    background: var(--pwa-primary);
    color: white;
}

.promotion-actions button:first-child:hover {
    background: #0056b3;
    transform: translateY(-1px);
}

.promotion-actions button:last-child {
    background: #f8f9fa;
    color: #6c757d;
    border: 1px solid #dee2e6;
}

.promotion-actions button:last-child:hover {
    background: #e9ecef;
}

/* ===============================
   MENSAJE DE BIENVENIDA
   =============================== */
.pwa-welcome-message {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    border-radius: var(--pwa-border-radius);
    box-shadow: var(--pwa-shadow-lg);
    padding: 30px;
    z-index: 10002;
    text-align: center;
    max-width: 400px;
    width: 90%;
    animation: zoomIn 0.5s ease-out;
}

.welcome-content i {
    font-size: 48px;
    color: var(--pwa-success);
    margin-bottom: 15px;
    animation: checkmark 0.6s ease-out 0.3s both;
}

.welcome-content h4 {
    margin: 0 0 10px 0;
    color: var(--pwa-success);
    font-size: 1.3rem;
    font-weight: 700;
}

.welcome-content p {
    margin: 0;
    color: #6c757d;
    line-height: 1.5;
}

/* ===============================
   ESTADO DE CONEXIÓN
   =============================== */
.connection-status {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 12px 20px;
    border-radius: var(--pwa-border-radius);
    color: white;
    font-weight: 600;
    z-index: 9999;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: var(--pwa-shadow);
    animation: slideInRight 0.4s ease-out;
}

.connection-status.online {
    background: linear-gradient(135deg, var(--pwa-success), #20c997);
}

.connection-status.offline {
    background: linear-gradient(135deg, var(--pwa-danger), #fd7e14);
}

.connection-status i {
    font-size: 16px;
}

/* ===============================
   ESTILOS PARA APP INSTALADA
   =============================== */
.pwa-installed {
    /* Ocultar elementos que no son necesarios en la app instalada */
}

.pwa-installed .pwa-install-button {
    display: none !important;
}

/* Ajustes para pantalla completa en dispositivos móviles */
@media (display-mode: standalone) {
    body {
        padding-top: env(safe-area-inset-top);
        padding-bottom: env(safe-area-inset-bottom);
    }
    
    /* Ocultar la barra de direcciones simulada en iOS */
    .ios-address-bar {
        display: none;
    }
}

/* ===============================
   ANIMACIONES
   =============================== */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes bounceIn {
    0% {
        opacity: 0;
        transform: scale(0.3);
    }
    50% {
        opacity: 1;
        transform: scale(1.05);
    }
    70% {
        transform: scale(0.9);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes zoomIn {
    from {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.8);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
}

@keyframes checkmark {
    0% {
        transform: scale(0);
    }
    50% {
        transform: scale(1.2);
    }
    100% {
        transform: scale(1);
    }
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
    }
}

@keyframes bounce {
    0%, 20%, 53%, 80%, 100% {
        transform: translateY(0);
    }
    40%, 43% {
        transform: translateY(-8px);
    }
    70% {
        transform: translateY(-4px);
    }
    90% {
        transform: translateY(-2px);
    }
}

/* ===============================
   RESPONSIVE DESIGN
   =============================== */
@media (max-width: 768px) {
    .pwa-install-button {
        bottom: 15px;
        right: 15px;
    }
    
    .pwa-install-button button {
        padding: 12px 20px;
        font-size: 14px;
    }
    
    .pwa-install-promotion {
        bottom: 15px;
        left: 15px;
        right: 15px;
        padding: 15px;
    }
    
    .promotion-content {
        flex-direction: column;
        text-align: center;
        gap: 12px;
    }
    
    .promotion-actions {
        justify-content: center;
    }
    
    .modal-content {
        width: 95%;
        margin: 20px;
    }
    
    .connection-status {
        top: 15px;
        right: 15px;
        padding: 10px 16px;
        font-size: 14px;
    }
    
    .update-content {
        flex-direction: column;
        gap: 10px;
        text-align: center;
    }
}

@media (max-width: 480px) {
    .pwa-welcome-message {
        width: 95%;
        padding: 25px 20px;
    }
    
    .welcome-content i {
        font-size: 40px;
    }
    
    .welcome-content h4 {
        font-size: 1.1rem;
    }
    
    .modal-header {
        padding: 15px;
    }
    
    .modal-body {
        padding: 15px;
    }
    
    .instruction-item {
        gap: 12px;
    }
    
    .step-number {
        width: 28px;
        height: 28px;
        font-size: 14px;
    }
}

/* ===============================
   TEMA OSCURO
   =============================== */
@media (prefers-color-scheme: dark) {
    .modal-content {
        background: #2d3748;
        color: #e2e8f0;
    }
    
    .modal-header {
        border-bottom-color: #4a5568;
    }
    
    .modal-header h3 {
        color: #63b3ed;
    }
    
    .step-content h4 {
        color: #e2e8f0;
    }
    
    .step-content p {
        color: #a0aec0;
    }
    
    .pwa-install-promotion {
        background: #2d3748;
        color: #e2e8f0;
        border-color: #63b3ed;
    }
    
    .promotion-text h4 {
        color: #63b3ed;
    }
    
    .promotion-text p {
        color: #a0aec0;
    }
    
    .pwa-welcome-message {
        background: #2d3748;
        color: #e2e8f0;
    }
    
    .welcome-content p {
        color: #a0aec0;
    }
}