/**
 * ESGFlux Frontend Styles - Compatible Version
 * Version: 2.0.0
 * Description: Styles for all frontend components of ESGFlux plugin
 * Note: This version avoids CSS Grid repeat() function for better compatibility
 */

/* ==========================================================================
   Base Styles
   ========================================================================== */

.esgflux-dashboard,
.esgflux-content {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
    color: #333;
}

.esgflux-dashboard *,
.esgflux-content * {
    box-sizing: border-box;
}

/* ==========================================================================
   Dashboard Layout
   ========================================================================== */

.esgflux-dashboard {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

@media (max-width: 768px) {
    .esgflux-dashboard {
        padding: 15px;
    }
}

/* ==========================================================================
   CTA Banner
   ========================================================================== */

.esgflux-cta-banner {
    background: linear-gradient(135deg, #2E7D32 0%, #1B5E20 100%);
    color: white;
    padding: 40px;
    border-radius: 12px;
    text-align: center;
    margin-bottom: 30px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    position: relative;
    overflow: hidden;
}

.esgflux-cta-banner::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 70%);
    transform: rotate(45deg);
}

.esgflux-cta-banner h2 {
    margin: 0 0 15px 0;
    font-size: 32px;
    font-weight: 700;
    position: relative;
}

.esgflux-cta-banner p {
    font-size: 18px;
    margin-bottom: 25px;
    opacity: 0.95;
    position: relative;
}

/* ==========================================================================
   Buttons
   ========================================================================== */

.esgflux-button {
    display: inline-block;
    padding: 12px 24px;
    border-radius: 6px;
    text-decoration: none;
    font-weight: 600;
    font-size: 16px;
    transition: all 0.3s ease;
    cursor: pointer;
    border: none;
    position: relative;
    z-index: 1;
}

.esgflux-button-primary {
    background: white;
    color: #2E7D32;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.esgflux-button-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.esgflux-button-secondary {
    background: #f5f5f5;
    color: #333;
    border: 1px solid #e0e0e0;
}

.esgflux-button-secondary:hover {
    background: #e8e8e8;
    border-color: #ccc;
}

/* ==========================================================================
   Subscription Info
   ========================================================================== */

.esgflux-subscription-info {
    background: #E8F5E9;
    border: 1px solid #4CAF50;
    border-radius: 8px;
    padding: 15px 20px;
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.esgflux-badge {
    background: #4CAF50;
    color: white;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: bold;
}

/* ==========================================================================
   Jurisdiction Selector
   ========================================================================== */

.esgflux-jurisdiction-selector {
    background: #f8f9fa;
    padding: 25px;
    border-radius: 8px;
    margin-bottom: 30px;
}

.esgflux-jurisdiction-selector h3 {
    margin: 0 0 15px 0;
    color: #333;
}

.jurisdiction-toggles {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin-top: 15px;
}

.jurisdiction-toggle {
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    padding: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1 1 200px;
    min-width: 200px;
}

.jurisdiction-toggle:hover {
    border-color: #2E7D32;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.jurisdiction-toggle.active {
    background: #E8F5E9;
    border-color: #2E7D32;
}

.jurisdiction-toggle .flag {
    font-size: 24px;
}

.jurisdiction-toggle .name {
    flex: 1;
    font-weight: 600;
}

.jurisdiction-toggle .count {
    font-size: 12px;
    color: #666;
}

.jurisdiction-toggle .status-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #ccc;
}

.jurisdiction-toggle.active .status-indicator {
    background: #4CAF50;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(76, 175, 80, 0.7);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(76, 175, 80, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(76, 175, 80, 0);
    }
}

/* ==========================================================================
   Statistics Grid
   ========================================================================== */

.esgflux-stats-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    margin: 20px 0;
}

.esgflux-stat-card {
    background: #f5f5f5;
    padding: 25px;
    border-radius: 8px;
    text-align: center;
    transition: transform 0.3s ease;
    flex: 1 1 200px;
    min-width: 200px;
}

.esgflux-stat-card:hover {
    transform: translateY(-2px);
}

.esgflux-stat-number {
    font-size: 36px;
    font-weight: bold;
    color: #2E7D32;
    margin: 0;
}

.esgflux-stat-label {
    font-size: 14px;
    color: #666;
    margin: 5px 0 0 0;
}

.esgflux-stat-detail {
    font-size: 12px;
    color: #999;
    margin-top: 5px;
}

.jurisdiction-stat {
    position: relative;
}

.jurisdiction-flag {
    position: absolute;
    top: 10px;
    right: 10px;
    font-size: 20px;
    opacity: 0.3;
}

/* ==========================================================================
   Compliance Calendar
   ========================================================================== */

.esgflux-compliance-calendar {
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 25px;
    margin: 30px 0;
}

.esgflux-compliance-calendar h2 {
    margin: 0 0 20px 0;
    color: #333;
}

.deadline-timeline {
    margin-top: 20px;
}

.deadline-item {
    display: flex;
    gap: 20px;
    padding: 20px;
    border-left: 4px solid #e0e0e0;
    margin-bottom: 20px;
    transition: all 0.3s ease;
    border-radius: 0 8px 8px 0;
}

.deadline-item:hover {
    background: #f9f9f9;
}

.deadline-item.urgent {
    border-color: #d32f2f;
    background: #ffebee;
}

.deadline-item.soon {
    border-color: #FFA726;
    background: #fff3e0;
}

.deadline-item.future {
    border-color: #66BB6A;
    background: #f1f8f4;
}

.deadline-date {
    text-align: center;
    min-width: 60px;
}

.deadline-date .month {
    display: block;
    font-size: 12px;
    text-transform: uppercase;
    color: #666;
}

.deadline-date .day {
    display: block;
    font-size: 24px;
    font-weight: bold;
}

.deadline-content {
    flex: 1;
}

.deadline-content h4 {
    margin: 0 0 8px 0;
    font-size: 16px;
}

.deadline-content p {
    margin: 0 0 8px 0;
    color: #666;
}

.days-remaining {
    font-size: 12px;
    font-weight: 600;
    color: #666;
}

/* ==========================================================================
   Update Filters
   ========================================================================== */

.update-filters {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.filter-pill {
    padding: 6px 16px;
    border: 1px solid #ddd;
    background: white;
    border-radius: 20px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.filter-pill:hover {
    border-color: #2E7D32;
    background: #f5f5f5;
}

.filter-pill.active {
    background: #2E7D32;
    color: white;
    border-color: #2E7D32;
}

/* ==========================================================================
   Update Cards
   ========================================================================== */

.esgflux-updates-list {
    margin: 20px 0;
}

.esgflux-update-card {
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 15px;
    position: relative;
    transition: all 0.3s ease;
}

.esgflux-update-card:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transform: translateY(-1px);
}

.esgflux-update-card.filtered-out {
    opacity: 0.3;
    transform: scale(0.95);
}

.esgflux-importance-high {
    border-left: 4px solid #d32f2f;
}

.esgflux-importance-medium {
    border-left: 4px solid #FFA726;
}

.esgflux-importance-low {
    border-left: 4px solid #66BB6A;
}

.esgflux-update-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 10px;
}

.esgflux-update-header h3 {
    margin: 0;
    font-size: 18px;
    color: #333;
    flex: 1;
    padding-right: 20px;
}

.esgflux-update-date {
    font-size: 12px;
    color: #999;
    white-space: nowrap;
}

.esgflux-update-content {
    margin: 15px 0;
}

.esgflux-update-content p {
    margin: 0;
    color: #666;
    line-height: 1.6;
}

.esgflux-update-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 15px;
}

.esgflux-source {
    font-size: 14px;
    color: #666;
    display: flex;
    align-items: center;
    gap: 5px;
}

.esgflux-read-more {
    color: #2E7D32;
    text-decoration: none;
    font-weight: 500;
    font-size: 14px;
    transition: color 0.3s ease;
}

.esgflux-read-more:hover {
    color: #1B5E20;
    text-decoration: underline;
}

.esgflux-alert-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    background: #d32f2f;
    color: white;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: bold;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        transform: translateX(20px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* ==========================================================================
   Load More Button
   ========================================================================== */

.esgflux-load-more {
    text-align: center;
    margin: 30px 0;
}

.esgflux-load-more button {
    padding: 12px 30px;
    font-size: 16px;
}

/* ==========================================================================
   Quick Actions Grid
   ========================================================================== */

.esgflux-quick-actions {
    margin: 40px 0;
}

.esgflux-quick-actions h3 {
    margin-bottom: 20px;
}

.esgflux-actions-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin-top: 15px;
}

.esgflux-action-card {
    background: #f5f5f5;
    padding: 20px;
    border-radius: 8px;
    text-align: center;
    text-decoration: none;
    color: #333;
    transition: all 0.3s ease;
    border: 1px solid transparent;
    flex: 1 1 150px;
    min-width: 150px;
}

.esgflux-action-card:hover {
    background: #e8e8e8;
    transform: translateY(-2px);
    border-color: #2E7D32;
}

.esgflux-action-card .dashicons {
    font-size: 28px;
    display: block;
    margin-bottom: 8px;
    color: #2E7D32;
}

/* ==========================================================================
   Modal Styles
   ========================================================================== */

.esgflux-modal {
    position: fixed;
    z-index: 10000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: none;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.esgflux-modal-content {
    background-color: white;
    margin: 5% auto;
    padding: 30px;
    border-radius: 12px;
    width: 90%;
    max-width: 600px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.3);
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.esgflux-close {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.3s ease;
}

.esgflux-close:hover,
.esgflux-close:focus {
    color: #000;
}

/* ==========================================================================
   Form Styles
   ========================================================================== */

.esgflux-form-group {
    margin-bottom: 20px;
}

.esgflux-form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #333;
}

.esgflux-form-group select,
.esgflux-form-group input[type="text"],
.esgflux-form-group input[type="email"] {
    width: 100%;
    padding: 10px 15px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 16px;
    transition: border-color 0.3s ease;
}

.esgflux-form-group select:focus,
.esgflux-form-group input[type="text"]:focus,
.esgflux-form-group input[type="email"]:focus {
    outline: none;
    border-color: #2E7D32;
}

.esgflux-checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.esgflux-checkbox-group label {
    display: flex;
    align-items: center;
    font-weight: normal;
    cursor: pointer;
}

.esgflux-checkbox-group input[type="checkbox"] {
    margin-right: 8px;
}

/* ==========================================================================
   Subscribe Form
   ========================================================================== */

.esgflux-subscribe-form {
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 30px;
    max-width: 500px;
    margin: 0 auto;
}

.esgflux-subscribe-form h3 {
    margin-top: 0;
    color: #333;
}

.jurisdiction-selection {
    margin: 20px 0;
}

.jurisdiction-selection label {
    display: flex;
    align-items: center;
    padding: 10px;
    margin: 5px 0;
    background: #f9f9f9;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.3s ease;
}

.jurisdiction-selection label:hover {
    background: #f0f0f0;
}

.jurisdiction-selection input[type="checkbox"] {
    margin-right: 10px;
}

/* ==========================================================================
   Notifications
   ========================================================================== */

.esgflux-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 15px 20px;
    border-radius: 6px;
    color: white;
    z-index: 10001;
    display: none;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    animation: slideInRight 0.3s ease;
}

@keyframes slideInRight {
    from {
        transform: translateX(100px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.esgflux-notification-success {
    background: #4CAF50;
}

.esgflux-notification-error {
    background: #f44336;
}

.esgflux-new-update-banner {
    background: #2196F3;
    color: white;
    padding: 15px 20px;
    text-align: center;
    display: none;
    margin-bottom: 20px;
    border-radius: 6px;
    animation: slideDown 0.5s ease;
}

.esgflux-new-update-banner button {
    background: white;
    color: #2196F3;
    border: none;
    padding: 5px 15px;
    border-radius: 4px;
    margin-left: 15px;
    cursor: pointer;
    font-weight: 600;
}

/* ==========================================================================
   Highlight Animation
   ========================================================================== */

.esgflux-highlight {
    animation: highlight 3s ease-in-out;
}

@keyframes highlight {
    0% { background-color: #FFF3E0; }
    100% { background-color: transparent; }
}

/* ==========================================================================
   Responsive Design
   ========================================================================== */

@media (max-width: 768px) {
    .esgflux-update-header {
        flex-direction: column;
    }
    
    .esgflux-update-date {
        margin-top: 5px;
    }
    
    .esgflux-update-footer {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .deadline-item {
        flex-direction: column;
        text-align: center;
    }
    
    .esgflux-modal-content {
        width: 95%;
        padding: 20px;
    }
    
    .jurisdiction-toggle {
        min-width: 100%;
    }
}

@media (max-width: 480px) {
    .update-filters {
        flex-direction: column;
        width: 100%;
    }
    
    .filter-pill {
        width: 100%;
        text-align: center;
    }
    
    .esgflux-cta-banner {
        padding: 25px 20px;
    }
    
    .esgflux-cta-banner h2 {
        font-size: 24px;
    }
    
    .esgflux-cta-banner p {
        font-size: 16px;
    }
    
    .esgflux-action-card {
        min-width: calc(50% - 8px);
    }
}

/* ==========================================================================
   Loading States
   ========================================================================== */

.esgflux-loading {
    text-align: center;
    padding: 40px;
}

.esgflux-loading::after {
    content: '';
    display: inline-block;
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #2E7D32;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ==========================================================================
   Empty States
   ========================================================================== */

.esgflux-no-updates {
    text-align: center;
    padding: 60px 20px;
    color: #999;
}

.esgflux-no-updates::before {
    content: '📭';
    display: block;
    font-size: 48px;
    margin-bottom: 20px;
}

/* ==========================================================================
   Print Styles
   ========================================================================== */

@media print {
    .esgflux-button,
    .esgflux-actions-grid,
    .esgflux-load-more,
    .update-filters,
    .jurisdiction-toggles {
        display: none !important;
    }
    
    .esgflux-update-card {
        break-inside: avoid;
        page-break-inside: avoid;
    }
}