/* Dark Theme Webmail */
:root {
    --bg-dark: #0a0f1c;
    --bg-darker: #05080f;
    --card-bg: #121826;
    --card-border: #243049;
    --input-bg: #0c111c;
    --input-border: #283448;
    --text-white: #ffffff;
    --text-muted: #8b94ad;
    --accent-from: #2f7bff;
    --accent-to: #5aa0ff;
    --glow: rgba(47, 123, 255, 0.55);
}

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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #0f1117;
    color: #e2e8f0;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

/* Login (new design) */
.page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background:
        radial-gradient(circle at 50% 30%, rgba(47, 123, 255, 0.12) 0%, transparent 55%),
        radial-gradient(circle at 50% 45%, #101a2e 0%, var(--bg-dark) 50%, var(--bg-darker) 100%);
    color: var(--text-white);
}

.card {
    position: relative;
    width: 100%;
    max-width: 420px;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 18px;
    padding: 80px 36px 40px;
    margin-top: 70px;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(47, 123, 255, 0.06);
}

.avatar {
    position: absolute;
    top: -70px;
    left: 50%;
    transform: translateX(-50%);
    width: 130px;
    height: 130px;
    border-radius: 50%;
    padding: 4px;
    background: linear-gradient(145deg, var(--accent-from), var(--accent-to));
    box-shadow: 0 0 0 6px rgba(47, 123, 255, 0.12), 0 0 30px var(--glow);
}

.avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
    background: #0e1626;
    display: block;
}

.card-head {
    text-align: center;
    margin-bottom: 32px;
}

.brand {
    font-size: 30px;
    font-weight: 800;
    letter-spacing: -0.5px;
    margin-bottom: 10px;
}

.subtitle {
    font-size: 14px;
    color: var(--text-muted);
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.field {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.field label {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-white);
}

.field input {
    width: 100%;
    background: var(--input-bg);
    border: 1px solid var(--input-border);
    border-radius: 10px;
    padding: 13px 14px;
    font-size: 14px;
    color: var(--text-white);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.field input::placeholder {
    color: var(--text-muted);
}

.field input:focus {
    outline: none;
    border-color: var(--accent-from);
    box-shadow: 0 0 0 3px rgba(124, 92, 252, 0.2);
}

.btn-signin {
    margin-top: 8px;
    width: 100%;
    border: none;
    border-radius: 10px;
    padding: 14px;
    font-size: 15px;
    font-weight: 700;
    color: var(--text-white);
    cursor: pointer;
    background: linear-gradient(90deg, var(--accent-from), var(--accent-to));
    transition: opacity 0.15s ease, transform 0.05s ease;
}

.btn-signin:hover {
    opacity: 0.92;
}

.btn-signin:active {
    transform: translateY(1px);
}

/* Forms */
.form-group {
    margin-bottom: 18px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-size: 13px;
    font-weight: 600;
    color: #cbd5e1;
}

.form-group input,
.form-group textarea,
.disabled-input {
    width: 100%;
    padding: 12px 14px;
    background: #0f1117;
    border: 1px solid #2a2e3b;
    border-radius: 10px;
    color: #e2e8f0;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-group input:focus,
.form-group textarea:focus {
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

.form-group textarea {
    resize: vertical;
    min-height: 140px;
}

.disabled-input {
    background: #1a1d29;
    color: #64748b;
    cursor: not-allowed;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.checkbox-group label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 400;
    cursor: pointer;
}

.checkbox-group input {
    width: auto;
}

/* Buttons */
.btn-primary {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: #fff;
    border: none;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.2s, transform 0.2s;
}

.btn-primary:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

.btn-small {
    display: inline-block;
    padding: 8px 16px;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: #fff;
    text-decoration: none;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    transition: opacity 0.2s;
}

.btn-small:hover { opacity: 0.9; }

.btn-outline {
    background: transparent;
    border: 1px solid #3b3f4f;
    color: #cbd5e1;
}

.btn-outline:hover {
    background: #2a2e3b;
}

/* Alerts */
.error {
    background: #2a1215;
    border: 1px solid #7f1d1d;
    color: #fca5a5;
    padding: 12px 16px;
    border-radius: 10px;
    margin-bottom: 20px;
    font-size: 14px;
}

.success {
    background: #132a1f;
    border: 1px solid #166534;
    color: #86efac;
    padding: 12px 16px;
    border-radius: 10px;
    margin-bottom: 20px;
    font-size: 14px;
}

/* Navbar */
.navbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 32px;
    background: #181b24;
    border-bottom: 1px solid #2a2e3b;
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-brand {
    font-size: 20px;
    font-weight: 700;
    background: linear-gradient(135deg, #818cf8, #c084fc);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.nav-user {
    font-size: 13px;
    color: #94a3b8;
}

.nav-actions {
    display: flex;
    gap: 10px;
}

/* Container */
.container {
    max-width: 900px;
    margin: 30px auto;
    padding: 0 20px;
}

.page-title {
    font-size: 22px;
    margin-bottom: 20px;
    color: #fff;
}

/* Email List */
.email-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.email-item {
    display: grid;
    grid-template-columns: 1fr 2fr auto;
    gap: 16px;
    align-items: center;
    padding: 16px 20px;
    background: #181b24;
    border: 1px solid #2a2e3b;
    border-radius: 12px;
    text-decoration: none;
    color: #e2e8f0;
    transition: background 0.2s, border-color 0.2s;
}

.email-item:hover {
    background: #1e2130;
    border-color: #3b3f4f;
}

.email-from {
    font-weight: 600;
    color: #fff;
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.email-subject {
    color: #cbd5e1;
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.email-date {
    color: #64748b;
    font-size: 12px;
    white-space: nowrap;
}

.empty {
    text-align: center;
    padding: 60px;
    color: #64748b;
}

/* Read Email */
.email-read-card {
    background: #181b24;
    border: 1px solid #2a2e3b;
    border-radius: 16px;
    overflow: hidden;
}

.email-read-header {
    padding: 24px;
    border-bottom: 1px solid #2a2e3b;
    background: #1a1d29;
}

.read-row {
    margin-bottom: 10px;
    font-size: 14px;
}

.read-row strong {
    color: #94a3b8;
    display: inline-block;
    width: 80px;
}

.email-read-body {
    padding: 24px;
}

.email-read-body pre {
    white-space: pre-wrap;
    word-wrap: break-word;
    font-family: 'Segoe UI', sans-serif;
    line-height: 1.7;
    color: #e2e8f0;
}

/* Compose */
.compose-form {
    background: #181b24;
    border: 1px solid #2a2e3b;
    border-radius: 16px;
    padding: 28px;
}

/* Mailbox */
.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 14px 24px;
    background: var(--card-bg);
    border-bottom: 1px solid var(--card-border);
    position: sticky;
    top: 0;
    z-index: 10;
}

.logo {
    font-size: 22px;
    font-weight: 800;
    background: linear-gradient(90deg, var(--accent-from), var(--accent-to));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.topbar-center {
    flex: 1;
    display: flex;
    justify-content: center;
}

.user-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: var(--text-muted);
    background: var(--input-bg);
    border: 1px solid var(--card-border);
    padding: 7px 14px;
    border-radius: 999px;
}

.user-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #34d399;
    box-shadow: 0 0 8px #34d399;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

.btn-compose {
    color: var(--text-white);
    background: linear-gradient(90deg, var(--accent-from), var(--accent-to));
    border: 1px solid transparent;
    border-radius: 10px;
    padding: 10px 16px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: opacity 0.15s ease, transform 0.05s ease;
}

.btn-compose:hover { opacity: 0.92; }
.btn-compose .plus { font-size: 16px; line-height: 1; }

.btn-logout {
    color: var(--text-white);
    background: var(--input-bg);
    border: 1px solid var(--card-border);
    border-radius: 10px;
    padding: 10px 16px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: background 0.15s ease, transform 0.05s ease;
}

.btn-logout:hover { background: #1a2336; }

.layout {
    display: grid;
    grid-template-columns: 240px 1fr;
    min-height: calc(100vh - 61px);
}

.sidebar {
    border-right: 1px solid var(--card-border);
    padding: 20px 14px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.folders {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.folder {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 11px 14px;
    border-radius: 10px;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
    transition: background 0.15s ease, color 0.15s ease;
}

.folder:hover {
    background: var(--input-bg);
    color: var(--text-white);
}

.folder.active {
    background: rgba(47, 123, 255, 0.14);
    color: var(--text-white);
}

.badge {
    background: linear-gradient(90deg, var(--accent-from), var(--accent-to));
    color: var(--text-white);
    font-size: 12px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 999px;
}

.storage {
    padding: 14px;
    background: var(--input-bg);
    border: 1px solid var(--card-border);
    border-radius: 12px;
}

.storage-label {
    font-size: 12px;
    font-weight: 700;
    color: var(--text-white);
    margin-bottom: 8px;
}

.storage-bar {
    height: 6px;
    background: #1a2336;
    border-radius: 999px;
    overflow: hidden;
    margin-bottom: 8px;
}

.storage-bar span {
    display: block;
    height: 100%;
    background: linear-gradient(90deg, var(--accent-from), var(--accent-to));
}

.storage-text {
    font-size: 12px;
    color: var(--text-muted);
}

.content {
    padding: 24px 28px;
}

.content-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 20px;
}

.content-head .page-title {
    font-size: 24px;
    font-weight: 800;
}

.search input {
    width: 280px;
    max-width: 50vw;
    background: var(--input-bg);
    border: 1px solid var(--input-border);
    border-radius: 10px;
    padding: 10px 14px;
    font-size: 14px;
    color: var(--text-white);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.search input::placeholder { color: var(--text-muted); }

.search input:focus {
    outline: none;
    border-color: var(--accent-from);
    box-shadow: 0 0 0 3px rgba(47, 123, 255, 0.2);
}

.mail-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.mail-item {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 12px;
    cursor: pointer;
    transition: border-color 0.15s ease, transform 0.05s ease, background 0.15s ease;
    overflow: hidden;
}

.mail-item:hover {
    border-color: var(--accent-from);
    background: #151d2e;
}

.mail-item:active { transform: translateY(1px); }

.mail-link {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 14px 16px;
    text-decoration: none;
    color: inherit;
}

.sender-avatar {
    flex-shrink: 0;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 16px;
    color: var(--text-white);
    background: linear-gradient(145deg, var(--accent-from), var(--accent-to));
}

.mail-body {
    flex: 1;
    min-width: 0;
}

.mail-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 2px;
}

.mail-from {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-white);
}

.mail-time {
    font-size: 12px;
    color: var(--text-muted);
    flex-shrink: 0;
}

.mail-subject {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-white);
    margin-bottom: 3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.mail-preview {
    font-size: 13px;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.5;
}

/* Responsive */
@media (max-width: 640px) {
    .login-card { padding: 28px; }
    .form-row { grid-template-columns: 1fr; }
    .navbar { flex-wrap: wrap; gap: 10px; padding: 14px 16px; }
    .nav-actions { width: 100%; justify-content: flex-end; }
    .email-item { grid-template-columns: 1fr; gap: 4px; padding: 14px; }
    .container { margin: 20px auto; }
}

@media (max-width: 760px) {
    .layout { grid-template-columns: 1fr; }
    .sidebar {
        flex-direction: row;
        align-items: center;
        border-right: none;
        border-bottom: 1px solid var(--card-border);
        overflow-x: auto;
    }
    .folders { flex-direction: row; }
    .storage { display: none; }
    .topbar-center { display: none; }
    .search input { width: 160px; }
}
