/**
 * Frontend Styles for Email Header Analyzer
 * Modern, responsive, card-based design
 */

:root {
    --eha-primary: #2563eb;
    --eha-primary-dark: #1d4ed8;
    --eha-success: #10b981;
    --eha-warning: #f59e0b;
    --eha-danger: #ef4444;
    --eha-info: #3b82f6;
    --eha-gray-50: #f9fafb;
    --eha-gray-100: #f3f4f6;
    --eha-gray-200: #e5e7eb;
    --eha-gray-300: #d1d5db;
    --eha-gray-400: #9ca3af;
    --eha-gray-500: #6b7280;
    --eha-gray-600: #4b5563;
    --eha-gray-700: #374151;
    --eha-gray-800: #1f2937;
    --eha-gray-900: #111827;
    --eha-white: #ffffff;
    --eha-border-radius: 8px;
    --eha-shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --eha-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
    --eha-shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --eha-shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
}

/* Container */
.eha-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    color: var(--eha-gray-900);
}

/* Header */
.eha-header {
    text-align: center;
    margin-bottom: 30px;
}

.eha-header h1 {
    font-size: 2rem;
    font-weight: 700;
    color: var(--eha-gray-900);
    margin-bottom: 10px;
}

.eha-header p {
    color: var(--eha-gray-600);
    font-size: 1rem;
}

/* Card */
.eha-card {
    background: var(--eha-white);
    border-radius: var(--eha-border-radius);
    box-shadow: var(--eha-shadow);
    padding: 24px;
    margin-bottom: 20px;
}

.eha-card-header {
    border-bottom: 1px solid var(--eha-gray-200);
    padding-bottom: 16px;
    margin-bottom: 20px;
}

.eha-card-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--eha-gray-900);
    margin: 0;
}

.eha-card-body {
    padding: 0;
}

/* Input Area */
.eha-input-area {
    position: relative;
}

.eha-textarea {
    width: 100%;
    min-height: 250px;
    padding: 16px;
    border: 2px solid var(--eha-gray-300);
    border-radius: var(--eha-border-radius);
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.875rem;
    resize: vertical;
    transition: border-color 0.2s;
}

.eha-textarea:focus {
    outline: none;
    border-color: var(--eha-primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.eha-textarea::placeholder {
    color: var(--eha-gray-400);
}

/* File Upload */
.eha-file-upload {
    margin-top: 16px;
    padding: 32px;
    border: 2px dashed var(--eha-gray-300);
    border-radius: var(--eha-border-radius);
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
}

.eha-file-upload:hover {
    border-color: var(--eha-primary);
    background-color: var(--eha-gray-50);
}

.eha-file-upload.dragover {
    border-color: var(--eha-primary);
    background-color: rgba(37, 99, 235, 0.05);
}

.eha-file-upload-icon {
    font-size: 2.5rem;
    color: var(--eha-gray-400);
    margin-bottom: 12px;
}

.eha-file-upload-text {
    color: var(--eha-gray-600);
    margin-bottom: 8px;
}

.eha-file-upload-hint {
    font-size: 0.875rem;
    color: var(--eha-gray-500);
}

/* Buttons */
.eha-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 20px;
    font-size: 0.9375rem;
    font-weight: 500;
    border-radius: var(--eha-border-radius);
    border: none;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    gap: 8px;
}

.eha-btn-primary {
    background-color: var(--eha-primary);
    color: var(--eha-white);
}

.eha-btn-primary:hover {
    background-color: var(--eha-primary-dark);
}

.eha-btn-secondary {
    background-color: var(--eha-gray-200);
    color: var(--eha-gray-900);
}

.eha-btn-secondary:hover {
    background-color: var(--eha-gray-300);
}

.eha-btn-success {
    background-color: var(--eha-success);
    color: var(--eha-white);
}

.eha-btn-danger {
    background-color: var(--eha-danger);
    color: var(--eha-white);
}

.eha-btn-large {
    padding: 14px 28px;
    font-size: 1rem;
}

.eha-btn-block {
    display: flex;
    width: 100%;
}

.eha-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Button Group */
.eha-btn-group {
    display: flex;
    gap: 12px;
    margin-top: 20px;
}

/* Loading Spinner */
.eha-spinner {
    display: inline-block;
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: var(--eha-white);
    animation: eha-spin 0.6s linear infinite;
}

@keyframes eha-spin {
    to { transform: rotate(360deg); }
}

/* Results Container */
.eha-results {
    margin-top: 30px;
}

.eha-results.hidden {
    display: none;
}

/* Security Score */
.eha-security-score {
    text-align: center;
    padding: 30px;
    background: linear-gradient(135deg, var(--eha-gray-50) 0%, var(--eha-white) 100%);
    border-radius: var(--eha-border-radius);
    margin-bottom: 20px;
}

.eha-score-circle {
    width: 150px;
    height: 150px;
    margin: 0 auto 20px;
    position: relative;
}

.eha-score-number {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 2.5rem;
    font-weight: 700;
}

.eha-score-label {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 8px;
}

.eha-score-description {
    color: var(--eha-gray-600);
}

/* Security Levels */
.eha-level-secure {
    color: var(--eha-success);
}

.eha-level-moderate {
    color: var(--eha-info);
}

.eha-level-warning {
    color: var(--eha-warning);
}

.eha-level-danger {
    color: var(--eha-danger);
}

/* Alerts */
.eha-alert {
    padding: 16px;
    border-radius: var(--eha-border-radius);
    margin-bottom: 16px;
    display: flex;
    align-items: start;
    gap: 12px;
}

.eha-alert-icon {
    flex-shrink: 0;
    font-size: 1.25rem;
}

.eha-alert-content {
    flex: 1;
}

.eha-alert-title {
    font-weight: 600;
    margin-bottom: 4px;
}

.eha-alert-message {
    font-size: 0.9375rem;
}

.eha-alert-success {
    background-color: rgba(16, 185, 129, 0.1);
    border-left: 4px solid var(--eha-success);
    color: #065f46;
}

.eha-alert-warning {
    background-color: rgba(245, 158, 11, 0.1);
    border-left: 4px solid var(--eha-warning);
    color: #92400e;
}

.eha-alert-danger {
    background-color: rgba(239, 68, 68, 0.1);
    border-left: 4px solid var(--eha-danger);
    color: #991b1b;
}

.eha-alert-info {
    background-color: rgba(59, 130, 246, 0.1);
    border-left: 4px solid var(--eha-info);
    color: #1e40af;
}

/* Collapsible Sections */
.eha-collapsible {
    border: 1px solid var(--eha-gray-200);
    border-radius: var(--eha-border-radius);
    margin-bottom: 12px;
}

.eha-collapsible-header {
    padding: 16px;
    background-color: var(--eha-gray-50);
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background-color 0.2s;
}

.eha-collapsible-header:hover {
    background-color: var(--eha-gray-100);
}

.eha-collapsible-title {
    font-weight: 600;
    color: var(--eha-gray-900);
    margin: 0;
}

.eha-collapsible-icon {
    transition: transform 0.2s;
}

.eha-collapsible.open .eha-collapsible-icon {
    transform: rotate(180deg);
}

.eha-collapsible-content {
    display: none;
    padding: 16px;
}

.eha-collapsible.open .eha-collapsible-content {
    display: block;
}

/* Data Table */
.eha-table {
    width: 100%;
    border-collapse: collapse;
}

.eha-table th,
.eha-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid var(--eha-gray-200);
}

.eha-table th {
    background-color: var(--eha-gray-50);
    font-weight: 600;
    color: var(--eha-gray-700);
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.eha-table tr:last-child td {
    border-bottom: none;
}

.eha-table-striped tbody tr:nth-child(odd) {
    background-color: var(--eha-gray-50);
}

/* Badge */
.eha-badge {
    display: inline-block;
    padding: 4px 10px;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 12px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.eha-badge-success {
    background-color: rgba(16, 185, 129, 0.1);
    color: #065f46;
}

.eha-badge-warning {
    background-color: rgba(245, 158, 11, 0.1);
    color: #92400e;
}

.eha-badge-danger {
    background-color: rgba(239, 68, 68, 0.1);
    color: #991b1b;
}

.eha-badge-info {
    background-color: rgba(59, 130, 246, 0.1);
    color: #1e40af;
}

.eha-badge-gray {
    background-color: var(--eha-gray-200);
    color: var(--eha-gray-700);
}

/* Timeline */
.eha-timeline {
    position: relative;
    padding-left: 32px;
}

.eha-timeline::before {
    content: '';
    position: absolute;
    left: 8px;
    top: 8px;
    bottom: 8px;
    width: 2px;
    background-color: var(--eha-gray-300);
}

.eha-timeline-item {
    position: relative;
    padding-bottom: 24px;
}

.eha-timeline-item:last-child {
    padding-bottom: 0;
}

.eha-timeline-marker {
    position: absolute;
    left: -28px;
    top: 4px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background-color: var(--eha-primary);
    border: 3px solid var(--eha-white);
    box-shadow: 0 0 0 2px var(--eha-primary);
}

.eha-timeline-content {
    background-color: var(--eha-gray-50);
    padding: 12px 16px;
    border-radius: var(--eha-border-radius);
}

.eha-timeline-title {
    font-weight: 600;
    margin-bottom: 4px;
}

.eha-timeline-meta {
    font-size: 0.875rem;
    color: var(--eha-gray-600);
}

/* Map Container */
.eha-map-container {
    width: 100%;
    height: 400px;
    background-color: var(--eha-gray-100);
    border-radius: var(--eha-border-radius);
    position: relative;
    overflow: hidden;
}

/* Progress Bar */
.eha-progress {
    width: 100%;
    height: 8px;
    background-color: var(--eha-gray-200);
    border-radius: 4px;
    overflow: hidden;
}

.eha-progress-bar {
    height: 100%;
    background-color: var(--eha-primary);
    transition: width 0.3s ease;
}

/* Tabs */
.eha-tabs {
    border-bottom: 2px solid var(--eha-gray-200);
    margin-bottom: 24px;
}

.eha-tabs-nav {
    display: flex;
    gap: 4px;
}

.eha-tab {
    padding: 12px 20px;
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    cursor: pointer;
    font-weight: 500;
    color: var(--eha-gray-600);
    transition: all 0.2s;
}

.eha-tab:hover {
    color: var(--eha-gray-900);
}

.eha-tab.active {
    color: var(--eha-primary);
    border-bottom-color: var(--eha-primary);
}

.eha-tab-content {
    display: none;
}

.eha-tab-content.active {
    display: block;
}

/* Tooltip */
.eha-tooltip {
    position: relative;
    display: inline-block;
    cursor: help;
}

.eha-tooltip-text {
    visibility: hidden;
    width: 200px;
    background-color: var(--eha-gray-900);
    color: var(--eha-white);
    text-align: center;
    padding: 8px 12px;
    border-radius: 6px;
    position: absolute;
    z-index: 1000;
    bottom: 125%;
    left: 50%;
    margin-left: -100px;
    opacity: 0;
    transition: opacity 0.3s;
    font-size: 0.875rem;
}

.eha-tooltip:hover .eha-tooltip-text {
    visibility: visible;
    opacity: 1;
}

/* Responsive */
@media (max-width: 768px) {
    .eha-container {
        padding: 12px;
    }

    .eha-card {
        padding: 16px;
    }

    .eha-header h1 {
        font-size: 1.5rem;
    }

    .eha-btn-group {
        flex-direction: column;
    }

    .eha-btn {
        width: 100%;
    }

    .eha-table {
        font-size: 0.875rem;
    }

    .eha-table th,
    .eha-table td {
        padding: 8px;
    }

    .eha-score-circle {
        width: 120px;
        height: 120px;
    }

    .eha-score-number {
        font-size: 2rem;
    }
}

/* Utility Classes */
.eha-text-center {
    text-align: center;
}

.eha-text-right {
    text-align: right;
}

.eha-mt-1 { margin-top: 8px; }
.eha-mt-2 { margin-top: 16px; }
.eha-mt-3 { margin-top: 24px; }
.eha-mt-4 { margin-top: 32px; }

.eha-mb-1 { margin-bottom: 8px; }
.eha-mb-2 { margin-bottom: 16px; }
.eha-mb-3 { margin-bottom: 24px; }
.eha-mb-4 { margin-bottom: 32px; }

.eha-hidden {
    display: none !important;
}

.eha-text-muted {
    color: var(--eha-gray-600);
}

.eha-font-mono {
    font-family: 'Courier New', Courier, monospace;
}

.eha-truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ==========================================
 * Leaflet Map Marker Styles
 * ========================================== */

.eha-map-marker-wrapper {
    background: none !important;
    border: none !important;
}

.eha-map-marker {
    width: 28px;
    height: 28px;
    background: var(--eha-primary, #2563eb);
    border: 3px solid #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 6px rgba(0,0,0,0.3);
}

.eha-marker-number {
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    line-height: 1;
}

.eha-distance-label {
    background: none !important;
    border: none !important;
}

.eha-distance-label span {
    background: rgba(37, 99, 235, 0.9);
    color: #fff;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
}

.eha-direction-arrow {
    background: none !important;
    border: none !important;
    color: var(--eha-primary, #2563eb);
    font-size: 16px;
}

.eha-map-popup {
    font-size: 13px;
    line-height: 1.6;
}

.eha-map-popup strong {
    font-size: 14px;
}

/* ==========================================
 * Batch Mode Styles
 * ========================================== */

.eha-batch-toggle {
    font-weight: 500;
    color: var(--eha-gray-600);
    user-select: none;
}

.eha-batch-toggle input {
    cursor: pointer;
}

/* Theme Toggle */
.eha-theme-toggle {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--eha-white, #fff);
    border: 1px solid var(--eha-gray-300, #d1d5db);
    box-shadow: var(--eha-shadow-md, 0 4px 6px -1px rgb(0 0 0 / 0.1));
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    z-index: 100;
    transition: all 0.2s;
}

.eha-theme-toggle:hover {
    transform: scale(1.1);
    box-shadow: var(--eha-shadow-lg, 0 10px 15px -3px rgb(0 0 0 / 0.1));
}
