:root {
    /* Premium Light Theme Palette (Default) */
    --bg-base: #F9FAFB;
    --bg-surface: rgba(255, 255, 255, 0.6);
    --bg-surface-hover: rgba(255, 255, 255, 0.9);
    
    --accent-primary: #7C3AED; /* Vibrant Purple */
    --accent-secondary: #3B82F6; /* Vibrant Blue */
    --accent-glow: rgba(124, 58, 237, 0.3);
    
    --text-primary: #111827;
    --text-secondary: #374151;
    --text-muted: #6B7280;
    
    --border-color: rgba(0, 0, 0, 0.1);
    --border-highlight: rgba(0, 0, 0, 0.2);
    --glass-shadow: 0 10px 40px -10px rgba(0,0,0,0.1), inset 0 1px 0 rgba(255,255,255,0.5);
    
    --mesh-center: #F9FAFB;
    --mesh-edge: #E5E7EB;
    --modal-bg: #FFFFFF;

    --border-radius: 16px;
    --transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

[data-theme="dark"] {
    /* Premium Dark Theme Palette */
    --bg-base: #050505;
    --bg-surface: rgba(18, 18, 20, 0.45);
    --bg-surface-hover: rgba(30, 30, 35, 0.65);
    
    --accent-primary: #8B5CF6; /* Vibrant Purple */
    --accent-secondary: #3B82F6; /* Vibrant Blue */
    --accent-glow: rgba(139, 92, 246, 0.5);
    
    --text-primary: #F9FAFB;
    --text-secondary: #D1D5DB;
    --text-muted: #6B7280;
    
    --border-color: rgba(255, 255, 255, 0.08);
    --border-highlight: rgba(255, 255, 255, 0.15);
    --glass-shadow: 0 10px 40px -10px rgba(0,0,0,0.8), inset 0 1px 0 rgba(255,255,255,0.05);
    
    --mesh-center: #050505;
    --mesh-edge: #020202;
    --modal-bg: #111111;
}

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

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-base);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    overflow-x: hidden;
}

/* Dynamic Animated Background Mesh */
.background-mesh {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: -1;
    overflow: hidden;
    background: radial-gradient(circle at center, var(--mesh-center) 0%, var(--mesh-edge) 100%);
}

.orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.5;
    animation: float 20s infinite ease-in-out alternate;
}

.orb-1 {
    width: 400px;
    height: 400px;
    background: var(--accent-primary);
    top: -100px;
    left: -100px;
}

.orb-2 {
    width: 500px;
    height: 500px;
    background: var(--accent-secondary);
    bottom: -150px;
    right: -100px;
    animation-delay: -5s;
}

.orb-3 {
    width: 300px;
    height: 300px;
    background: #10B981; /* Emerald */
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    opacity: 0.2;
    animation-duration: 25s;
}

@keyframes float {
    0% { transform: translate(0, 0) scale(1); }
    100% { transform: translate(50px, 50px) scale(1.1); }
}

/* Layout */
.app-container {
    width: 100%;
    max-width: 800px;
    padding: clamp(16px, 3vh, 40px) 20px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    gap: clamp(16px, 3vh, 32px);
    z-index: 1;
}

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

.logo {
    font-size: 2.5rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 8px;
    background: linear-gradient(135deg, var(--text-primary) 0%, var(--text-secondary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.logo i {
    color: var(--accent-primary);
    -webkit-text-fill-color: initial;
}

.subtitle {
    color: var(--text-secondary);
    font-size: 1.1rem;
}

/* Glassmorphism Panels */
.glass-panel {
    background: var(--bg-surface);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    box-shadow: var(--glass-shadow);
    padding: 32px;
    transition: var(--transition);
}

.glass-panel:hover {
    border-color: var(--border-highlight);
    box-shadow: 0 15px 50px -15px rgba(0,0,0,1), inset 0 1px 0 rgba(255,255,255,0.1);
}

/* Generator Card */
.generator-card {
    display: flex;
    flex-direction: column;
    gap: clamp(16px, 2vh, 24px);
}

.email-display-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.email-display {
    width: 100%;
    background: var(--bg-base);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 20px 60px 20px 20px;
    font-size: clamp(1rem, 5vw, 1.5rem);
    font-weight: 500;
    color: var(--text-primary);
    text-align: center;
    word-break: break-all;
    transition: var(--transition);
}

.email-display.glow {
    box-shadow: 0 0 25px var(--accent-glow);
    border-color: var(--accent-primary);
    transform: scale(1.02);
    background: rgba(139, 92, 246, 0.1);
}

.placeholder {
    color: var(--text-muted);
    font-size: clamp(0.9rem, 4vw, 1.2rem);
}

.copy-btn {
    position: absolute;
    right: 12px;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 8px;
    border-radius: 8px;
    transition: var(--transition);
}

.copy-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

/* Controls */
.generator-controls, .recover-controls {
    display: flex;
    gap: 16px;
    margin-bottom: 12px;
}
.recover-controls {
    margin-top: 15px;
    align-items: stretch;
}

.custom-select-wrapper {
    position: relative;
    flex-grow: 1;
}

.custom-select {
    width: 100%;
    appearance: none;
    background: var(--bg-base);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 16px 40px 16px 20px;
    border-radius: 12px;
    font-size: 1rem;
    font-family: inherit;
    cursor: pointer;
    outline: none;
    transition: var(--transition);
}

.custom-select:focus {
    border-color: var(--accent-primary);
}

.select-icon {
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
    color: var(--text-secondary);
}

/* Buttons */
.btn {
    font-family: inherit;
    font-size: 1rem;
    font-weight: 500;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: var(--transition);
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent-primary) 0%, #6D28D9 100%);
    color: white;
    padding: 16px 32px;
    box-shadow: 0 4px 15px var(--accent-glow);
    position: relative;
    overflow: hidden;
}

.btn-primary::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.15) 0%, transparent 60%);
    opacity: 0;
    transform: scale(0.5);
    transition: var(--transition);
}

.btn-primary:hover {
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 8px 25px var(--accent-glow);
}

.btn-primary:hover::after {
    opacity: 1;
    transform: scale(1);
}

.btn-primary:active {
    transform: translateY(0) scale(0.98);
}

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

.btn-secondary:hover {
    background: var(--bg-surface-hover);
    border-color: var(--border-highlight);
    transform: translateY(-2px);
}

/* Inbox Section */
.inbox-section {
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    min-height: 400px;
}

.inbox-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 16px;
}

.inbox-header h2 {
    font-size: 1.25rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.inbox-status {
    font-size: 0.875rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.pulse-dot {
    width: 8px;
    height: 8px;
    background-color: var(--accent-secondary);
    border-radius: 50%;
    box-shadow: 0 0 0 0 rgba(59, 130, 246, 0.7);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(59, 130, 246, 0.7); }
    70% { transform: scale(1); box-shadow: 0 0 0 10px rgba(59, 130, 246, 0); }
    100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(59, 130, 246, 0); }
}

/* Messages List */
.messages-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 0;
    color: var(--text-muted);
    text-align: center;
}

.empty-state i {
    font-size: 3rem;
    margin-bottom: 16px;
    opacity: 0.5;
}

.empty-state p {
    font-size: 1.1rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.message-item {
    background: var(--bg-base);
    border: 1px solid transparent;
    border-radius: 12px;
    padding: 16px;
    cursor: pointer;
    transition: var(--transition);
    display: grid;
    grid-template-columns: 2fr 3fr auto;
    gap: 16px;
    align-items: center;
    animation: slideIn 0.3s ease-out forwards;
}

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

.message-item:hover {
    background: var(--bg-surface-hover);
    border-color: var(--border-color);
    transform: translateY(-2px);
}

.msg-sender {
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.msg-subject {
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.msg-date {
    font-size: 0.875rem;
    color: var(--text-muted);
    text-align: right;
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    opacity: 0;
    pointer-events: none;
    transition: var(--transition);
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: all;
}

.modal-content {
    width: 90%;
    max-width: 700px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    padding: 0;
    transform: scale(0.95);
    transition: var(--transition);
}

.modal-overlay.active .modal-content {
    transform: scale(1);
}

.modal-header {
    padding: 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
}

.modal-header h3 {
    font-size: 1.5rem;
    font-weight: 600;
    line-height: 1.3;
}

.close-btn {
    background: transparent;
    color: var(--text-secondary);
    font-size: 1.5rem;
    padding: 8px;
    margin: -8px -8px 0 0;
}

.close-btn:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.1);
}

.modal-meta {
    padding: 16px 24px;
    background: var(--bg-base);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.meta-item {
    display: flex;
    gap: 8px;
    font-size: 0.9rem;
}

.meta-label {
    color: var(--text-muted);
    width: 50px;
}

.meta-value {
    color: var(--text-primary);
    font-weight: 500;
}

.modal-body {
    padding: 24px;
    overflow-y: auto;
    background: var(--modal-bg);
    color: var(--text-primary);
    border-bottom-left-radius: var(--border-radius);
    border-bottom-right-radius: var(--border-radius);
    min-height: 200px;
}

.modal-body iframe {
    width: 100%;
    min-height: 400px;
    border: none;
}

/* Footer */
footer {
    margin-top: auto;
    padding: 24px;
    color: var(--text-muted);
    font-size: 0.875rem;
}

/* Responsive */
@media (max-width: 600px) {
    .generator-controls, .recover-controls {
        flex-direction: column;
    }
    
    .message-item {
        grid-template-columns: 1fr auto;
        grid-template-rows: auto auto;
    }
    
    .msg-sender {
        grid-column: 1 / 2;
        grid-row: 1 / 2;
    }
    
    .msg-date {
        grid-column: 2 / 3;
        grid-row: 1 / 2;
    }
    
    .msg-subject {
        grid-column: 1 / 3;
        grid-row: 2 / 3;
    }
}

/* Extracted Inline Styles */
.theme-toggle-btn {
    position: absolute;
    top: 20px;
    right: 20px;
    z-index: 10;
    background: rgba(0,0,0,0.1);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    cursor: pointer;
}

.copy-btn-override {
    font-size: 1.5rem !important;
    padding: 4px !important;
}

.password-display-wrapper {
    margin-top: -16px;
    margin-bottom: 12px;
    position: relative;
    display: none;
}

.password-display {
    font-size: clamp(0.9rem, 4vw, 1.1rem) !important;
    padding: 12px 60px 12px 20px !important;
    background: rgba(0,0,0,0.2) !important;
    border-color: var(--border-color) !important;
    color: var(--text-primary) !important;
    font-family: monospace !important;
    text-align: left !important;
}

.password-copy-wrapper {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
}

.inline-copy-btn {
    position: relative !important;
    right: auto !important;
    padding: 4px !important;
    font-size: 1.5rem !important;
    background: transparent !important;
    border: none !important;
    cursor: pointer !important;
    color: var(--text-secondary) !important;
}

.flex-1 {
    flex: 1;
}

.input-with-buttons {
    display: flex;
    align-items: center;
}

.prefix-input {
    padding-right: 80px !important;
}

.prefix-buttons-wrapper {
    position: absolute;
    right: 6px;
    display: flex;
    gap: 4px;
}

.full-width-btn {
    width: 100%;
}

.recover-input {
    padding: 16px 20px !important;
}

.alert-modal-content {
    max-width: 400px;
    text-align: center;
}

.alert-modal-header {
    justify-content: center;
    border-bottom: none;
    padding-bottom: 10px;
}

.alert-modal-title {
    color: var(--text-primary);
}

.alert-modal-body {
    background: transparent !important;
    color: var(--text-secondary) !important;
    min-height: auto !important;
    padding-top: 0 !important;
    padding-bottom: 30px !important;
}

.alert-modal-footer {
    padding: 0 24px 24px;
}

.alert-btn {
    width: 100%;
    justify-content: center;
}

/* Auth Page Styles */
.auth-body {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100vh;
    position: relative;
}

.auth-panel {
    padding: 40px;
    text-align: center;
    max-width: 400px;
    width: 90%;
    z-index: 1;
}

.auth-icon-wrapper {
    margin-bottom: 20px;
}

.auth-lock-icon {
    font-size: 48px;
    color: #10B981;
}

.auth-title {
    margin-bottom: 10px;
}

.auth-subtitle {
    margin-bottom: 20px;
    color: #9ca3af;
}

.auth-error {
    color: #ef4444;
    margin-bottom: 15px;
    font-size: 14px;
}

.auth-input {
    width: 100%;
    padding: 12px 15px !important;
    margin-bottom: 15px;
    border-radius: 8px !important;
    border: 1px solid rgba(255,255,255,0.1) !important;
    background: rgba(0,0,0,0.2) !important;
    color: white !important;
}

.justify-center {
    justify-content: center;
}
