/* ===============================================
   EML Analyzer - Nowoczesny ciemny motyw
   =============================================== */

:root {
    --bg-primary: #0f0f1a;
    --bg-secondary: #1a1a2e;
    --bg-card: #16213e;
    --bg-card-hover: #1e2d4d;
    --text-primary: #e8e8e8;
    --text-secondary: #a0a0a0;
    --text-muted: #6c6c6c;
    --accent-blue: #4f8cff;
    --accent-purple: #9d4edd;
    --accent-gradient: linear-gradient(135deg, #4f8cff 0%, #9d4edd 100%);
    --success: #00c853;
    --warning: #ffab00;
    --danger: #ff5252;
    --border-color: rgba(255, 255, 255, 0.08);
    --shadow-lg: 0 20px 60px rgba(0, 0, 0, 0.4);
    --shadow-md: 0 8px 32px rgba(0, 0, 0, 0.3);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 20px;
}

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

body {
    font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.6;
}

/* ===============================================
   Layout
   =============================================== */

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

header {
    text-align: center;
    margin-bottom: 50px;
}

header h1 {
    font-size: 2.8rem;
    font-weight: 700;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 10px;
}

header p {
    color: var(--text-secondary);
    font-size: 1.1rem;
}

/* ===============================================
   Upload Section
   =============================================== */

.upload-section {
    background: var(--bg-secondary);
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-lg);
    padding: 60px 40px;
    text-align: center;
    transition: all 0.3s ease;
    margin-bottom: 40px;
}

.upload-section:hover {
    border-color: var(--accent-blue);
    background: var(--bg-card);
}

.upload-section.dragover {
    border-color: var(--accent-purple);
    background: rgba(157, 78, 221, 0.1);
    transform: scale(1.02);
}

.upload-icon {
    font-size: 4rem;
    margin-bottom: 20px;
    opacity: 0.8;
}

.upload-section h2 {
    font-size: 1.5rem;
    margin-bottom: 10px;
    color: var(--text-primary);
}

.upload-section p {
    color: var(--text-secondary);
    margin-bottom: 25px;
}

.file-input-wrapper {
    position: relative;
    display: inline-block;
}

.file-input-wrapper input[type="file"] {
    position: absolute;
    left: 0;
    top: 0;
    opacity: 0;
    width: 100%;
    height: 100%;
    cursor: pointer;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 14px 32px;
    font-size: 1rem;
    font-weight: 600;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-primary {
    background: var(--accent-gradient);
    color: white;
    box-shadow: 0 4px 20px rgba(79, 140, 255, 0.4);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(79, 140, 255, 0.5);
}

.btn-secondary {
    background: var(--bg-card);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: var(--bg-card-hover);
}

/* ===============================================
   Analysis Results
   =============================================== */

.analysis-results {
    animation: fadeIn 0.5s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.card {
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    padding: 30px;
    margin-bottom: 25px;
    border: 1px solid var(--border-color);
    transition: all 0.3s ease;
}

.card:hover {
    border-color: rgba(79, 140, 255, 0.3);
    box-shadow: var(--shadow-md);
}

.card-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--border-color);
}

.card-header .icon {
    font-size: 1.5rem;
}

.card-header h2 {
    font-size: 1.3rem;
    font-weight: 600;
}

/* ===============================================
   Info Grid
   =============================================== */

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

.info-item {
    background: var(--bg-card);
    padding: 20px;
    border-radius: var(--radius-md);
    transition: all 0.3s ease;
}

.info-item:hover {
    background: var(--bg-card-hover);
}

.info-item .label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.info-item .value {
    font-size: 1rem;
    color: var(--text-primary);
    word-break: break-word;
}

.info-item .value.highlight {
    color: var(--accent-blue);
}

/* ===============================================
   Delivery Chain / Timeline
   =============================================== */

.timeline {
    position: relative;
    padding-left: 30px;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 8px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: linear-gradient(to bottom, var(--accent-blue), var(--accent-purple));
}

.timeline-item {
    position: relative;
    padding: 20px;
    padding-left: 30px;
    background: var(--bg-card);
    border-radius: var(--radius-md);
    margin-bottom: 15px;
}

.timeline-item::before {
    content: '';
    position: absolute;
    left: -26px;
    top: 28px;
    width: 14px;
    height: 14px;
    background: var(--accent-blue);
    border-radius: 50%;
    border: 3px solid var(--bg-secondary);
    box-shadow: 0 0 10px rgba(79, 140, 255, 0.5);
}

.timeline-item .hop-number {
    font-size: 0.8rem;
    color: var(--accent-blue);
    font-weight: 600;
    margin-bottom: 8px;
}

.timeline-item .server {
    font-size: 1rem;
    font-weight: 500;
    margin-bottom: 5px;
}

.timeline-item .details {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.timeline-item .timestamp {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 10px;
}

/* ===============================================
   Security Indicators
   =============================================== */

.risk-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 600;
    text-transform: uppercase;
}

.risk-low {
    background: rgba(0, 200, 83, 0.15);
    color: var(--success);
    border: 1px solid rgba(0, 200, 83, 0.3);
}

.risk-medium {
    background: rgba(255, 171, 0, 0.15);
    color: var(--warning);
    border: 1px solid rgba(255, 171, 0, 0.3);
}

.risk-high {
    background: rgba(255, 82, 82, 0.15);
    color: var(--danger);
    border: 1px solid rgba(255, 82, 82, 0.3);
}

.warnings-list {
    margin-top: 20px;
}

.warning-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 15px;
    background: rgba(255, 82, 82, 0.08);
    border-left: 3px solid var(--danger);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    margin-bottom: 10px;
}

.warning-item .icon {
    font-size: 1.2rem;
    flex-shrink: 0;
}

.info-item-list {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 15px;
    background: rgba(79, 140, 255, 0.08);
    border-left: 3px solid var(--accent-blue);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    margin-bottom: 10px;
}

/* ===============================================
   Links List
   =============================================== */

.links-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.link-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 15px;
    background: var(--bg-card);
    border-radius: var(--radius-md);
    transition: all 0.3s ease;
}

.link-item:hover {
    background: var(--bg-card-hover);
}

.link-item.suspicious {
    border-left: 3px solid var(--danger);
    background: rgba(255, 82, 82, 0.05);
}

.link-item .url {
    flex: 1;
    word-break: break-all;
    font-family: 'Fira Code', monospace;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.link-item .badge {
    padding: 4px 10px;
    font-size: 0.75rem;
    border-radius: 12px;
    font-weight: 600;
    text-transform: uppercase;
}

.badge-danger {
    background: rgba(255, 82, 82, 0.2);
    color: var(--danger);
}

.badge-safe {
    background: rgba(0, 200, 83, 0.2);
    color: var(--success);
}

/* ===============================================
   Email Preview
   =============================================== */

.preview-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.tab-btn {
    padding: 10px 20px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.3s ease;
}

.tab-btn:hover {
    background: var(--bg-card-hover);
}

.tab-btn.active {
    background: var(--accent-gradient);
    color: white;
    border-color: transparent;
}

.preview-frame {
    background: white;
    border-radius: var(--radius-md);
    overflow: hidden;
    min-height: 400px;
}

.preview-frame iframe {
    width: 100%;
    height: 500px;
    border: none;
}

.preview-text {
    background: var(--bg-card);
    padding: 25px;
    border-radius: var(--radius-md);
    white-space: pre-wrap;
    font-family: 'Fira Code', monospace;
    font-size: 0.9rem;
    color: var(--text-secondary);
    max-height: 500px;
    overflow-y: auto;
}

/* ===============================================
   Spam Score Meter
   =============================================== */

.spam-meter {
    margin: 20px 0;
}

.meter-bar {
    height: 12px;
    background: var(--bg-card);
    border-radius: 6px;
    overflow: hidden;
    position: relative;
}

.meter-fill {
    height: 100%;
    border-radius: 6px;
    transition: width 0.5s ease-out;
}

.meter-fill.low {
    background: linear-gradient(90deg, var(--success), #4caf50);
}

.meter-fill.medium {
    background: linear-gradient(90deg, #ff9800, var(--warning));
}

.meter-fill.high {
    background: linear-gradient(90deg, #f44336, var(--danger));
}

.meter-labels {
    display: flex;
    justify-content: space-between;
    margin-top: 8px;
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* ===============================================
   Responsive
   =============================================== */

@media (max-width: 768px) {
    .container {
        padding: 20px 15px;
    }

    header h1 {
        font-size: 2rem;
    }

    .upload-section {
        padding: 40px 20px;
    }

    .card {
        padding: 20px;
    }

    .info-grid {
        grid-template-columns: 1fr;
    }

    .timeline {
        padding-left: 20px;
    }
}

/* ===============================================
   Loading State
   =============================================== */

.loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 3px solid var(--bg-card);
    border-top-color: var(--accent-blue);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.loading p {
    margin-top: 20px;
    color: var(--text-secondary);
}

/* Educational Cards */
.educational-section {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-bottom: 20px;
}

.edu-card {
    background: rgba(255, 82, 82, 0.08);
    border-left: 4px solid var(--danger);
    border-radius: var(--radius-sm);
    padding: 20px;
}

.edu-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.edu-header h3 {
    color: var(--danger);
    font-size: 1.1rem;
    font-weight: 600;
    margin: 0;
}

.edu-content p {
    color: var(--text-primary);
    font-size: 0.95rem;
    margin-bottom: 15px;
}

.tech-details {
    background: rgba(0, 0, 0, 0.2);
    border-radius: var(--radius-sm);
    padding: 10px;
}

.tech-details summary {
    cursor: pointer;
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-weight: 600;
}

.tech-details pre {
    margin-top: 10px;
    font-family: 'Fira Code', monospace;
    font-size: 0.8rem;
    color: var(--text-muted);
    white-space: pre-wrap;
    word-break: break-all;
}
