* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f5f5f5;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

header {
    text-align: center;
    margin-bottom: 40px;
    padding: 40px 20px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

header h1 {
    color: #005a9c;
    margin-bottom: 10px;
    font-size: 2.5em;
}

header p {
    color: #666;
    font-size: 1.1em;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 10px 16px;
    margin: 2px;
    font-size: 14px;
    font-weight: 500;
    line-height: 1.5;
    text-align: center;
    text-decoration: none;
    white-space: nowrap;
    vertical-align: middle;
    cursor: pointer;
    border: 1px solid transparent;
    border-radius: 4px;
    transition: all 0.2s ease-in-out;
    user-select: none;
}

.btn:hover {
    text-decoration: none;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.btn:active {
    transform: translateY(0);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.btn-primary {
    color: white;
    background-color: #005a9c;
    border-color: #005a9c;
}

.btn-primary:hover {
    background-color: #004a7c;
    border-color: #004a7c;
}

.btn-secondary {
    color: #005a9c;
    background-color: white;
    border-color: #005a9c;
}

.btn-secondary:hover {
    color: white;
    background-color: #005a9c;
    border-color: #005a9c;
}

.btn-success {
    color: white;
    background-color: #28a745;
    border-color: #28a745;
}

.btn-success:hover {
    background-color: #218838;
    border-color: #1e7e34;
}

.text-muted {
    color: #6c757d;
    font-style: italic;
}

/* Forms */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    color: #555;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 12px;
    border: 2px solid #ddd;
    border-radius: 4px;
    font-size: 16px;
    transition: border-color 0.3s ease;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #005a9c;
    box-shadow: 0 0 0 2px rgba(0, 90, 156, 0.1);
}

.input-group {
    display: flex;
    gap: 10px;
    align-items: flex-start;
}

.input-group input {
    flex: 1;
}

#postal-form {
    background: white;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    max-width: 600px;
    margin: 0 auto;
}

/* Buttons */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 600;
    text-decoration: none;
    display: inline-block;
    transition: all 0.3s ease;
}

.btn-primary {
    background-color: #005a9c;
    color: white;
}

.btn-primary:hover {
    background-color: #004a7c;
    transform: translateY(-1px);
}

.btn-secondary {
    background-color: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background-color: #5a6268;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* Loading Spinner */
.loading {
    text-align: center;
    padding: 40px;
}

.spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid #005a9c;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

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

/* Error Messages */
.error-message {
    background-color: #f8d7da;
    color: #721c24;
    padding: 15px;
    border-radius: 4px;
    margin: 20px 0;
    border: 1px solid #f5c6cb;
}

/* Success Messages */
.success-message {
    background-color: #d4edda;
    color: #155724;
    padding: 15px;
    border-radius: 4px;
    margin: 20px 0;
    border: 1px solid #c3e6cb;
}

/* Representatives Section */
#representatives-section {
    margin-top: 40px;
}

.location-info {
    background: white;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 30px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.location-info h3 {
    color: #005a9c;
    margin-bottom: 10px;
}

.rep-category {
    margin-bottom: 40px;
    background: white;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    /* Prevent width changes when inline composer is added */
    position: relative;
    width: 100%;
    box-sizing: border-box;
}

.rep-category h3 {
    color: #005a9c;
    margin: 0 0 20px 0;
    padding-bottom: 10px;
    border-bottom: 2px solid #e9ecef;
}

.rep-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
}

.rep-card {
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 20px;
    background: #fafafa;
    transition: transform 0.2s, box-shadow 0.2s;
    display: flex;
    gap: 20px;
    align-items: flex-start;
}

.rep-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.rep-photo {
    flex-shrink: 0;
    width: 80px;
    height: 80px;
    position: relative;
}

.rep-photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
    border: 2px solid #005a9c;
}

.rep-photo-fallback {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: linear-gradient(135deg, #005a9c, #007acc);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 1.2em;
    border: 2px solid #005a9c;
}

.rep-content {
    flex: 1;
    min-width: 0;
}

.rep-card h4 {
    color: #005a9c;
    margin-bottom: 10px;
    font-size: 1.2em;
}

.rep-card .rep-info {
    margin-bottom: 15px;
}

.rep-card .rep-info p {
    margin: 5px 0;
    color: #666;
}

.rep-card .rep-info strong {
    color: #333;
}

.rep-card .rep-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.call-representative {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.call-representative:hover {
    background-color: #218838;
    border-color: #1e7e34;
}

/* Inline Email Composer Styles */
.inline-email-composer {
    margin-top: 20px;
    padding: 20px;
    background: white;
    border: 2px solid #005a9c;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    overflow: hidden;
    max-height: 0;
    opacity: 0;
    transition: max-height 0.4s ease, opacity 0.3s ease, margin-top 0.4s ease, padding 0.4s ease;
    /* Ensure it's not affected by any parent grid/flex container */
    width: 100% !important;
    max-width: none !important;
    min-width: 0 !important;
    grid-column: 1 / -1; /* Span full width if inside a grid */
    display: block !important;
    box-sizing: border-box !important;
}

.inline-email-composer.active {
    max-height: 2000px;
    opacity: 1;
    margin-top: 20px;
    padding: 20px;
}

.inline-email-composer.closing {
    max-height: 0;
    opacity: 0;
    margin-top: 0;
    padding: 0 20px;
}

.inline-email-composer .composer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #e9ecef;
}

.inline-email-composer .composer-header h3 {
    color: #005a9c;
    margin: 0;
    font-size: 1.3em;
}

.inline-email-composer .close-btn {
    font-size: 24px;
    font-weight: bold;
    cursor: pointer;
    color: #999;
    transition: color 0.3s ease;
    background: none;
    border: none;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.inline-email-composer .close-btn:hover {
    color: #333;
}

.inline-email-composer .composer-body {
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        transform: translateY(-20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.inline-email-composer .email-preview-details {
    background-color: #f8f9fa;
    padding: 15px;
    border-radius: 6px;
    border: 1px solid #e9ecef;
    margin-bottom: 20px;
}

.inline-email-composer .detail-row {
    margin-bottom: 8px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.inline-email-composer .detail-row:last-child {
    margin-bottom: 0;
}

.inline-email-composer .detail-row strong {
    color: #495057;
    min-width: 90px;
    flex-shrink: 0;
}

.inline-email-composer .detail-row span {
    color: #333;
    word-break: break-word;
}

.inline-email-composer .email-preview-content {
    background-color: white;
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 20px;
    max-height: 400px;
    overflow-y: auto;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
}

/* Wrapper for sanitized email HTML to prevent it affecting parent page */
.inline-email-composer .email-preview-body {
    max-width: 600px;
    margin: 0 auto;
    width: 100%;
    box-sizing: border-box;
}

.inline-email-composer .email-preview-content p {
    margin-bottom: 12px;
}

.inline-email-composer .email-preview-content p:last-child {
    margin-bottom: 0;
}

/* Ensure all inline composer child elements respect full width */
.inline-email-composer .composer-header,
.inline-email-composer .composer-body,
.inline-email-composer .recipient-info,
.inline-email-composer .inline-email-form,
.inline-email-composer .form-group,
.inline-email-composer .form-actions,
.inline-email-composer .email-preview-details,
.inline-email-composer .email-preview-content {
    width: 100%;
    max-width: none;
    box-sizing: border-box;
}

.inline-email-composer .form-group input,
.inline-email-composer .form-group textarea {
    width: 100%;
    max-width: none;
    box-sizing: border-box;
}

/* Modal Styles */
.modal {
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    box-sizing: border-box;
}

.modal-content {
    background-color: white;
    border-radius: 8px;
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid #ddd;
}

.modal-header h3 {
    color: #005a9c;
    margin: 0;
}

.close-btn {
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    color: #999;
    transition: color 0.3s ease;
}

.close-btn:hover {
    color: #333;
}

.modal-body {
    padding: 20px;
}

.recipient-info {
    background-color: #f8f9fa;
    padding: 10px;
    border-radius: 4px;
    margin-bottom: 10px;
    border-left: 4px solid #005a9c;
}

.form-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 20px;
}

.char-counter {
    color: #666;
    font-size: 0.9em;
    text-align: right;
    display: block;
    margin-top: 5px;
}

/* Email Preview Modal Styles */
.preview-modal {
    max-width: 800px;
    max-height: 95vh;
}

.preview-modal .modal-body {
    max-height: calc(95vh - 120px);
    overflow-y: auto;
}

.preview-section {
    margin-bottom: 24px;
}

.preview-section h4 {
    color: #005a9c;
    margin-bottom: 12px;
    font-size: 1.1em;
    font-weight: 600;
}

.email-details {
    background-color: #f8f9fa;
    padding: 16px;
    border-radius: 6px;
    border: 1px solid #e9ecef;
}

.detail-row {
    margin-bottom: 8px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.detail-row:last-child {
    margin-bottom: 0;
}

.detail-row strong {
    color: #495057;
    min-width: 60px;
    flex-shrink: 0;
}

.detail-row span {
    color: #333;
    word-break: break-word;
}

.email-preview-content {
    background-color: white;
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 20px;
    max-height: 400px;
    overflow-y: auto;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
}

.email-preview-content p {
    margin-bottom: 12px;
}

.email-preview-content p:last-child {
    margin-bottom: 0;
}

.modal-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    align-items: center;
    padding-top: 20px;
    border-top: 1px solid #e9ecef;
    margin-top: 24px;
}

.email-details {
    background-color: #f8f9fa;
    padding: 16px;
    border-radius: 6px;
    border: 1px solid #e9ecef;
}

.detail-row {
    margin-bottom: 8px;
    display: flex;
    flex-wrap: wrap;
}

.detail-row:last-child {
    margin-bottom: 0;
}

.detail-row strong {
    min-width: 60px;
    color: #495057;
    font-weight: 600;
}

.detail-row span {
    color: #212529;
    word-break: break-word;
}

.email-preview-content {
    background-color: #ffffff;
    border-radius: 6px;
    min-height: 200px;
    max-height: 600px;
    overflow: hidden;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
}

/* Style for iframe email previews */
.email-preview-content iframe {
    display: block;
    width: 100%;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    background-color: #ffffff;
}

/* Style for text email previews */
.email-preview-content pre {
    margin: 0;
    padding: 20px;
    background-color: #f8f9fa;
    border-radius: 6px;
    border: 1px solid #dee2e6;
    white-space: pre-wrap;
    font-family: inherit;
    overflow-x: auto;
}

.email-preview-content img {
    max-width: 100%;
    height: auto;
}

.email-preview-content a {
    color: #007bff;
    text-decoration: underline;
}

.modal-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    margin-top: 24px;
    padding-top: 16px;
    border-top: 1px solid #e9ecef;
}

.btn.btn-outline {
    background-color: transparent;
    border: 1px solid #6c757d;
    color: #6c757d;
}

.btn.btn-outline:hover {
    background-color: #6c757d;
    color: white;
}

/* Message Display */
.message-display {
    position: fixed;
    top: 20px;
    right: 20px;
    max-width: 400px;
    padding: 15px;
    border-radius: 4px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 1001;
}

.message-display.success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.message-display.error {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* Footer */
footer {
    margin-top: 60px;
    text-align: center;
    padding: 30px 20px;
    color: #666;
    border-top: 1px solid #ddd;
}

footer a {
    color: #005a9c;
    text-decoration: none;
}

footer a:hover {
    text-decoration: underline;
}

.footer-actions {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #eee;
}

.footer-actions .btn {
    font-size: 12px;
    padding: 6px 12px;
    opacity: 0.8;
    transition: opacity 0.2s ease;
}

.footer-actions .btn:hover {
    opacity: 1;
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 10px;
    }
    
    header h1 {
        font-size: 2em;
    }
    
    .input-group {
        flex-direction: column;
    }
    
    .rep-cards {
        grid-template-columns: 1fr;
    }
    
    .form-actions {
        flex-direction: column-reverse;
    }
    
    .modal-content {
        width: 95%;
        margin: 10px;
    }
    
    .message-display {
        left: 10px;
        right: 10px;
        max-width: none;
    }
}

@media (max-width: 480px) {
    .rep-card {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }
    
    .rep-photo {
        margin-bottom: 15px;
    }
    
    .rep-card .rep-actions {
        flex-direction: column;
        align-items: center;
        justify-content: center;
        width: 100%;
    }
    
    .rep-card .rep-actions .btn {
        font-size: 14px;
        padding: 12px 20px;
        width: 100%;
        margin: 4px 0;
        text-align: center;
        justify-content: center;
        display: flex;
        align-items: center;
    }
}

/* Map Styles */
.map-header {
    text-align: center;
    margin-bottom: 20px;
}

.map-header h2 {
    color: #005a9c;
    margin: 0;
}

.postal-input-section {
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
}

.postal-input-section .form-group {
    margin-bottom: 0;
}

.postal-input-section .input-group {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
}

.postal-input-section .input-group input {
    flex: 1;
    min-width: 200px;
}

.map-container {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    margin-bottom: 20px;
    position: relative;
}

#main-map {
    height: 400px;
    width: 100%;
    z-index: 1;
}

/* Map message overlay */
.map-message {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1000;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 15px 25px;
    border-radius: 8px;
    font-size: 14px;
    text-align: center;
    max-width: 300px;
}

/* Office marker styles */
.office-marker {
    background: none;
    border: none;
}

.office-marker .marker-content {
    background: white;
    border: 3px solid #005a9c;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    transition: all 0.2s ease;
}

.office-marker.federal .marker-content {
    border-color: #d32f2f;
    background: #ffebee;
}

.office-marker.provincial .marker-content {
    border-color: #1976d2;
    background: #e3f2fd;
}

.office-marker.municipal .marker-content {
    border-color: #388e3c;
    background: #e8f5e8;
}

.office-marker:hover .marker-content {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

/* Office popup styles */
.leaflet-popup-content-wrapper {
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.office-popup-content {
    font-family: inherit;
    max-width: 280px;
}

.office-popup-content .rep-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding-bottom: 12px;
    border-bottom: 2px solid #eee;
    margin-bottom: 12px;
}

.office-popup-content .rep-header.federal {
    border-bottom-color: #d32f2f;
}

.office-popup-content .rep-header.provincial {
    border-bottom-color: #1976d2;
}

.office-popup-content .rep-header.municipal {
    border-bottom-color: #388e3c;
}

.office-popup-content .rep-photo-small {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #ddd;
}

.office-popup-content .rep-info h4 {
    margin: 0 0 4px 0;
    color: #333;
    font-size: 16px;
    font-weight: 600;
}

.office-popup-content .rep-level {
    margin: 0 0 2px 0;
    font-size: 12px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.office-popup-content .rep-header.federal .rep-level {
    color: #d32f2f;
}

.office-popup-content .rep-header.provincial .rep-level {
    color: #1976d2;
}

.office-popup-content .rep-header.municipal .rep-level {
    color: #388e3c;
}

.office-popup-content .rep-district {
    margin: 0;
    font-size: 13px;
    color: #666;
}

.office-popup-content .office-details h5 {
    margin: 0 0 8px 0;
    color: #333;
    font-size: 14px;
    font-weight: 600;
}

.office-popup-content .office-details p {
    margin: 0 0 6px 0;
    font-size: 13px;
    line-height: 1.4;
}

.office-popup-content .office-details p:last-child {
    margin-bottom: 0;
}

.office-popup-content .office-details a {
    color: #005a9c;
    text-decoration: none;
}

.office-popup-content .office-details a:hover {
    text-decoration: underline;
}

.office-popup-content .office-actions {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid #eee;
}

.office-popup-content .btn-small {
    padding: 6px 12px;
    font-size: 12px;
    font-weight: 500;
}

.office-popup-content .shared-location-note {
    margin-top: 4px;
}

.office-popup-content .shared-location-note small {
    color: #666;
    font-style: italic;
}

/* Visit office buttons */
.visit-office {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    padding: 8px 12px;
    margin: 3px;
    font-size: 13px;
    line-height: 1.3;
    min-width: 120px;
    max-width: 180px;
    width: 180px;
    text-align: center;
    border: 1px solid #005a9c;
    border-radius: 6px;
    background: white;
    color: #005a9c;
    transition: all 0.2s ease;
    word-wrap: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
    white-space: normal;
}

.visit-office:hover {
    background: #005a9c;
    color: white;
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(0, 90, 156, 0.2);
}

.visit-office .office-location {
    display: block;
    margin-top: 2px;
    font-size: 11px;
    opacity: 0.8;
    font-weight: normal;
    word-wrap: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
    line-height: 1.2;
    white-space: normal;
    width: 100%;
    max-width: 100%;
    overflow: hidden;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
    line-height: 1.4;
}

/* Responsive map styles */
@media (max-width: 768px) {
    .map-header {
        flex-direction: column;
        align-items: stretch;
        text-align: center;
    }
    
    .map-controls {
        justify-content: center;
    }
    
    #main-map {
        height: 300px;
    }
    
    .office-popup-content {
        max-width: 250px;
    }
    
    .office-popup-content .rep-header {
        flex-direction: column;
        text-align: center;
        gap: 8px;
    }
}

@media (max-width: 480px) {
    #main-map {
        height: 250px;
    }
    
    .map-controls {
        flex-direction: column;
    }
    
    .office-popup-content {
        max-width: 220px;
    }
    
    .visit-office {
        max-width: calc(100vw - 40px);
        width: auto;
        min-width: 140px;
        text-align: center;
        justify-content: center;
        align-items: center;
        flex-shrink: 1;
    }
    
    .visit-office .office-location {
        text-align: center;
        width: 100%;
        max-width: 100%;
        overflow: hidden;
        text-overflow: ellipsis;
    }
}

/* ===================================
   CAMPAIGNS GRID STYLES
   =================================== */

#campaigns-section {
    margin-top: 60px;
    padding-top: 40px;
    border-top: 2px solid #e0e0e0;
}

.campaigns-section-header {
    text-align: center;
    margin-bottom: 40px;
}

.campaigns-section-header h2 {
    color: #005a9c;
    font-size: 2em;
    margin-bottom: 10px;
}

.campaigns-section-header p {
    color: #666;
    font-size: 1.1em;
}

#campaigns-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 30px;
    margin: 0 auto;
}

.campaign-card {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    height: 100%;
    outline: none;
}

.campaign-card:hover,
.campaign-card:focus {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(0, 90, 156, 0.2);
}

.campaign-card:focus {
    outline: 2px solid #005a9c;
    outline-offset: 2px;
}

.campaign-card-image {
    width: 100%;
    height: 200px;
    position: relative;
    overflow: hidden;
}

.campaign-card-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.3);
    transition: background 0.3s ease;
}

.campaign-card:hover .campaign-card-overlay {
    background: rgba(0, 0, 0, 0.4);
}

.campaign-card-content {
    padding: 20px;
    display: flex;
    flex-direction: column;
    flex: 1;
}

.campaign-card-title {
    color: #005a9c;
    font-size: 1.4em;
    margin-bottom: 12px;
    font-weight: 600;
    line-height: 1.3;
}

.campaign-card-description {
    color: #555;
    font-size: 0.95em;
    line-height: 1.6;
    margin-bottom: 16px;
    flex: 1;
}

.campaign-card-levels {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 12px;
}

.level-badge {
    background: #e8f4f8;
    color: #005a9c;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.8em;
    font-weight: 500;
}

.campaign-card-stats {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 16px;
}

@media (min-width: 768px) {
    .campaign-card-stats {
        flex-direction: row;
        gap: 12px;
    }
    
    .campaign-card-stat {
        flex: 1;
        margin-bottom: 0;
    }
}

.campaign-card-stat {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px;
    background: #f8f9fa;
    border-radius: 8px;
}

.stat-icon {
    font-size: 1.2em;
}

.stat-value {
    font-size: 1.3em;
    font-weight: 700;
    color: #005a9c;
}

.stat-label {
    font-size: 0.85em;
    color: #666;
}

.campaign-card-social-share {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 0;
    margin-bottom: 8px;
    flex-wrap: wrap;
}

.share-label {
    font-size: 0.85em;
    color: #666;
    font-weight: 500;
    margin-right: 4px;
}

.share-btn {
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    background: #f0f0f0;
    color: #666;
    padding: 6px;
}

.share-btn svg {
    width: 18px;
    height: 18px;
}

.share-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.share-btn:focus {
    outline: 2px solid #005a9c;
    outline-offset: 2px;
}

.share-twitter:hover {
    background: #000000;
    color: white;
}

.share-facebook:hover {
    background: #1877f2;
    color: white;
}

.share-linkedin:hover {
    background: #0077b5;
    color: white;
}

.share-reddit:hover {
    background: #ff4500;
    color: white;
}

.share-email:hover {
    background: #005a9c;
    color: white;
}

.share-copy:hover {
    background: #34a853;
    color: white;
}

.share-feedback {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: #34a853;
    color: white;
    padding: 12px 20px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    font-size: 0.9em;
    font-weight: 500;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.3s ease;
    z-index: 10000;
    pointer-events: none;
}

.share-feedback.show {
    opacity: 1;
    transform: translateY(0);
}

.share-feedback.error {
    background: #dc3545;
}

.campaign-card-action {
    margin-top: auto;
    padding-top: 12px;
    border-top: 1px solid #e0e0e0;
}

.btn-link {
    color: #005a9c;
    font-weight: 600;
    font-size: 0.95em;
    text-decoration: none;
    transition: color 0.2s ease;
}

.campaign-card:hover .btn-link {
    color: #004a7c;
}

.campaigns-loading,
.campaigns-error,
.campaigns-empty {
    text-align: center;
    padding: 60px 20px;
    color: #666;
}

.campaigns-loading .spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #005a9c;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

.campaigns-error {
    color: #d32f2f;
}

.campaigns-empty {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 40px;
}

/* Responsive campaign grid styles */
@media (max-width: 1024px) {
    #campaigns-grid {
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
        gap: 24px;
    }
}

@media (max-width: 768px) {
    #campaigns-section {
        margin-top: 40px;
        padding-top: 30px;
    }

    .campaigns-section-header h2 {
        font-size: 1.75em;
    }

    #campaigns-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .campaign-card-image {
        height: 180px;
    }
}

@media (max-width: 480px) {
    .campaigns-section-header h2 {
        font-size: 1.5em;
    }

    .campaign-card-title {
        font-size: 1.2em;
    }

    .campaign-card-image {
        height: 160px;
    }

    .campaign-card-content {
        padding: 16px;
    }
}
