/* ===================================
   TempMail Pro - Premium Stylesheet
   =================================== */

/* CSS Custom Properties (Design Tokens) */
:root {
    /* Colors - Light Mode */
    --color-primary: hsl(250, 85%, 60%);
    --color-primary-hover: hsl(250, 85%, 55%);
    --color-secondary: hsl(280, 70%, 65%);
    --color-accent: hsl(320, 85%, 60%);

    --color-bg: hsl(240, 25%, 96%);
    --color-surface: hsl(0, 0%, 100%);
    --color-surface-glass: hsla(0, 0%, 100%, 0.85);

    --color-text-primary: hsl(240, 20%, 15%);
    --color-text-secondary: hsl(240, 10%, 45%);
    --color-text-muted: hsl(240, 5%, 65%);

    --color-border: hsl(240, 15%, 90%);
    --color-shadow: hsla(240, 30%, 20%, 0.1);

    --color-success: hsl(140, 70%, 50%);
    --color-error: hsl(0, 70%, 60%);

    /* Gradients */
    --gradient-primary: linear-gradient(135deg, hsl(250, 85%, 60%) 0%, hsl(280, 70%, 65%) 100%);
    --gradient-accent: linear-gradient(135deg, hsl(280, 70%, 65%) 0%, hsl(320, 85%, 60%) 100%);
    --gradient-bg: linear-gradient(135deg, hsl(240, 40%, 98%) 0%, hsl(260, 50%, 96%) 50%, hsl(280, 40%, 97%) 100%);
    --gradient-card: linear-gradient(135deg, hsla(250, 100%, 98%, 0.9) 0%, hsla(280, 100%, 98%, 0.8) 100%);

    /* Spacing */
    --spacing-xs: 0.5rem;
    --spacing-sm: 0.75rem;
    --spacing-md: 1rem;
    --spacing-lg: 1.5rem;
    --spacing-xl: 2rem;
    --spacing-2xl: 3rem;

    /* Border Radius */
    --radius-sm: 0.5rem;
    --radius-md: 0.75rem;
    --radius-lg: 1rem;
    --radius-xl: 1.5rem;

    /* Shadows */
    --shadow-sm: 0 2px 8px var(--color-shadow);
    --shadow-md: 0 4px 16px var(--color-shadow);
    --shadow-lg: 0 8px 32px var(--color-shadow);
    --shadow-glow: 0 0 40px hsla(250, 85%, 60%, 0.3);

    /* Typography */
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-size-xs: 0.75rem;
    --font-size-sm: 0.875rem;
    --font-size-base: 1rem;
    --font-size-lg: 1.125rem;
    --font-size-xl: 1.5rem;
    --font-size-2xl: 2rem;

    /* Transitions */
    --transition-fast: 150ms ease;
    --transition-base: 250ms ease;
    --transition-slow: 350ms ease;
}

/* Dark Mode */
[data-theme="dark"] {
    --color-bg: hsl(240, 25%, 8%);
    --color-surface: hsl(240, 20%, 12%);
    --color-surface-glass: hsla(240, 20%, 12%, 0.85);

    --color-text-primary: hsl(0, 0%, 95%);
    --color-text-secondary: hsl(240, 5%, 70%);
    --color-text-muted: hsl(240, 5%, 50%);

    --color-border: hsl(240, 15%, 20%);
    --color-shadow: hsla(0, 0%, 0%, 0.4);

    --gradient-bg: linear-gradient(135deg, hsl(240, 30%, 8%) 0%, hsl(260, 35%, 10%) 50%, hsl(280, 30%, 12%) 100%);
    --gradient-card: linear-gradient(135deg, hsla(250, 40%, 15%, 0.6) 0%, hsla(280, 40%, 18%, 0.5) 100%);
    --shadow-glow: 0 0 60px hsla(250, 85%, 60%, 0.2);
}

/* ===================================
   Base Styles
   =================================== */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-family);
    font-size: var(--font-size-base);
    line-height: 1.6;
    color: var(--color-text-primary);
    background: var(--gradient-bg);
    background-attachment: fixed;
    min-height: 100vh;
    transition: background var(--transition-base), color var(--transition-base);
    position: relative;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image:
        radial-gradient(circle at 20% 30%, hsla(250, 85%, 60%, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 70%, hsla(320, 85%, 60%, 0.1) 0%, transparent 50%);
    pointer-events: none;
    z-index: 0;
}

/* ===================================
   Layout
   =================================== */

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: var(--spacing-xl) var(--spacing-md);
    position: relative;
    z-index: 1;
}

/* ===================================
   Theme Toggle
   =================================== */

.theme-toggle {
    position: fixed;
    top: var(--spacing-lg);
    right: var(--spacing-lg);
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-md);
    transition: all var(--transition-base);
    z-index: 1000;
}

.theme-toggle:hover {
    transform: scale(1.05);
    box-shadow: var(--shadow-lg);
}

.theme-toggle svg {
    color: var(--color-text-primary);
    transition: all var(--transition-base);
}

.theme-toggle .moon-icon {
    display: none;
}

[data-theme="dark"] .theme-toggle .sun-icon {
    display: none;
}

[data-theme="dark"] .theme-toggle .moon-icon {
    display: block;
}

/* ===================================
   Header
   =================================== */

.header {
    text-align: center;
    margin-bottom: var(--spacing-2xl);
    animation: fadeInDown 0.6s ease;
}

.logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-md);
    margin-bottom: var(--spacing-sm);
}

.logo svg {
    color: var(--color-primary);
    filter: drop-shadow(0 2px 8px hsla(250, 85%, 60%, 0.3));
}

.header h1 {
    font-size: var(--font-size-2xl);
    font-weight: 700;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.tagline {
    color: var(--color-text-secondary);
    font-size: var(--font-size-lg);
    font-weight: 300;
}

/* ===================================
   Cards
   =================================== */

.card {
    background: var(--gradient-card);
    border-radius: var(--radius-xl);
    padding: var(--spacing-xl);
    box-shadow: var(--shadow-lg);
    transition: all var(--transition-base);
    position: relative;
    overflow: hidden;
}

.card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--gradient-primary);
    opacity: 0;
    transition: opacity var(--transition-base);
}

.card:hover::before {
    opacity: 1;
}

.glass-card {
    background: var(--color-surface-glass);
    backdrop-filter: blur(30px) saturate(180%);
    -webkit-backdrop-filter: blur(30px) saturate(180%);
    border: 1px solid var(--color-border);
    box-shadow: var(--shadow-lg), var(--shadow-glow);
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--spacing-lg);
    padding-bottom: var(--spacing-md);
    border-bottom: 1px solid var(--color-border);
}

.card-header h2 {
    font-size: var(--font-size-xl);
    font-weight: 600;
    color: var(--color-text-primary);
}

/* ===================================
   Email Section
   =================================== */

.email-section {
    margin-bottom: var(--spacing-xl);
    animation: fadeInUp 0.6s ease 0.1s both;
}

.email-display {
    display: flex;
    gap: var(--spacing-md);
    align-items: center;
    flex-wrap: wrap;
}

.email-address {
    flex: 1;
    min-width: 250px;
    padding: var(--spacing-md) var(--spacing-lg);
    background: var(--color-bg);
    border: 2px solid var(--color-border);
    border-radius: var(--radius-md);
    font-size: var(--font-size-lg);
    font-weight: 500;
    color: var(--color-primary);
    word-break: break-all;
    transition: all var(--transition-base);
}

.email-address:hover {
    border-color: var(--color-primary);
}

.loading-text {
    color: var(--color-text-muted);
    font-style: italic;
}

.copy-feedback {
    position: absolute;
    top: -40px;
    right: 0;
    background: var(--color-success);
    color: white;
    padding: var(--spacing-sm) var(--spacing-md);
    border-radius: var(--radius-sm);
    font-size: var(--font-size-sm);
    font-weight: 500;
    opacity: 0;
    transform: translateY(10px);
    transition: all var(--transition-base);
    pointer-events: none;
    box-shadow: var(--shadow-md);
}

.copy-feedback.show {
    opacity: 1;
    transform: translateY(0);
}

.email-section .card {
    position: relative;
}

.expiration-timer {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    margin-top: var(--spacing-md);
    padding: var(--spacing-sm) var(--spacing-md);
    background: linear-gradient(135deg, hsla(250, 85%, 60%, 0.1) 0%, hsla(280, 70%, 65%, 0.1) 100%);
    border-radius: var(--radius-md);
    border: 1px solid hsla(250, 85%, 60%, 0.2);
}

.expiration-timer svg {
    color: var(--color-primary);
    flex-shrink: 0;
}

.expiration-timer span {
    font-size: var(--font-size-sm);
    color: var(--color-text-secondary);
    font-weight: 500;
}

.expiration-timer.warning {
    background: linear-gradient(135deg, hsla(40, 100%, 50%, 0.1) 0%, hsla(30, 100%, 50%, 0.1) 100%);
    border-color: hsla(40, 100%, 50%, 0.3);
}

.expiration-timer.warning svg,
.expiration-timer.warning span {
    color: hsl(40, 100%, 50%);
}

.expiration-timer.expired {
    background: linear-gradient(135deg, hsla(0, 70%, 60%, 0.1) 0%, hsla(10, 70%, 60%, 0.1) 100%);
    border-color: hsla(0, 70%, 60%, 0.3);
}

.expiration-timer.expired svg,
.expiration-timer.expired span {
    color: var(--color-error);
}

/* ===================================
   Buttons
   =================================== */

.btn {
    padding: var(--spacing-sm) var(--spacing-lg);
    border: none;
    border-radius: var(--radius-md);
    font-size: var(--font-size-base);
    font-weight: 500;
    font-family: var(--font-family);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: var(--spacing-sm);
    transition: all var(--transition-base);
    white-space: nowrap;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-primary {
    background: var(--gradient-primary);
    color: white;
    box-shadow: 0 4px 12px hsla(250, 85%, 60%, 0.3);
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px hsla(250, 85%, 60%, 0.4);
}

.btn-primary:active:not(:disabled) {
    transform: translateY(0);
}

.btn-secondary {
    background: var(--color-surface);
    color: var(--color-text-primary);
    border: 1px solid var(--color-border);
}

.btn-secondary:hover:not(:disabled) {
    background: var(--color-bg);
    border-color: var(--color-primary);
}

.btn-icon {
    padding: var(--spacing-sm);
    background: transparent;
    color: var(--color-text-secondary);
    border: 1px solid transparent;
}

.btn-icon:hover:not(:disabled) {
    background: var(--color-bg);
    color: var(--color-primary);
    border-color: var(--color-border);
}

/* ===================================
   Content Grid
   =================================== */

.content-grid {
    display: grid;
    grid-template-columns: 1fr 1.5fr;
    gap: var(--spacing-xl);
    margin-bottom: var(--spacing-xl);
}

/* ===================================
   Inbox Section
   =================================== */

.inbox-section {
    animation: fadeInUp 0.6s ease 0.2s both;
}

.inbox-controls {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
}

.message-count {
    font-size: var(--font-size-sm);
    color: var(--color-text-secondary);
    font-weight: 500;
}

.message-list {
    max-height: 600px;
    overflow-y: auto;
    margin: calc(-1 * var(--spacing-md));
    padding: var(--spacing-md);
}

/* Custom Scrollbar */
.message-list::-webkit-scrollbar {
    width: 8px;
}

.message-list::-webkit-scrollbar-track {
    background: transparent;
}

.message-list::-webkit-scrollbar-thumb {
    background: var(--color-border);
    border-radius: var(--radius-sm);
}

.message-list::-webkit-scrollbar-thumb:hover {
    background: var(--color-text-muted);
}

.message-item {
    padding: var(--spacing-md);
    border-radius: var(--radius-md);
    border: 1px solid var(--color-border);
    margin-bottom: var(--spacing-md);
    cursor: pointer;
    transition: all var(--transition-base);
    animation: slideInLeft 0.3s ease;
}

.message-item:hover {
    background: var(--color-bg);
    border-color: var(--color-primary);
    transform: translateX(4px);
}

.message-item.active {
    background: var(--gradient-primary);
    border-color: var(--color-primary);
    color: white;
}

.message-item.active .message-from,
.message-item.active .message-subject,
.message-item.active .message-date {
    color: white;
}

.message-from {
    font-weight: 600;
    color: var(--color-text-primary);
    margin-bottom: var(--spacing-xs);
    font-size: var(--font-size-sm);
}

.message-subject {
    color: var(--color-text-secondary);
    margin-bottom: var(--spacing-xs);
    font-size: var(--font-size-base);
    font-weight: 500;
}

.message-date {
    font-size: var(--font-size-xs);
    color: var(--color-text-muted);
}

/* ===================================
   Email Viewer Section
   =================================== */

.viewer-section {
    animation: fadeInUp 0.6s ease 0.3s both;
}

.email-viewer {
    min-height: 600px;
}

.email-content {
    animation: fadeIn 0.4s ease;
}

.email-header {
    padding-bottom: var(--spacing-lg);
    margin-bottom: var(--spacing-lg);
    border-bottom: 2px solid var(--color-border);
}

.email-meta {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
    margin-bottom: var(--spacing-md);
}

.email-meta-row {
    display: flex;
    gap: var(--spacing-sm);
}

.email-meta-label {
    font-weight: 600;
    color: var(--color-text-secondary);
    min-width: 80px;
}

.email-meta-value {
    color: var(--color-text-primary);
    word-break: break-word;
}

.email-subject-display {
    font-size: var(--font-size-xl);
    font-weight: 700;
    color: var(--color-text-primary);
    margin-top: var(--spacing-md);
}

.email-body {
    color: var(--color-text-primary);
    line-height: 1.8;
    padding: var(--spacing-lg);
    background: var(--color-bg);
    border-radius: var(--radius-md);
    border: 1px solid var(--color-border);
}

.email-body iframe {
    width: 100%;
    min-height: 400px;
    border: none;
    border-radius: var(--radius-sm);
}

/* ===================================
   Empty State
   =================================== */

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--spacing-2xl);
    text-align: center;
    min-height: 300px;
}

.empty-state svg {
    color: var(--color-text-muted);
    margin-bottom: var(--spacing-lg);
    opacity: 0.5;
}

.empty-state p {
    font-size: var(--font-size-lg);
    font-weight: 500;
    color: var(--color-text-secondary);
    margin-bottom: var(--spacing-sm);
}

.empty-state small {
    color: var(--color-text-muted);
    font-size: var(--font-size-sm);
}

/* ===================================
   Footer
   =================================== */

.footer {
    text-align: center;
    padding: var(--spacing-xl) 0;
    color: var(--color-text-muted);
    font-size: var(--font-size-sm);
    animation: fadeIn 0.6s ease 0.4s both;
}

/* ===================================
   Animations
   =================================== */

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

.rotating {
    animation: spin 1s linear infinite;
}

/* ===================================
   Responsive Design
   =================================== */

@media (max-width: 1024px) {
    .content-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .container {
        padding: var(--spacing-md);
    }

    .header h1 {
        font-size: var(--font-size-xl);
    }

    .tagline {
        font-size: var(--font-size-base);
    }

    .card {
        padding: var(--spacing-md);
    }

    .email-display {
        flex-direction: column;
    }

    .email-address {
        width: 100%;
    }

    .theme-toggle {
        top: var(--spacing-md);
        right: var(--spacing-md);
    }

    .card-header {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--spacing-md);
    }
}

@media (max-width: 480px) {
    .header h1 {
        font-size: var(--font-size-lg);
    }

    .logo svg {
        width: 24px;
        height: 24px;
    }

    .card-header h2 {
        font-size: var(--font-size-lg);
    }
}