/**
 * Eredda SBA PWA Styles
 * 
 * Styles for Progressive Web App features including install prompts,
 * update notifications, and offline indicators.
 */

/* PWA Install Prompt */
.eredda-pwa-install-prompt {
    position: fixed;
    bottom: 20px;
    left: 20px;
    right: 20px;
    background: #fff;
    border: 1px solid #ccd0d4;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 9999;
    animation: slideUp 0.3s ease-out;
    max-width: 400px;
    margin: 0 auto;
}

@media (min-width: 768px) {
    .eredda-pwa-install-prompt {
        left: auto;
        right: 20px;
        margin: 0;
    }
}

.eredda-pwa-prompt-content {
    display: flex;
    align-items: center;
    padding: 16px;
    gap: 12px;
}

.eredda-pwa-prompt-content img {
    border-radius: 8px;
    flex-shrink: 0;
}

.eredda-pwa-prompt-content div {
    flex: 1;
    min-width: 0;
}

.eredda-pwa-prompt-content h4 {
    margin: 0 0 4px 0;
    font-size: 16px;
    font-weight: 600;
    color: #1d2327;
}

.eredda-pwa-prompt-content p {
    margin: 0;
    font-size: 14px;
    color: #646970;
    line-height: 1.4;
}

.eredda-pwa-prompt-content button {
    background: #2271b1;
    color: #fff;
    border: none;
    border-radius: 4px;
    padding: 8px 16px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s;
    margin-left: 8px;
}

.eredda-pwa-prompt-content button:hover {
    background: #135e96;
}

.eredda-pwa-prompt-content button:last-child {
    background: transparent;
    color: #646970;
    padding: 8px;
    margin-left: 4px;
    font-size: 18px;
    line-height: 1;
}

.eredda-pwa-prompt-content button:last-child:hover {
    background: #f6f7f7;
    color: #1d2327;
}

/* PWA Update Notification */
.eredda-pwa-notification {
    position: fixed;
    top: 20px;
    left: 20px;
    right: 20px;
    background: #2271b1;
    color: #fff;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 9999;
    animation: slideDown 0.3s ease-out;
    max-width: 400px;
    margin: 0 auto;
}

@media (min-width: 768px) {
    .eredda-pwa-notification {
        left: auto;
        right: 20px;
        margin: 0;
    }
}

.eredda-pwa-notification-content {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    gap: 12px;
}

.eredda-pwa-notification-content span {
    flex: 1;
    font-size: 14px;
    font-weight: 500;
}

.eredda-pwa-notification-content button {
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 4px;
    padding: 6px 12px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s;
    margin-left: 8px;
}

.eredda-pwa-notification-content button:hover {
    background: rgba(255, 255, 255, 0.3);
}

.eredda-pwa-notification-content button:last-child {
    background: transparent;
    border: none;
    padding: 6px 8px;
    font-size: 16px;
    line-height: 1;
}

.eredda-pwa-notification-content button:last-child:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Connection Status */
.eredda-connection-status {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: #d63638;
    color: #fff;
    text-align: center;
    padding: 8px 16px;
    font-size: 14px;
    font-weight: 500;
    z-index: 10000;
    transform: translateY(-100%);
    transition: transform 0.3s ease-out;
}

.eredda-connection-status.offline {
    transform: translateY(0);
}

.eredda-connection-status.online {
    background: #00a32a;
    transform: translateY(0);
}

/* PWA Loading States */
.eredda-pwa-loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #2271b1;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    vertical-align: middle;
    margin-right: 8px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* PWA Animations */
@keyframes slideUp {
    from {
        transform: translateY(100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes slideDown {
    from {
        transform: translateY(-100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* PWA Offline Indicator */
.eredda-offline-indicator {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: #646970;
    color: #fff;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    z-index: 9998;
    display: none;
}

.eredda-offline-indicator.show {
    display: block;
    animation: fadeIn 0.3s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* PWA App-like Styling */
.eredda-pwa-app {
    min-height: 100vh;
    background: #f6f7f7;
}

.eredda-pwa-header {
    background: #2271b1;
    color: #fff;
    padding: 16px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.eredda-pwa-header h1 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
}

.eredda-pwa-content {
    padding: 16px;
    max-width: 1200px;
    margin: 0 auto;
}

/* PWA Navigation */
.eredda-pwa-nav {
    background: #fff;
    border-top: 1px solid #ddd;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 100;
    display: flex;
    justify-content: space-around;
    padding: 8px 0;
}

.eredda-pwa-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    color: #646970;
    font-size: 12px;
    padding: 8px 12px;
    border-radius: 8px;
    transition: all 0.2s;
    min-width: 60px;
}

.eredda-pwa-nav-item:hover,
.eredda-pwa-nav-item.active {
    color: #2271b1;
    background: #f0f6fc;
}

.eredda-pwa-nav-item .dashicons {
    font-size: 20px;
    margin-bottom: 4px;
}

/* PWA Cards */
.eredda-pwa-card {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 16px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.eredda-pwa-card h3 {
    margin: 0 0 12px 0;
    font-size: 16px;
    font-weight: 600;
    color: #1d2327;
}

.eredda-pwa-card p {
    margin: 0 0 12px 0;
    color: #646970;
    line-height: 1.5;
}

.eredda-pwa-card:last-child {
    margin-bottom: 0;
}

/* PWA Buttons */
.eredda-pwa-button {
    background: #2271b1;
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 12px 24px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s;
    text-decoration: none;
    display: inline-block;
    text-align: center;
}

.eredda-pwa-button:hover {
    background: #135e96;
    color: #fff;
}

.eredda-pwa-button.secondary {
    background: #f6f7f7;
    color: #2271b1;
    border: 1px solid #ddd;
}

.eredda-pwa-button.secondary:hover {
    background: #f0f0f1;
    border-color: #999;
}

/* PWA Form Elements */
.eredda-pwa-form-group {
    margin-bottom: 16px;
}

.eredda-pwa-form-group label {
    display: block;
    margin-bottom: 4px;
    font-weight: 500;
    color: #1d2327;
}

.eredda-pwa-form-group input,
.eredda-pwa-form-group select,
.eredda-pwa-form-group textarea {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    transition: border-color 0.2s;
}

.eredda-pwa-form-group input:focus,
.eredda-pwa-form-group select:focus,
.eredda-pwa-form-group textarea:focus {
    outline: none;
    border-color: #2271b1;
    box-shadow: 0 0 0 1px #2271b1;
}

/* PWA Responsive Design */
@media (max-width: 767px) {
    .eredda-pwa-content {
        padding: 12px;
        padding-bottom: 80px; /* Account for bottom navigation */
    }
    
    .eredda-pwa-card {
        padding: 12px;
        margin-bottom: 12px;
    }
    
    .eredda-pwa-button {
        width: 100%;
        margin-bottom: 8px;
    }
}

/* PWA Dark Mode Support */
@media (prefers-color-scheme: dark) {
    .eredda-pwa-app {
        background: #1d2327;
        color: #f0f0f1;
    }
    
    .eredda-pwa-card {
        background: #2c3338;
        border-color: #3c434a;
        color: #f0f0f1;
    }
    
    .eredda-pwa-card h3 {
        color: #f0f0f1;
    }
    
    .eredda-pwa-nav {
        background: #2c3338;
        border-color: #3c434a;
    }
    
    .eredda-pwa-nav-item {
        color: #a7aaad;
    }
    
    .eredda-pwa-nav-item:hover,
    .eredda-pwa-nav-item.active {
        color: #72aee6;
        background: #043959;
    }
}

/* PWA Print Styles */
@media print {
    .eredda-pwa-install-prompt,
    .eredda-pwa-notification,
    .eredda-connection-status,
    .eredda-pwa-nav {
        display: none !important;
    }
} 