:root {
    --primary: #6a11cb;
    --secondary: #2575fc;
    --accent: #00c6fb;
    --success: #38ef7d;
    --danger: #ff416c;
    --role: #4776e6;
    --catch-all: #8e44ad;
    --disposable: #ff4b2b;
    --inbox-full: #e67e22;
    --disabled: #95a5a6;
    --invalid: #ff416c;
    --unknown: #7f8c8d;
    --dark: #1a1a2e;
    --light: #f8f9fa;
    --sidebar-bg: #ffffff;
    --sidebar-width: 320px;
    --gradient-primary: linear-gradient(135deg, var(--primary), var(--secondary));
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    background-color: #f5f7ff;
    color: var(--dark);
    overflow: hidden;
}

/* Header */
.gradient-header {
    background: var(--gradient-primary);
    color: white;
    padding: 1.5rem;
    box-shadow: 0 10px 30px rgba(106, 17, 203, 0.2);
    width: 100%;
    position: relative;
    z-index: 10;
}
.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1600px;
    margin: 0 auto;
    padding: 0 2rem;
}
h1 {
    font-size: 1.8rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.8rem;
}
.credits-display { display: flex; gap: 1rem; }
.credit-badge {
    background: rgba(255, 255, 255, 0.15);
    padding: 0.5rem 1rem;
    border-radius: 50px;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
}
.credit-badge strong { font-weight: 700; font-size: 1.1rem; }

.page-wrapper {
    display: flex;
    height: calc(100vh - 95px);
}

/* Sidebar / History */
.sidebar {
    width: var(--sidebar-width);
    background-color: var(--sidebar-bg);
    border-right: 1px solid #e0e0ff;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    z-index: 5;
}
.sidebar-header { padding: 1.5rem; border-bottom: 1px solid #e0e0ff; }
.sidebar-header h2 {
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.history-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.8rem 1.5rem;
    border-bottom: 1px solid #e0e0ff;
    font-size: 0.9rem;
}
.delete-btn {
    background: transparent;
    border: 1px solid var(--danger);
    color: var(--danger);
    padding: 0.4rem 0.8rem;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
}
.delete-btn:hover { background: var(--danger); color: white; }
.history-list {
    list-style: none;
    overflow-y: auto;
    flex-grow: 1;
    padding: 0.5rem 0;
}
.history-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid #f0f0f8;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}
.history-item:hover {
    background-color: #f5f7ff;
    transform: translateX(5px);
}
.history-item.active {
    background-color: #e9e7ff;
    box-shadow: inset 4px 0 0 var(--primary);
}
.history-item-icon {
    font-size: 1.5rem;
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
}
.history-item-icon .fa-check-circle { color: var(--success); }
.history-item-icon .processing-dot {
    width: 12px;
    height: 12px;
    background-color: var(--accent);
    border-radius: 50%;
    animation: pulse-dot 1.5s infinite ease-in-out;
}
.history-item-details { flex-grow: 1; }
.history-item-name {
    font-weight: 600;
    color: var(--dark);
    margin-bottom: 0.25rem;
}
.history-item-meta {
    font-size: 0.85rem;
    color: #777;
}
.history-item-meta span:not(:last-child)::after {
    content: '•';
    margin: 0 0.5rem;
}
.history-item-checkbox { margin-left: auto; flex-shrink: 0; }

/* Main app */
.app-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 2rem;
    overflow-y: auto;
    position: relative;
    background-color: #eef2ff;
}
.background-shapes {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    z-index: 0;
}
.background-shapes::before,
.background-shapes::after {
    content: '';
    position: absolute;
    border-radius: 50%;
    filter: blur(100px);
    opacity: 0.4;
}
.background-shapes::before {
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, #ffafbd, #ffc3a0);
    top: -100px;
    right: -100px;
}
.background-shapes::after {
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, #2193b0, #6dd5ed);
    bottom: -150px;
    left: -150px;
}
.main-content {
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
    position: relative;
    z-index: 1;
}
.glass-panel {
    background: rgba(255, 255, 255, 0.4);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border-radius: 15px;
    border: 1px solid rgba(255, 255, 255, 0.5);
    box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.1);
    padding: 2.5rem;
    animation: fadeIn 0.6s ease-out;
}

/* Upload & verify */
#uploadAndVerifyContainer {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}
.upload-card {
    text-align: center;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}
.upload-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 40px rgba(31, 38, 135, 0.2);
}
.upload-icon {
    width: 80px;
    height: 80px;
    background: rgba(106, 17, 203, 0.1);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary);
    font-size: 2.5rem;
    margin-bottom: 1rem;
}
.upload-card h2 {
    font-size: 1.5rem;
    color: var(--dark);
    margin-bottom: 0.5rem;
}
.upload-card p { color: #444; font-size: 0.95rem; }
input[type="file"] { display: none; }

.verify-section {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    animation: fadeIn 0.6s ease-out;
}
.select-field { display: flex; flex-direction: column; gap: 0.5rem; }
.select-field label {
    font-weight: 600;
    color: var(--dark);
    font-size: 0.95rem;
}
.modern-select {
    padding: 1rem;
    border: 1px solid rgba(255, 255, 255, 0.6);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.5);
    font-size: 1rem;
    color: var(--dark);
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    background-size: 1em;
    transition: all 0.3s ease;
}
.modern-select:focus {
    outline: none;
    box-shadow: 0 0 0 2px var(--primary);
}
.verify-btn {
    background: var(--gradient-primary);
    color: white;
    border: none;
    padding: 1.2rem;
    border-radius: 12px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.8rem;
    box-shadow: 0 10px 20px rgba(106, 17, 203, 0.3);
    transition: all 0.3s ease;
}
.verify-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 15px 30px rgba(106, 17, 203, 0.4);
}

/* Results */
.results-section { animation: fadeIn 0.6s ease-out; }
.results-header-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}
.results-header { font-size: 1.5rem; color: var(--dark); }
.start-new-btn {
    background: rgba(255, 255, 255, 0.3);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.5);
    color: var(--primary);
    padding: 0.6rem 1.2rem;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
}
.start-new-btn:hover {
    background: rgba(255, 255, 255, 0.6);
    box-shadow: 0 6px 20px rgba(106, 17, 203, 0.2);
    transform: translateY(-2px);
}
.results-layout { display: flex; gap: 1.5rem; align-items: stretch; }
.results-main { flex: 1.8; display: flex; flex-direction: column; }
.results-details { flex: 1; }
.chart-container { height: 250px; margin-bottom: 1.5rem; }
.results-summary-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    margin-top: auto;
}
.summary-item {
    background: rgba(255, 255, 255, 0.4);
    padding: 0.8rem;
    border-radius: 8px;
    text-align: center;
}
.summary-item-label {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    font-weight: 600;
    color: #333;
    margin-bottom: 0.5rem;
}
.summary-item-label::before {
    content: '';
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background-color: var(--color);
}
.summary-item-value {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--dark);
}
.download-section h3 {
    margin-bottom: 1.5rem;
    text-align: center;
    font-size: 1.2rem;
}
.download-list { display: flex; flex-direction: column; gap: 1rem; }
.download-btn {
    padding: 1rem;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    color: white;
    transition: all 0.3s ease;
    background-size: 200% 100%;
    background-position: right bottom;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}
.download-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    background-position: left bottom;
}
.download-btn.safe-btn {
    background-image: linear-gradient(to right, #11998e, #38ef7d, #11998e);
}
.download-btn.role-btn {
    background-image: linear-gradient(to right, #8e54e9, #4776e6, #8e54e9);
}
.download-btn.unknown-btn {
    background-image: linear-gradient(to right, #95a5a6, #7f8c8d, #95a5a6);
}
.download-btn.full-btn {
    background-image: linear-gradient(to right, var(--secondary), var(--primary), var(--secondary));
}
.format-options { margin-top: 1.5rem; display: none; }
.format-options.active {
    display: block;
    animation: fadeIn 0.3s ease-out;
}
.format-options h4 {
    text-align: center;
    margin-bottom: 1rem;
    font-size: 1rem;
    font-weight: 600;
    color: var(--dark);
}
.format-buttons { display: flex; gap: 1rem; }
.format-btn {
    flex: 1;
    padding: 0.8rem;
    background: rgba(255, 255, 255, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.8);
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    color: #555;
    transition: all 0.3s ease;
}
.format-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: rgba(106, 17, 203, 0.1);
}

/* Progress */
.progress-container {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}
.progress-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.progress-bar {
    height: 10px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 10px;
    overflow: hidden;
}
.progress-fill {
    height: 100%;
    background: var(--gradient-primary);
    width: 0%;
    transition: width 0.5s ease-out;
    border-radius: 10px;
}
.progress-percent {
    align-self: flex-end;
    font-weight: 700;
    color: var(--primary);
}
.live-chart-container {
    margin-top: 1.5rem;
    width: 100%;
    height: 250px;
}
.live-chart-legend {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 1.5rem;
    margin-top: 1rem;
    padding: 0 1rem;
}
.legend-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
}
.legend-color {
    width: 12px;
    height: 12px;
    border-radius: 3px;
}
.legend-label { color: #333; }
.legend-value {
    font-weight: 700;
    color: var(--dark);
    min-width: 20px;
    text-align: left;
}
.progress-footer {
    margin-top: 1rem;
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
}
.pause-btn,
.icon-btn {
    background: #ffffffaa;
    border-radius: 999px;
    border: 1px solid rgba(0,0,0,0.08);
    padding: 0.5rem 1rem;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: #444;
    transition: all 0.2s ease;
}
.icon-btn { font-size: 0.85rem; padding: 0.5rem 0.9rem; }
.icon-btn i { font-size: 0.9rem; }
.pause-btn:hover,
.icon-btn:hover {
    background: #fff;
    box-shadow: 0 4px 10px rgba(0,0,0,0.08);
}
.live-chart-container.is-processing canvas {
    animation: pulse-glow 2s infinite ease-in-out;
}

/* Loading */
.loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.7);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}
.loading-spinner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
}
.spinner-circle {
    width: 60px;
    height: 60px;
    border: 5px solid rgba(255,255,255,0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 1s linear infinite;
}
.spinner-text {
    color: white;
    font-size: 1.2rem;
    font-weight: 600;
}

/* Animations */
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}
@keyframes pulse-dot {
    0% { transform: scale(0.8); opacity: 0.7; }
    50% { transform: scale(1.2); opacity: 1; }
    100% { transform: scale(0.8); opacity: 0.7; }
}
@keyframes pulse-glow {
    0% { box-shadow: 0 0 0 0 rgba(106, 17, 203, 0.2); }
    70% { box-shadow: 0 0 15px 30px rgba(106, 17, 203, 0); }
    100% { box-shadow: 0 0 0 0 rgba(106, 17, 203, 0); }
}

/* Modals */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.45);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
}
.modal { max-width: 420px; width: 100%; }
.modal-small { padding: 1.8rem 2rem; }
.modal h3 {
    margin-bottom: 0.75rem;
    font-size: 1.2rem;
}
.modal p {
    font-size: 0.95rem;
    color: #444;
    margin-bottom: 1rem;
}
.modal-field {
    margin-bottom: 1.2rem;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}
.modal-field label {
    font-size: 0.9rem;
    font-weight: 600;
}
.modal-field input[type="number"] {
    padding: 0.6rem 0.7rem;
    border-radius: 8px;
    border: 1px solid #d0d0f0;
    font-size: 0.95rem;
}
.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
}
.btn-primary,
.btn-secondary {
    border-radius: 999px;
    padding: 0.5rem 1.1rem;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.btn-primary {
    background: var(--gradient-primary);
    color: #fff;
}
.btn-primary:hover { opacity: 0.9; }
.btn-secondary {
    background: #ffffff;
    border: 1px solid #ccc;
    color: #444;
}
.btn-secondary:hover { background: #f3f3f3; }