:root {
    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --bg-gradient: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    --card-bg: rgba(255, 255, 255, 0.85);
    --text-main: #1e293b;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Inter', sans-serif;
}

body {
    background: var(--bg-gradient);
    min-height: 100vh;
    color: var(--text-main);
    display: flex;
    justify-content: center;
    padding: 40px 20px;
}

.container {
    max-width: 900px;
    width: 100%;
}

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

header h1 {
    font-size: 2.5rem;
    font-weight: 800;
    margin-bottom: 8px;
    background: linear-gradient(to right, #6366f1, #a855f7);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

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

/* Upload Section */
.upload-section {
    background: var(--card-bg);
    backdrop-filter: blur(10px);
    border: 2px dashed var(--border);
    border-radius: 20px;
    padding: 60px 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: var(--shadow);
}

.upload-section:hover {
    border-color: var(--primary);
    background: white;
}

.upload-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}

.upload-icon {
    color: var(--primary);
}

.upload-box p {
    font-size: 1.25rem;
    font-weight: 600;
}

.upload-box span {
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* Loader */
.loader-container {
    text-align: center;
    padding: 40px;
}

.loader {
    width: 48px;
    height: 48px;
    border: 5px solid #FFF;
    border-bottom-color: var(--primary);
    border-radius: 50%;
    display: inline-block;
    box-sizing: border-box;
    animation: rotation 1s linear infinite;
    margin-bottom: 15px;
}

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

/* Viewer Section */
.viewer-section {
    animation: fadeInUp 0.5s ease-out;
}

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

.email-card {
    background: var(--card-bg);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    overflow: hidden;
    box-shadow: var(--shadow);
    margin-bottom: 20px;
}

.email-header {
    padding: 24px;
    background: rgba(255, 255, 255, 0.5);
    border-bottom: 1px solid var(--border);
}

.header-item {
    margin-bottom: 8px;
    display: flex;
}

.header-item:last-child {
    margin-bottom: 0;
}

.label {
    width: 80px;
    font-weight: 700;
    color: var(--text-muted);
    font-size: 0.85rem;
    text-transform: uppercase;
}

.value {
    font-weight: 500;
    word-break: break-all;
}

#mail-subject {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--primary);
}

/* Attachments */
.attachments-area {
    padding: 16px 24px;
    background: #f1f5f9;
}

.attachments-area h3 {
    font-size: 0.9rem;
    margin-bottom: 10px;
    color: var(--text-muted);
}

.attachment-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.attachment-item {
    background: white;
    padding: 8px 12px;
    border-radius: 8px;
    border: 1px solid var(--border);
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    color: var(--text-main);
    transition: transform 0.2s;
}

.attachment-item:hover {
    transform: translateY(-2px);
    border-color: var(--primary);
}

/* Email Body */
.email-body {
    padding: 0;
}

.tabs {
    display: flex;
    border-bottom: 1px solid var(--border);
}

.tab-btn {
    padding: 12px 24px;
    border: none;
    background: none;
    cursor: pointer;
    font-weight: 600;
    color: var(--text-muted);
    transition: all 0.2s;
}

.tab-btn.active {
    color: var(--primary);
    border-bottom: 3px solid var(--primary);
}

.content-view {
    padding: 24px;
    background: white;
    min-height: 300px;
    max-height: 600px;
    overflow-y: auto;
}

#content-text {
    white-space: pre-wrap;
    font-family: monospace;
    font-size: 0.9rem;
}

/* Footer & Buttons */
.action-buttons {
    display: flex;
    gap: 15px;
    margin-top: 20px;
}

.download-all-btn {
    background: #10b981;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 10px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
    flex: 1;
}

.download-all-btn:hover {
    background: #059669;
}

.reset-btn {
    background: var(--primary);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 10px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
    flex: 1;
}

.reset-btn:hover {
    background: var(--primary-hover);
}

footer {
    text-align: center;
    margin-top: 40px;
    color: var(--text-muted);
    font-size: 0.8rem;
}

/* Iframe adjustment */
iframe {
    width: 100%;
    border: none;
    height: 500px;
}
