/**
 * Login Flow Integration Styles
 * Styling for login flow with location detection and municipal access
 */

/* Location-Aware Login Container */
.geo-location-aware-login {
    max-width: 400px;
    margin: 20px auto;
    padding: 20px;
    background: #ffffff;
    border: 1px solid #e1e4e8;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* Location Detection Section */
.location-detection {
    margin-bottom: 20px;
    text-align: center;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 6px;
    border: 1px dashed #d1d5da;
}

.detect-location-btn {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    color: white;
    border: none;
    border-radius: 6px;
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.detect-location-btn:hover {
    background: linear-gradient(135deg, #218838 0%, #1e9a8a 100%);
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(40, 167, 69, 0.3);
}

.detect-location-btn:disabled {
    background: #6c757d;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.location-status {
    margin-top: 10px;
    padding: 8px 12px;
    border-radius: 4px;
    background: #e7f3ff;
    border: 1px solid #b8daff;
    font-size: 13px;
    color: #0c5460;
}

.location-text {
    display: block;
    font-weight: 500;
}

/* Login Form Container */
.login-form-container {
    margin-top: 20px;
}

.login-form-container form {
    margin: 0;
}

.login-form-container label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    color: #333;
    font-size: 14px;
}

.login-form-container input[type="text"],
.login-form-container input[type="password"],
.login-form-container input[type="email"] {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #d1d5da;
    border-radius: 4px;
    font-size: 14px;
    margin-bottom: 15px;
    box-sizing: border-box;
    transition: border-color 0.2s ease;
}

.login-form-container input:focus {
    border-color: #007cba;
    outline: none;
    box-shadow: 0 0 0 1px #007cba;
}

.login-form-container input[type="checkbox"] {
    margin-left: 8px;
}

.login-form-container input[type="submit"] {
    width: 100%;
    background: linear-gradient(135deg, #007cba 0%, #005a87 100%);
    color: white;
    border: none;
    border-radius: 4px;
    padding: 12px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s ease;
}

.login-form-container input[type="submit"]:hover {
    background: linear-gradient(135deg, #005a87 0%, #004666 100%);
}

/* Logged-in Info */
.logged-in-info {
    text-align: center;
    padding: 20px;
    background: #d4edda;
    border: 1px solid #c3e6cb;
    border-radius: 6px;
    color: #155724;
}

.logged-in-info p {
    margin: 0 0 15px;
    font-size: 16px;
    font-weight: 500;
}

.municipal-options {
    margin-top: 15px;
}

/* Municipal Access Container */
.geo-municipal-access {
    max-width: 600px;
    margin: 20px auto;
    padding: 20px;
    background: #ffffff;
    border: 1px solid #e1e4e8;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Municipality Header */
.municipality-header {
    text-align: center;
    margin-bottom: 25px;
    padding-bottom: 20px;
    border-bottom: 1px solid #e1e4e8;
}

.municipality-header h3 {
    margin: 0 0 10px;
    color: #333;
    font-size: 24px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.municipality-header p {
    margin: 0;
    color: #666;
    font-size: 16px;
}

/* Municipal Actions */
.municipal-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
}

.municipal-dashboard-btn {
    background: linear-gradient(135deg, #6f42c1 0%, #5a32a3 100%);
    color: white;
    padding: 12px 24px;
    border-radius: 6px;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
}

.municipal-dashboard-btn:hover {
    background: linear-gradient(135deg, #5a32a3 0%, #4c2a85 100%);
    color: white;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(111, 66, 193, 0.3);
}

/* Municipality Selector */
.municipality-selector {
    text-align: center;
    padding: 30px 20px;
}

.municipality-selector h3 {
    margin: 0 0 20px;
    color: #333;
    font-size: 20px;
}

.municipality-selector select {
    width: 100%;
    max-width: 300px;
    padding: 12px 16px;
    border: 1px solid #d1d5da;
    border-radius: 6px;
    font-size: 16px;
    background: white;
    color: #333;
    cursor: pointer;
}

.municipality-selector select:focus {
    border-color: #007cba;
    outline: none;
    box-shadow: 0 0 0 1px #007cba;
}

/* Municipality Options Container */
.municipality-options-container {
    margin-top: 20px;
    animation: slideIn 0.3s ease;
}

.municipality-card {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 20px;
    text-align: center;
}

.municipality-card h4 {
    margin: 0 0 10px;
    color: #333;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.municipality-card p {
    margin: 0 0 15px;
    color: #666;
    font-size: 14px;
}

.municipality-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
}

.access-municipality-btn {
    background: linear-gradient(135deg, #007cba 0%, #005a87 100%);
    color: white;
    padding: 8px 16px;
    border-radius: 4px;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: background 0.3s ease;
}

.access-municipality-btn:hover {
    background: linear-gradient(135deg, #005a87 0%, #004666 100%);
    color: white;
}

.dismiss-municipality-btn {
    background: transparent;
    color: #6c757d;
    border: 1px solid #dee2e6;
    padding: 8px 16px;
    border-radius: 4px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.dismiss-municipality-btn:hover {
    background: #f8f9fa;
    border-color: #adb5bd;
}

/* Notifications */
.geo-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    padding: 12px 20px;
    border-radius: 6px;
    color: white;
    font-weight: 500;
    font-size: 14px;
    max-width: 300px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    display: none;
}

.geo-notification.success {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
}

.geo-notification.error {
    background: linear-gradient(135deg, #dc3545 0%, #c82333 100%);
}

.geo-notification.info {
    background: linear-gradient(135deg, #17a2b8 0%, #138496 100%);
}

.geo-notification.warning {
    background: linear-gradient(135deg, #ffc107 0%, #e0a800 100%);
    color: #212529;
}

/* Current Municipality Indicator */
.current-municipality-indicator {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 8px;
    background: #e7f3ff;
    border: 1px solid #b8daff;
    border-radius: 4px;
    font-size: 12px;
    color: #0c5460;
    margin-left: 10px;
}

.current-municipality-indicator::before {
    content: '🏛️';
    font-size: 10px;
}

/* Active Municipality Styling */
[data-municipality].active-municipality {
    background: #d4edda;
    border-color: #c3e6cb;
    color: #155724;
}

/* RTL Support */
.rtl .geo-location-aware-login,
.rtl .geo-municipal-access {
    direction: rtl;
}

.rtl .municipal-actions {
    flex-direction: row-reverse;
}

.rtl .municipality-actions {
    flex-direction: row-reverse;
}

.rtl .geo-notification {
    right: auto;
    left: 20px;
}

.rtl .current-municipality-indicator {
    margin-left: 0;
    margin-right: 10px;
}

/* Responsive Design */
@media (max-width: 768px) {
    .geo-location-aware-login,
    .geo-municipal-access {
        margin: 10px;
        padding: 15px;
    }
    
    .municipality-header h3 {
        font-size: 20px;
        flex-direction: column;
        gap: 4px;
    }
    
    .municipal-actions {
        flex-direction: column;
        align-items: center;
    }
    
    .municipal-actions .geo-municipal-button,
    .municipal-dashboard-btn {
        width: 100%;
        justify-content: center;
    }
    
    .municipality-actions {
        flex-direction: column;
    }
    
    .municipality-actions .access-municipality-btn,
    .municipality-actions .dismiss-municipality-btn {
        width: 100%;
        text-align: center;
    }
    
    .geo-notification {
        left: 10px;
        right: 10px;
        max-width: none;
    }
}

/* Animation Classes */
@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.slide-in {
    animation: slideIn 0.3s ease;
}

/* Loading States */
.loading-location {
    opacity: 0.7;
}

.loading-location .detect-location-btn {
    position: relative;
}

.loading-location .detect-location-btn::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    margin: auto;
    border: 2px solid transparent;
    border-top-color: #ffffff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    top: 0;
    left: 0;
    bottom: 0;
    right: 0;
}

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

/* WordPress Integration */
.wp-admin .geo-location-aware-login,
.wp-admin .geo-municipal-access {
    font-family: inherit;
}

.wp-admin .geo-location-aware-login input[type="text"],
.wp-admin .geo-location-aware-login input[type="password"],
.wp-admin .geo-location-aware-login input[type="email"] {
    font-size: 14px;
}

/* Accessibility */
.detect-location-btn:focus,
.municipal-dashboard-btn:focus,
.access-municipality-btn:focus,
.dismiss-municipality-btn:focus {
    outline: 2px solid #007cba;
    outline-offset: 2px;
}

.location-status[aria-live="polite"] {
    /* Ensure live regions are accessible to screen readers */
    position: relative;
}

/* Print Styles */
@media print {
    .geo-location-aware-login,
    .geo-municipal-access {
        background: white;
        border: 1px solid #000;
        box-shadow: none;
    }
    
    .detect-location-btn,
    .municipal-dashboard-btn,
    .municipality-actions {
        display: none;
    }
    
    .geo-notification {
        display: none;
    }
}