/**
 * Rasys Progressive Web App (PWA) Stylesheet
 * Responsive Smart Install Banner & Modal
 */

:root {
    --pwa-primary: #2563eb;
    --pwa-primary-hover: #1d4ed8;
    --pwa-bg: #ffffff;
    --pwa-text: #0f172a;
    --pwa-muted: #64748b;
    --pwa-border: #e2e8f0;
    --pwa-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

/* Floating Smart Install Banner */
#rasys-pwa-banner {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 999999;
    max-width: 420px;
    width: calc(100% - 48px);
    background: var(--pwa-bg);
    border-radius: 16px;
    border: 1px solid var(--pwa-border);
    box-shadow: var(--pwa-shadow);
    padding: 16px 20px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    display: none;
    opacity: 0;
    transform: translateY(20px) scale(0.98);
    transition: opacity 0.3s cubic-bezier(0.16, 1, 0.3, 1), transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    box-sizing: border-box;
}

#rasys-pwa-banner.pwa-visible {
    display: block;
    opacity: 1;
    transform: translateY(0) scale(1);
}

#rasys-pwa-banner * {
    box-sizing: border-box;
}

.pwa-banner-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.pwa-banner-brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.pwa-banner-icon {
    width: 46px;
    height: 46px;
    border-radius: 12px;
    object-fit: cover;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    background: #f1f5f9;
}

.pwa-banner-info {
    display: flex;
    flex-direction: column;
}

.pwa-banner-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--pwa-text);
    margin: 0;
    line-height: 1.2;
    display: flex;
    align-items: center;
    gap: 6px;
}

.pwa-badge {
    display: inline-block;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    background: #dbeafe;
    color: #1e40af;
    padding: 2px 6px;
    border-radius: 9999px;
    letter-spacing: 0.5px;
}

.pwa-banner-subtitle {
    font-size: 12px;
    color: var(--pwa-muted);
    margin: 2px 0 0 0;
}

.pwa-banner-close {
    background: transparent;
    border: none;
    color: #94a3b8;
    cursor: pointer;
    font-size: 18px;
    padding: 4px;
    border-radius: 8px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, color 0.2s;
}

.pwa-banner-close:hover {
    background: #f1f5f9;
    color: var(--pwa-text);
}

.pwa-banner-body {
    font-size: 13px;
    color: #475569;
    line-height: 1.45;
    margin-bottom: 14px;
}

.pwa-banner-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.pwa-btn-install {
    flex: 1;
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    color: #ffffff;
    border: none;
    border-radius: 10px;
    padding: 10px 16px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    text-align: center;
    box-shadow: 0 4px 10px rgba(37, 99, 235, 0.25);
    transition: transform 0.15s, box-shadow 0.15s, background 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.pwa-btn-install:hover {
    background: linear-gradient(135deg, #1d4ed8 0%, #1e40af 100%);
    box-shadow: 0 6px 14px rgba(37, 99, 235, 0.35);
    transform: translateY(-1px);
}

.pwa-btn-install:active {
    transform: translateY(0);
}

.pwa-btn-dismiss {
    background: #f8fafc;
    color: #64748b;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 10px 16px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
}

.pwa-btn-dismiss:hover {
    background: #f1f5f9;
    color: var(--pwa-text);
}

/* iOS Safari Instruction Modal / Banner */
#rasys-pwa-ios-modal {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    z-index: 999999;
    max-width: 400px;
    width: calc(100% - 32px);
    background: #ffffff;
    border-radius: 18px;
    padding: 18px 20px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    border: 1px solid #e2e8f0;
    display: none;
    opacity: 0;
    transition: opacity 0.3s ease, transform 0.3s ease;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    box-sizing: border-box;
}

#rasys-pwa-ios-modal.pwa-visible {
    display: block;
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.pwa-ios-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.pwa-ios-title {
    font-size: 15px;
    font-weight: 700;
    color: #0f172a;
    display: flex;
    align-items: center;
    gap: 8px;
}

.pwa-ios-steps {
    list-style: none;
    padding: 0;
    margin: 0 0 14px 0;
    font-size: 13px;
    color: #334155;
}

.pwa-ios-steps li {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
    line-height: 1.4;
}

.pwa-ios-icon-badge {
    width: 28px;
    height: 28px;
    border-radius: 7px;
    background: #f1f5f9;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    flex-shrink: 0;
}

/* Nav Manual Install Button */
.pwa-manual-install-btn {
    display: none;
    align-items: center;
    gap: 6px;
    background: #f0fdf4;
    color: #166534;
    border: 1px solid #bbf7d0;
    padding: 5px 12px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.pwa-manual-install-btn:hover {
    background: #dcfce7;
    border-color: #86efac;
}

.pwa-manual-install-btn.pwa-btn-active {
    display: inline-flex !important;
}

/* Mobile adjustments */
@media (max-width: 640px) {
    #rasys-pwa-banner {
        bottom: 16px;
        right: 16px;
        left: 16px;
        width: auto;
        padding: 14px 16px;
    }
}
