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

:root {
    --bg-primary: #0f1419;
    --bg-secondary: #1a2332;
    --bg-tertiary: #243447;
    --text-primary: #ffffff;
    --text-secondary: #a0aec0;
    --text-tertiary: #718096;
    --border-color: #2d3e52;
    --accent-color: #00d4d4;
    --accent-dark: #00a8a8;
    --success-color: #10b981;
    --error-color: #ef4444;
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 8px 16px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 16px 32px rgba(0, 0, 0, 0.5);
}

body.light-mode {
    --bg-primary: #f5f7fa;
    --bg-secondary: #eff2f5;
    --bg-tertiary: #e8ecf1;
    --text-primary: #1a1a1a;
    --text-secondary: #4a5568;
    --text-tertiary: #718096;
    --border-color: #d4dce5;
    --accent-color: #0099cc;
    --accent-dark: #0077aa;
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.08);
    --shadow-md: 0 8px 16px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 16px 32px rgba(0, 0, 0, 0.15);
}

html, body {
    height: 100%;
    width: 100%;
}

body {
    font-family: "Segoe UI", Arial, sans-serif;
    background: linear-gradient(135deg, #0a0e13 0%, #0f1419 50%, #1a2332 100%);
    color: var(--text-primary);
    min-height: 100vh;
    padding: 30px 20px;
    transition: all 0.3s ease;
    line-height: 1.5;
    font-weight: 400;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body.light-mode {
    background: linear-gradient(135deg, #f0f3f7 0%, #f5f7fa 50%, #eef1f6 100%);
}

.container {
    max-width: 850px;
    margin: 0 auto;
    padding: 50px 30px;
}

/* Header */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 50px;
    flex-wrap: wrap;
    gap: 20px;
    animation: slideDown 0.6s ease;
}

#logoText {
    font-size: 1.7rem;
    font-weight: 700;
    color: var(--text-primary);
    position: relative;
}

#logoText::after {
    content: "";
    position: absolute;
    left: 0;
    bottom: -3px;
    width: 40%;
    height: 2px;
    background: var(--accent-color);
    border-radius: 2px;
    transition: width 0.3s ease;
}

.header-logo:hover #logoText::after {
    width: 100%;
}

.header-logo {
    font-size: 1.8em;
    font-weight: 700;
    color: var(--accent-color);
    letter-spacing: 0.8px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.logo-img {
    height: 32px;
    width: 32px;
    object-fit: contain;
}

.header-controls {
    display: flex;
    gap: 15px;
    align-items: center;
}

.lang-toggle, .theme-toggle {
    padding: 10px 18px;
    border: 1.5px solid var(--border-color);
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s ease;
}

.lang-toggle:hover, .theme-toggle:hover {
    background-color: var(--accent-color);
    color: var(--bg-primary);
    border-color: var(--accent-color);
    transform: translateY(-2px);
}

/* Main Card */
.main-card {
    background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--bg-tertiary) 100%);
    border-radius: 16px;
    padding: 45px;
    margin-bottom: 30px;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-md);
    animation: slideUp 0.6s ease 0.1s both;
}

.card-header {
    margin-bottom: 35px;
}

.card-label {
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 1px;
    color: var(--accent-color);
    text-transform: uppercase;
    margin-bottom: 12px;
}

.card-title {
    font-size: 2.1em;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 10px;
    line-height: 1.25;
}

.card-subtitle {
    font-size: 16px;
    color: var(--text-secondary);
    line-height: 1.65;
    font-weight: 400;
}

/* Email Display Section */
.email-display-section {
    margin-bottom: 30px;
}

.email-display-label {
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.8px;
    color: var(--text-tertiary);
    text-transform: uppercase;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.status-dot {
    width: 10px;
    height: 10px;
    background-color: var(--accent-color);
    border-radius: 50%;
    animation: pulse 2s ease-in-out infinite;
}

.email-display {
    display: flex;
    gap: 0;
    border-radius: 12px;
    overflow: hidden;
    border: 1.5px solid var(--border-color);
    background-color: var(--bg-primary);
    box-shadow: var(--shadow-sm);
}

.email-display input {
    flex: 1;
    padding: 18px 20px;
    font-size: 16px;
    border: none;
    outline: none;
    background-color: transparent;
    color: var(--text-primary);
    font-weight: 500;
    transition: all 0.3s ease;
    font-family: inherit;
}

.email-display input::placeholder {
    color: var(--text-tertiary);
}

.email-display input:focus {
    box-shadow: inset 0 0 0 2px var(--accent-color);
}

.email-display select {
    padding: 18px 20px;
    font-size: 16px;
    background-color: transparent;
    border: none;
    color: var(--text-primary);
    cursor: pointer;
    font-weight: 600;
    outline: none;
    min-width: 180px;
    font-family: inherit;
}

.email-display select option {
    background-color: var(--bg-secondary);
    color: var(--text-primary);
}

.email-display button {
    padding: 18px 20px;
    background-color: transparent;
    border: none;
    color: var(--accent-color);
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: inherit;
}

.email-display button:hover {
    background-color: rgba(0, 212, 212, 0.15);
    color: #00ffff;
}

/* Email Info */
.email-info {
    font-size: 13px;
    color: var(--text-tertiary);
    margin-top: 12px;
    padding-left: 0;
    line-height: 1.5;
}

/* Action Buttons */
.action-buttons {
    display: flex;
    gap: 14px;
    flex-wrap: wrap;
    margin-bottom: 0;
}

.action-buttons button {
    flex: 1;
    min-width: 120px;
    padding: 16px 20px;
    border: 1.5px solid var(--border-color);
    background: linear-gradient(135deg, rgba(0, 212, 212, 0.05) 0%, rgba(0, 212, 212, 0.02) 100%);
    color: var(--text-primary);
    border-radius: 10px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-family: inherit;
}

.action-buttons button:hover {
    background: linear-gradient(135deg, var(--accent-color) 0%, #00a8a8 100%);
    color: var(--bg-primary);
    border-color: var(--accent-color);
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(0, 212, 212, 0.3);
}

.action-buttons button:active {
    transform: translateY(-1px);
}

.delete-btn {
    border-color: var(--error-color);
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.05) 0%, rgba(239, 68, 68, 0.02) 100%);
    color: var(--error-color);
}

.delete-btn:hover {
    background: linear-gradient(135deg, var(--error-color) 0%, #dc2626 100%);
    color: white;
    border-color: var(--error-color);
    box-shadow: 0 8px 20px rgba(239, 68, 68, 0.3);
}

/* Inbox Section */
.inbox-section {
    background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--bg-tertiary) 100%);
    border-radius: 16px;
    padding: 0;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-md);
    overflow: hidden;
    animation: slideUp 0.6s ease 0.2s both;
}

.inbox-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 25px 35px;
    border-bottom: 1.5px solid var(--border-color);
    background: linear-gradient(90deg, rgba(0, 212, 212, 0.08) 0%, transparent 100%);
}

.inbox-title {
    font-size: 1.6em;
    font-weight: 700;
    color: var(--text-primary);
}

.refresh-btn {
    padding: 10px 18px;
    background-color: transparent;
    border: 1.5px solid var(--border-color);
    color: var(--accent-color);
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    font-size: 14px;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: inherit;
}

.refresh-btn:hover {
    background: linear-gradient(135deg, rgba(0, 212, 212, 0.1) 0%, transparent 100%);
    border-color: var(--accent-color);
    transform: translateY(-2px);
}

.inbox-content {
    padding: 30px;
    min-height: 300px;
}

.inbox table {
    width: 100%;
    border-collapse: collapse;
}

.inbox table thead {
    background-color: rgba(0, 212, 212, 0.08);
}

.inbox table th {
    padding: 16px;
    text-align: left;
    font-weight: 700;
    font-size: 13px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.6px;
}

.inbox table tbody tr {
    border-bottom: 1px solid var(--border-color);
    transition: all 0.2s ease;
    cursor: pointer;
}

.inbox table tbody tr:hover {
    background-color: rgba(0, 212, 212, 0.08);
}

.inbox table td {
    padding: 16px;
    color: var(--text-secondary);
    font-size: 14px;
    line-height: 1.5;
}

.inbox table tbody tr:last-child {
    border-bottom: none;
}

.empty-inbox {
    text-align: center;
    padding: 80px 30px;
    color: var(--text-tertiary);
}

.empty-inbox-icon {
    font-size: 4.5em;
    margin-bottom: 20px;
    opacity: 0.6;
    animation: float 3s ease-in-out infinite;
}

.empty-inbox p {
    font-size: 16px;
    font-weight: 500;
}

/* Mail Detail View */
.mail-detail {
    background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--bg-tertiary) 100%);
    border-radius: 16px;
    padding: 35px;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-md);
}

.mail-detail h3 {
    color: var(--text-primary);
    font-size: 1.6em;
    margin-bottom: 25px;
    font-weight: 700;
    line-height: 1.3;
}

.mail-meta {
    background-color: rgba(0, 212, 212, 0.08);
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 25px;
    border-left: 4px solid var(--accent-color);
}

.mail-meta-item {
    margin-bottom: 10px;
    color: var(--text-secondary);
    font-size: 14px;
    line-height: 1.5;
}

.mail-meta-item strong {
    color: var(--text-primary);
    font-weight: 600;
}

.mail-body {
    background-color: var(--bg-primary);
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 25px;
    line-height: 1.7;
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
    font-size: 14px;
}

.back-btn {
    padding: 12px 22px;
    background: linear-gradient(135deg, var(--accent-color) 0%, #00a8a8 100%);
    color: var(--bg-primary);
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 700;
    transition: all 0.3s ease;
    font-size: 14px;
    font-family: inherit;
}

.back-btn:hover {
    background: linear-gradient(135deg, #00ffff 0%, #00d4d4 100%);
    transform: translateY(-2px);
}

/* Modal Styles */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    z-index: 1001;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
    animation: fadeIn 0.3s ease;
}

.modal-overlay.show {
    display: flex;
}

.modal-content {
    background-color: var(--bg-secondary);
    border-radius: 16px;
    padding: 40px;
    box-shadow: var(--shadow-lg);
    max-width: 500px;
    width: 90%;
    border: 1px solid var(--border-color);
    animation: slideUp 0.3s ease;
}

.modal-header {
    margin-bottom: 25px;
    text-align: center;
}

.modal-header h2 {
    color: var(--text-primary);
    font-size: 1.8em;
    margin-bottom: 10px;
    font-weight: 700;
    line-height: 1.3;
}

.modal-header p {
    color: var(--text-secondary);
    font-size: 14px;
    line-height: 1.5;
}

.modal-body {
    margin-bottom: 25px;
}

.modal-body input {
    width: 100%;
    padding: 14px 18px;
    border: 1.5px solid var(--border-color);
    border-radius: 10px;
    font-size: 15px;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    transition: all 0.3s ease;
    box-sizing: border-box;
    font-family: inherit;
}

.modal-body input::placeholder {
    color: var(--text-tertiary);
}

.modal-body input:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(0, 212, 212, 0.2);
}

.modal-footer {
    display: flex;
    gap: 14px;
    justify-content: flex-end;
}

.modal-btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 14px;
    font-family: inherit;
}

.modal-btn-confirm {
    background: linear-gradient(135deg, var(--accent-color) 0%, #00a8a8 100%);
    color: var(--bg-primary);
}

.modal-btn-confirm:hover {
    background: linear-gradient(135deg, #00ffff 0%, #00d4d4 100%);
    transform: translateY(-2px);
}

.modal-btn-cancel {
    background-color: var(--bg-primary);
    color: var(--text-primary);
    border: 1.5px solid var(--border-color);
}

.modal-btn-cancel:hover {
    background-color: var(--border-color);
    transform: translateY(-2px);
}

/* Contact Box */
.contact-box {
    position: fixed;
    bottom: 30px;
    right: 30px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 998;
}

.contact-link {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-decoration: none;
    padding: 14px 18px;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--accent-color) 0%, #00a8a8 100%);
    color: var(--bg-primary);
    font-size: 13px;
    font-weight: 700;
    transition: all 0.3s ease;
    box-shadow: var(--shadow-lg);
    min-width: 140px;
}

.contact-link:hover {
    transform: translateY(-5px);
    box-shadow: 0 16px 40px rgba(0, 212, 212, 0.4);
    text-decoration: none;
}

/* Animations */
@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes float {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-10px);
    }
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

/* Responsive */
@media (max-width: 768px) {
    .container {
        padding: 30px 20px;
    }

    .header {
        flex-direction: column;
        align-items: flex-start;
    }

    .main-card {
        padding: 30px;
    }

    .status-info {
        flex-direction: column;
        gap: 20px;
    }

    .action-buttons {
        flex-direction: column;
    }

    .action-buttons button {
        width: 100%;
    }

    .contact-box {
        bottom: 20px;
        right: 20px;
        gap: 8px;
    }
    
    .contact-link {
        padding: 12px 14px;
        font-size: 12px;
        min-width: 120px;
    }

    .inbox table {
        font-size: 13px;
    }

    .inbox table th,
    .inbox table td {
        padding: 12px;
    }

    .card-title {
        font-size: 1.6em;
    }

    .inbox-title {
        font-size: 1.3em;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 20px 15px;
    }

    .card-title {
        font-size: 1.4em;
    }

    .modal-content {
        padding: 25px;
    }

    .inbox-header {
        padding: 20px 25px;
        flex-direction: column;
        gap: 15px;
        align-items: flex-start;
    }

    .inbox-content {
        padding: 20px;
    }

    .main-card {
        padding: 25px;
    }

    .email-display {
        flex-direction: column;
    }

    .email-display select {
        min-width: 100%;
    }
}