/* ============================================================
   GLOBAL STYLES & VARIABLES
   ============================================================ */

:root {
    /* Color Variables */
    --primary: #1976d2;
    --primary-dark: #1565c0;
    --secondary: #9c27b0;
    --light: #f5f5f5;
    --light-gray: #e0e0e0;
    --gray: #757575;
    --dark: #212121;
    --text: #424242;
    --text-light: #ffffff;
    --border: #e0e0e0;
    --body-bg: #fafafa;
    --card-bg: #ffffff;

    /* Effect Variables */
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    --shadow-hover: 0 4px 12px rgba(0, 0, 0, 0.15);
    --transition: all 0.2s ease;
}

/* ============================================================
   BASE STYLES
   ============================================================ */

body {
    margin: 0;
    background: var(--body-bg);
    font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
    color: var(--text);
    line-height: 1.6;
}

h1,
h2,
h3 {
    color: var(--dark);
    margin-top: 0;
}

h1 {
    text-align: center;
    margin: 0 0 20px;
    color: var(--primary);
    font-size: 1.85rem;
}

h2 {
    font-size: 1.5rem;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--light-gray);
}

h3 {
    font-size: 1.25rem;
    margin: 1.5rem 0 0.75rem;
    color: var(--primary-dark);
}

/* ============================================================
   MAIN COMPONENTS
   ============================================================ */

/* Main Container */
.dmarc-analyzer {
    max-width: 1040px;
    margin: 42px auto;
    background: var(--card-bg);
    padding: 42px 34px;
    border-radius: 14px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
}

.intro p {
    margin: 0 0 30px;
    line-height: 1.56;
    font-size: 0.95rem;
}

/* ============================================================
   SEO CONTENT SECTION
   ============================================================ */

.seo-content {
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 1px solid var(--light-gray);
}

.seo-content h2 {
    color: var(--primary);
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid var(--light-gray);
}

.seo-content h3 {
    color: var(--primary-dark);
    font-size: 1.25rem;
    margin: 2rem 0 1rem;
}

.seo-content p {
    margin-bottom: 1.25rem;
    font-size: 1rem;
    line-height: 1.7;
    color: var(--text);
}

.seo-content ul {
    margin: 1.5rem 0;
    padding-left: 1.25rem;
    list-style: none;
}

.seo-content li {
    position: relative;
    padding-left: 1.75rem;
    margin-bottom: 0.8rem;
    line-height: 1.6;
}

.seo-content li:before {
    content: "";
    position: absolute;
    left: 0;
    top: 0.65em;
    width: 8px;
    height: 8px;
    background-color: var(--primary);
    border-radius: 50%;
    transform: translateY(-50%);
}

/* Enhanced hover effect for list items */
.seo-content li:hover:before {
    background-color: var(--primary-dark);
    transform: translateY(-50%) scale(1.2);
    transition: transform 0.2s ease, background-color 0.2s ease;
}

/* Subtle animation for better engagement */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.seo-content {
    animation: fadeIn 0.5s ease-out;
}

/* File Upload Component */
.file-upload {
    display: flex;
    justify-content: center;
    margin-bottom: 32px;
    position: relative;
}

.file-upload input {
    display: none;
}

.file-upload span {
    background: var(--primary);
    color: var(--text-light);
    font-weight: 600;
    padding: 15px 36px;
    border-radius: 8px;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: var(--shadow);
}

.file-upload span:hover,
.file-upload span:focus {
    background: var(--primary-dark);
}

.file-upload.drag-over span {
    background: var(--secondary);
}

/* Alert Component */
.alert {
    display: none;
    margin-bottom: 24px;
    padding: 14px 20px;
    border-radius: 8px;
    border: 1px solid #eab308;
    background: #fff8db;
    color: #a16207;
    font-weight: 500;
}

.alert.visible {
    display: block;
}

/* Summary Component */
.summary {
    display: none;
    margin-bottom: 34px;
    padding: 18px 24px;
    border-radius: 8px;
    background: var(--light);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    font-weight: 500;
    font-size: 0.95rem;
}

.summary.visible {
    display: block;
}

/* Health Bar Component */
.health-wrapper {
    height: 26px;
    margin: 18px 0;
    border-radius: 8px;
    background: var(--light-gray);
    overflow: hidden;
    position: relative;
}

.health-bar {
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    font-size: 0.85rem;
    font-weight: 600;
    transition: width 0.5s ease;
    position: relative;
    color: white;
    padding: 0 10px;
    box-sizing: border-box;
    min-width: fit-content;
}

.health-good {
    background: #2e7d32;
}
.health-warn {
    background: #ed6c02;
}
.health-bad {
    background: #d32f2f;
}

.health-status {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    font-weight: 600;
}

.health-percentage {
    font-weight: 700;
}

.health-bar.tiny {
    justify-content: flex-start;
}

.health-label-container {
    display: flex;
    justify-content: space-between;
    margin-top: 5px;
    font-size: 0.85rem;
    color: var(--gray);
}

/* Card Component */
.card-section {
    flex: 1;
    min-width: 300px;
    background: var(--light);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 28px 24px;
    box-shadow: var(--shadow);
    transition: var(--transition);
}

.card-section:hover {
    box-shadow: var(--shadow-hover);
}

.card-section h2 {
    margin: 0 0 18px;
    font-size: 1.1rem;
    border-bottom: 2px solid var(--light-gray);
    padding-bottom: 6px;
}

.card-section ul {
    margin: 0;
    padding: 0;
    list-style: none;
}

.card-section li {
    display: flex;
    gap: 8px;
    justify-content: space-between;
    align-items: flex-start;
    padding: 8px 0;
    border-bottom: 1px dashed var(--light-gray);
    transition: background 0.18s ease, border-left 0.18s ease;
}

.card-section li:last-child {
    border-bottom: none;
}

.card-section li:hover {
    background: rgba(0, 0, 0, 0.035);
}

.card-section strong {
    font-weight: 500;
    color: var(--dark);
}

/* Grid Layout */
.top-info-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 28px;
    margin-bottom: 44px;
}

.records-output {
    display: flex;
    flex-direction: column;
    gap: 44px;
}

/* ============================================================
   STATUS INDICATORS
   ============================================================ */

.pass {
    color: #2e7d32;
    font-weight: 600;
}

.fail,
.reject,
.error {
    color: #c62828;
    font-weight: 600;
}

.neutral {
    color: var(--gray);
    font-weight: 500;
}

/* ============================================================
   TOOLTIPS & INFO ICONS
   ============================================================ */

/* ============================================================
   TOOLTIPS & INFO ICONS - UPDATED FOR DARK MODE
   ============================================================ */

.info-icon {
    display: inline-flex;
    width: 16px;
    height: 16px;
    justify-content: center;
    align-items: center;
    font-size: 11px;
    font-weight: 700;
    line-height: 16px;
    color: var(--text-light);
    background: var(--secondary);
    border-radius: 50%;
    cursor: help;
    user-select: none;
    position: relative;
    flex: none;
}

.tip-target::after,
.tip-target::before {
    opacity: 0;
    pointer-events: none;
    transition: var(--transition);
}

.tip-target::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 125%;
    left: 50%;
    transform: translateX(-50%);
    background: var(--tooltip-bg, var(--dark));
    color: var(--tooltip-text, var(--text-light));
    padding: 8px 12px;
    border-radius: 4px;
    box-shadow: var(--shadow);
    white-space: pre-line;
    font-size: 0.85rem;
    min-width: 220px;
    max-width: 280px;
    line-height: 1.4;
    z-index: 10;
}

.tip-target::before {
    content: "";
    position: absolute;
    bottom: 110%;
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: var(--tooltip-bg, var(--dark));
}

.tip-target:hover::after,
.tip-target:hover::before {
    opacity: 1;
}

/* Dark mode tooltip colors */
[data-theme="dark"] .tip-target::after {
    --tooltip-bg: #333;
    --tooltip-text: #fff;
}

[data-theme="dark"] .tip-target::before {
    border-top-color: #333;
}

/* Accessibility Helpers */
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ============================================================
   RESPONSIVE ADJUSTMENTS
   ============================================================ */

@media (max-width: 768px) {
    main {
        margin: 15px !important;
    }

    .dmarc-analyzer {
        padding: 30px 20px;
        margin: 20px auto;
    }

    .card-section li {
        flex-direction: column;
        align-items: flex-start;
    }

    .seo-content {
        margin-top: 2rem;
        padding-top: 1.5rem;
    }

    .seo-content h2 {
        font-size: 1.3rem;
    }

    .seo-content h3 {
        font-size: 1.15rem;
    }

    .seo-content li {
        padding-left: 1.5rem;
    }

    .seo-content li:before {
        width: 6px;
        height: 6px;
    }

    h2 {
        font-size: 1.3rem;
    }

    h3 {
        font-size: 1.15rem;
    }
}

@media (min-width: 0) {
    .health-bar {
        position: relative;
    }

    .health-bar::after {
        content: attr(data-label);
        display: none;
    }
}
