/* Climate Alerts Africa - Enhanced Frontend Styles */

/* Bell Widget Styles */
.caa-bell-widget {
    position: fixed;
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 9999;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.caa-bell-widget[data-position="right"] {
    left: auto;
    right: 20px;
}

.caa-bell-trigger {
    background: linear-gradient(135deg, #2c5530, #4CAF50);
    color: white;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(44, 85, 48, 0.3);
    position: relative;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: none;
    outline: none;
}

.caa-bell-trigger:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(44, 85, 48, 0.4);
}

.caa-bell-trigger:focus {
    outline: 2px solid #4CAF50;
    outline-offset: 2px;
}

.caa-bell-trigger.caa-subscribed {
    background: linear-gradient(135deg, #4CAF50, #45a049);
    box-shadow: 0 4px 15px rgba(76, 175, 80, 0.4);
}

.caa-bell-icon {
    font-size: 24px;
    animation: bellRing 4s infinite;
}

.caa-bell-trigger.caa-subscribed .caa-bell-icon {
    animation: bellRingSubscribed 6s infinite;
}

@keyframes bellRing {
    0%, 85%, 100% { 
        transform: rotate(0deg); 
    }
    5%, 15% { 
        transform: rotate(-15deg); 
    }
    10%, 20% { 
        transform: rotate(15deg); 
    }
}

@keyframes bellRingSubscribed {
    0%, 90%, 100% { 
        transform: rotate(0deg); 
    }
    2%, 6% { 
        transform: rotate(-10deg); 
    }
    4%, 8% { 
        transform: rotate(10deg); 
    }
}

.caa-bell-pulse {
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    border-radius: 50%;
    border: 2px solid rgba(76, 175, 80, 0.6);
    opacity: 0;
    animation: pulse 2s infinite;
}

.caa-bell-pulse.caa-pulse-subscribed {
    border-color: rgba(255, 193, 7, 0.8);
    animation: pulseSubscribed 3s infinite;
}

@keyframes pulse {
    0% {
        transform: scale(1);
        opacity: 1;
    }
    100% {
        transform: scale(1.3);
        opacity: 0;
    }
}

@keyframes pulseSubscribed {
    0% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.2);
        opacity: 0.7;
    }
    100% {
        transform: scale(1.4);
        opacity: 0;
    }
}

.caa-notification-badge {
    position: absolute;
    top: -8px;
    right: -8px;
    background: #ff4444;
    color: white;
    border-radius: 50%;
    min-width: 24px;
    height: 24px;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    padding: 0 4px;
    box-shadow: 0 2px 8px rgba(255, 68, 68, 0.3);
    animation: badgeBounce 0.5s ease;
}

@keyframes badgeBounce {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.2); }
}

.caa-badge-pulse {
    animation: badgePulse 1s ease-in-out 3;
}

@keyframes badgePulse {
    0% { 
        transform: scale(1);
        background: #ff4444;
    }
    50% { 
        transform: scale(1.1);
        background: #ff6666;
    }
    100% { 
        transform: scale(1);
        background: #ff4444;
    }
}

/* Enhanced Notification Popup */
.caa-notification-popup {
    position: absolute;
    left: 80px;
    top: -300px;
    width: 420px;
    max-height: 600px;
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 16px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15);
    overflow: hidden;
    opacity: 0;
    transform: translateX(-20px) scale(0.95);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.caa-notification-popup[style*="block"] {
    opacity: 1;
    transform: translateX(0) scale(1);
}

.caa-bell-widget[data-position="right"] .caa-notification-popup {
    left: -440px;
}

.caa-popup-header {
    background: linear-gradient(135deg, #2c5530, #4CAF50);
    color: white;
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.caa-popup-header h4 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
}

.caa-close-popup {
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s;
}

.caa-close-popup:hover {
    background: rgba(255, 255, 255, 0.2);
}

.caa-popup-content {
    padding: 24px;
    max-height: 500px;
    overflow-y: auto;
}

/* User Status Section */
.caa-user-status {
    text-align: center;
    padding: 20px;
    color: #666;
}

.caa-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #4CAF50;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-right: 8px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Enhanced Subscription Form */
.caa-subscription-section {
    margin-bottom: 24px;
    padding-bottom: 24px;
    border-bottom: 1px solid #f0f0f0;
}

.caa-subscription-section h5 {
    margin: 0 0 8px 0;
    font-size: 18px;
    color: #2c5530;
    font-weight: 600;
}

.caa-subscription-intro {
    margin: 0 0 20px 0;
    color: #666;
    font-size: 14px;
    line-height: 1.5;
}

.caa-smart-form .caa-form-row {
    margin-bottom: 16px;
}

.caa-smart-form input[type="email"],
.caa-smart-form input[type="text"] {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    box-sizing: border-box;
    font-size: 14px;
    transition: border-color 0.2s;
}

.caa-smart-form input:focus {
    outline: none;
    border-color: #4CAF50;
}

.caa-smart-form small {
    display: block;
    margin-top: 4px;
    color: #666;
    font-size: 12px;
}

.caa-subscribe-btn {
    background: linear-gradient(135deg, #4CAF50, #45a049);
    color: white;
    border: none;
    padding: 14px 20px;
    border-radius: 8px;
    cursor: pointer;
    width: 100%;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.2s;
    position: relative;
}

.caa-subscribe-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(76, 175, 80, 0.3);
}

.caa-subscribe-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* Subscriber Dashboard */
.caa-subscriber-dashboard {
    margin-bottom: 24px;
    padding-bottom: 24px;
    border-bottom: 1px solid #f0f0f0;
}

.caa-welcome-back h5 {
    margin: 0 0 8px 0;
    font-size: 18px;
    color: #2c5530;
    font-weight: 600;
}

.caa-welcome-back p {
    margin: 0 0 20px 0;
    color: #666;
    font-size: 14px;
}

.caa-subscriber-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.caa-action-btn {
    padding: 12px 16px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex: 1;
    min-width: 120px;
}

.caa-action-btn.caa-primary {
    background: linear-gradient(135deg, #4CAF50, #45a049);
    color: white;
}

.caa-action-btn.caa-secondary {
    background: #f8f9fa;
    color: #2c5530;
    border: 1px solid #e0e0e0;
}

.caa-action-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Manage Section */
.caa-manage-section h5 {
    margin: 0 0 20px 0;
    font-size: 18px;
    color: #2c5530;
    font-weight: 600;
}

.caa-manage-section .caa-form-row {
    margin-bottom: 16px;
}

.caa-manage-section label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
    color: #333;
    font-size: 14px;
}

.caa-manage-section input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    box-sizing: border-box;
    font-size: 14px;
}

.caa-manage-section input:focus {
    outline: none;
    border-color: #4CAF50;
}

.caa-manage-section input[readonly] {
    background: #f8f9fa;
    color: #666;
}

.caa-form-actions {
    display: flex;
    gap: 12px;
    margin-top: 20px;
}

/* Recent Alerts Section */
.caa-recent-alerts-section {
    margin-top: 24px;
}

.caa-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.caa-section-header h5 {
    margin: 0;
    font-size: 16px;
    color: #2c5530;
    font-weight: 600;
}

.caa-view-all {
    color: #4CAF50;
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
}

.caa-view-all:hover {
    text-decoration: underline;
}

.caa-alerts-preview {
    max-height: 300px;
    overflow-y: auto;
}

.caa-loading-alerts,
.caa-no-alerts,
.caa-error-alerts {
    text-align: center;
    padding: 20px;
    color: #666;
    font-size: 14px;
}

.caa-alert-preview {
    border-bottom: 1px solid #f0f0f0;
    padding: 16px 0;
    transition: background-color 0.2s;
}

.caa-alert-preview:last-child {
    border-bottom: none;
}

.caa-alert-preview:hover {
    background-color: #f9f9f9;
    margin: 0 -12px;
    padding: 16px 12px;
    border-radius: 8px;
}

.caa-alert-preview-title {
    font-weight: 600;
    margin-bottom: 8px;
    color: #2c5530;
    line-height: 1.4;
    font-size: 14px;
}

.caa-alert-preview-meta {
    color: #666;
    font-size: 12px;
    margin-bottom: 8px;
}

.caa-alert-preview-link {
    color: #4CAF50;
    text-decoration: none;
    font-size: 13px;
    font-weight: 600;
    transition: color 0.2s;
}

.caa-alert-preview-link:hover {
    color: #2c5530;
    text-decoration: underline;
}

/* Message Styles */
.caa-message {
    margin-top: 12px;
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 14px;
    display: none;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.caa-message.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.caa-message.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.caa-message.warning {
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffeaa7;
}

/* Responsive Design */
@media (max-width: 768px) {
    .caa-bell-widget {
        left: 10px;
    }
    
    .caa-bell-widget[data-position="right"] {
        right: 10px;
    }
    
    .caa-notification-popup {
        width: 340px;
        left: 70px;
        top: -280px;
    }
    
    .caa-bell-widget[data-position="right"] .caa-notification-popup {
        left: -360px;
    }
    
    .caa-subscriber-actions {
        flex-direction: column;
    }
    
    .caa-form-actions {
        flex-direction: column;
    }
}

@media (max-width: 480px) {
    .caa-notification-popup {
        width: 300px;
        left: 70px;
    }
    
    .caa-bell-widget[data-position="right"] .caa-notification-popup {
        left: -320px;
    }
    
    .caa-popup-content {
        padding: 16px;
    }
    
    .caa-bell-trigger {
        width: 50px;
        height: 50px;
    }
    
    .caa-bell-icon {
        font-size: 20px;
    }
}

/* Accessibility Improvements */
@media (prefers-reduced-motion: reduce) {
    .caa-bell-icon {
        animation: none;
    }
    
    .caa-bell-trigger,
    .caa-notification-popup,
    .caa-alert-preview {
        transition: none;
    }
    
    .caa-bell-pulse {
        animation: none;
    }
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
    .caa-bell-trigger {
        border: 2px solid white;
    }
    
    .caa-notification-popup {
        border: 2px solid #000;
    }
}

/* Print Styles */
@media print {
    .caa-bell-widget {
        display: none;
    }
}