/* Mobile App Styles */
body.native-app {
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
}

body.android-app {
    /* Android-specific styles */
    font-family: 'Roboto', 'Open Sans', sans-serif;
    line-height: 1.5;
}

body.keyboard-open {
    /* Adjust layout when keyboard is open */
    padding-bottom: 300px;
    transition: padding-bottom 0.3s ease;
}

/* Pull to refresh indicator */
#pull-to-refresh {
    position: fixed;
    top: -50px;
    left: 50%;
    transform: translateX(-50%);
    background: #046fa5;
    color: white;
    padding: 10px 20px;
    border-radius: 20px;
    z-index: 9999;
    opacity: 0;
    transition: all 0.3s ease;
    font-size: 14px;
}

#pull-to-refresh.show {
    top: 20px;
    opacity: 1;
}

/* Network status indicator */
#network-status {
    position: fixed;
    top: -50px;
    left: 0;
    right: 0;
    padding: 12px;
    text-align: center;
    z-index: 9999;
    transition: transform 0.3s ease;
    font-weight: 500;
    font-size: 14px;
}

#network-status.online {
    background: #28a745;
    color: white;
    transform: translateY(0);
}

#network-status.offline {
    background: #dc3545;
    color: white;
    transform: translateY(0);
}

/* Share Controls for Android App */
body.native-app .share-controls {
    position: fixed;
    bottom: calc(20px + env(safe-area-inset-bottom));
    right: 20px;
    z-index: 1000;
}

body.native-app .share-btn {
    background: linear-gradient(135deg, #046fa5, #0e1f27);
    color: white;
    border: none;
    border-radius: 50px;
    padding: 12px 20px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 500;
    box-shadow: 0 4px 20px rgba(4, 111, 165, 0.3);
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 120px;
    justify-content: center;
}

body.native-app .share-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 25px rgba(4, 111, 165, 0.4);
}

body.native-app .share-btn:active {
    transform: translateY(0);
}

body.native-app .share-menu {
    position: absolute;
    bottom: 70px;
    right: 0;
    background: white;
    border-radius: 16px;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.15);
    padding: 8px;
    min-width: 200px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: all 0.3s ease;
    border: 1px solid rgba(0, 0, 0, 0.1);
}

body.native-app .share-menu.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

body.native-app .share-menu-header {
    font-size: 12px;
    font-weight: 600;
    color: #666;
    padding: 8px 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid #f0f0f0;
    margin-bottom: 4px;
}

body.native-app .share-options {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

body.native-app .share-option {
    background: transparent;
    border: none;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 14px;
    color: #333;
    cursor: pointer;
    border-radius: 8px;
    transition: background-color 0.2s ease;
    text-align: left;
    width: 100%;
}

body.native-app .share-option:hover {
    background-color: #f8f9fa;
}

body.native-app .share-option i {
    font-size: 16px;
    width: 20px;
    text-align: center;
}

body.native-app .share-option.whatsapp i { color: #25D366; }
body.native-app .share-option.telegram i { color: #0088cc; }
body.native-app .share-option.email i { color: #EA4335; }
body.native-app .share-option.sms i { color: #34B7F1; }
body.native-app .share-option.clipboard i { color: #6C757D; }
body.native-app .share-option.general i { color: #046fa5; }

/* Android-specific optimizations */
body.android-app .share-controls {
    bottom: calc(25px + env(safe-area-inset-bottom));
}

body.android-app .share-btn {
    background: linear-gradient(135deg, #046fa5, #0e1f27);
    border-radius: 28px;
    padding: 14px 22px;
    font-size: 15px;
    font-weight: 600;
}

body.android-app .share-menu {
    border-radius: 20px;
    box-shadow: 0 12px 48px rgba(0, 0, 0, 0.2);
}

/* Mobile optimizations */
@media (max-width: 480px) {
    body.native-app .share-controls {
        bottom: calc(15px + env(safe-area-inset-bottom));
        right: 15px;
    }

    body.native-app .share-btn {
        padding: 10px 16px;
        font-size: 13px;
        min-width: 110px;
    }

    body.native-app .share-menu {
        bottom: 65px;
        right: -10px;
        min-width: 180px;
    }

    body.native-app .share-option {
        padding: 10px 12px;
        font-size: 13px;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    body.native-app .share-menu {
        background: #2c3e50;
        border-color: rgba(255, 255, 255, 0.1);
    }

    body.native-app .share-menu-header {
        color: #bdc3c7;
        border-bottom-color: rgba(255, 255, 255, 0.1);
    }

    body.native-app .share-option {
        color: #ecf0f1;
    }

    body.native-app .share-option:hover {
        background-color: rgba(255, 255, 255, 0.1);
    }
}

/* Animation for share success */
@keyframes shareSuccess {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

body.native-app .share-btn.success {
    animation: shareSuccess 0.6s ease;
    background: linear-gradient(135deg, #27ae60, #2ecc71);
}

/* Share toast notifications */
.share-toast {
    position: fixed;
    bottom: calc(100px + env(safe-area-inset-bottom));
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 12px 20px;
    border-radius: 25px;
    font-size: 14px;
    z-index: 10000;
    opacity: 0;
    transition: opacity 0.3s ease;
    max-width: 300px;
    text-align: center;
}

.share-toast.show {
    opacity: 1;
}

/* Safe area adjustments for notched devices */
@supports (padding: max(0px)) {
    body.native-app .share-controls {
        padding-right: max(20px, env(safe-area-inset-right));
    }
}

/* Network status styles */
#network-status.online {
    background: #27ae60;
    color: white;
}

#network-status.offline {
    background: #f39c12;
    color: white;
}

#network-status.show {
    transform: translateY(0);
}

/* Mobile notifications */
.mobile-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    padding: 16px;
    max-width: 300px;
    z-index: 9999;
    animation: slideInRight 0.3s ease;
}

.notification-content h4 {
    margin: 0 0 8px 0;
    color: #046fa5;
    font-size: 16px;
}

.notification-content p {
    margin: 0;
    color: #666;
    font-size: 14px;
}

.notification-close {
    position: absolute;
    top: 8px;
    right: 8px;
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    color: #999;
}

.notification-close:hover {
    color: #666;
}

/* Mobile-specific adjustments */
@media (max-width: 768px) {
    .mobile-notification {
        top: 10px;
        right: 10px;
        left: 10px;
        max-width: none;
    }
    
    #pull-to-refresh {
        font-size: 12px;
        padding: 8px 16px;
    }
}

/* Loading states */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(4, 111, 165, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top: 4px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

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

/* Touch-friendly buttons */
.btn-mobile {
    min-height: 44px;
    min-width: 44px;
    padding: 12px 20px;
}

/* Safe area handling */
.safe-area-top {
    padding-top: env(safe-area-inset-top);
}

.safe-area-bottom {
    padding-bottom: env(safe-area-inset-bottom);
}

/* File download progress */
.download-progress {
    position: fixed;
    bottom: 20px;
    left: 20px;
    right: 20px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    padding: 16px;
    z-index: 9999;
}

.download-progress-bar {
    width: 100%;
    height: 4px;
    background: #e9ecef;
    border-radius: 2px;
    overflow: hidden;
    margin: 8px 0;
}

.download-progress-fill {
    height: 100%;
    background: #046fa5;
    transition: width 0.3s ease;
}

.download-progress-text {
    font-size: 12px;
    color: #666;
    text-align: center;
}
