/* Elit Ajans Live Webmail — modern, sade arayüz */
:root {
    --bg: #0f1419;
    --bg-card: #1a2332;
    --bg-hover: #243044;
    --border: #2d3a4f;
    --text: #e8eef7;
    --muted: #8b9bb4;
    --primary: #3b82f6;
    --primary-hover: #2563eb;
    --danger: #ef4444;
    --danger-bg: rgba(239, 68, 68, 0.12);
    --success: #22c55e;
    --radius: 12px;
    --shadow: 0 8px 32px rgba(0, 0, 0, 0.35);
    --font: "Segoe UI", system-ui, -apple-system, sans-serif;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
    min-height: 100%;
}

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

a {
    color: var(--primary);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* —— Login —— */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background:
        radial-gradient(ellipse 80% 50% at 50% -20%, rgba(59, 130, 246, 0.25), transparent),
        var(--bg);
}

.login-wrap {
    width: 100%;
    max-width: 420px;
}

.login-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 32px 28px;
    box-shadow: var(--shadow);
}

.brand {
    text-align: center;
    margin-bottom: 28px;
}

.brand-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 64px;
    height: 64px;
    border-radius: 16px;
    background: linear-gradient(135deg, #3b82f6, #1d4ed8);
    color: #fff;
    margin-bottom: 16px;
}

.brand h1 {
    margin: 0 0 6px;
    font-size: 1.35rem;
    font-weight: 700;
}

.subtitle {
    margin: 0;
    color: var(--muted);
    font-size: 0.9rem;
}

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

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

.field > span {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--muted);
}

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

.field input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.25);
}

.field input::placeholder {
    color: #5a6a82;
}

.hint {
    color: var(--muted);
    font-size: 0.78rem;
}

.password-row {
    display: flex;
    gap: 8px;
}

.password-row input {
    flex: 1;
}

.btn-icon {
    flex-shrink: 0;
    width: 46px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--bg);
    color: var(--muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-icon:hover {
    color: var(--text);
    border-color: var(--primary);
}

.help-box {
    margin-top: 24px;
    padding: 14px 16px;
    border-radius: 10px;
    background: rgba(59, 130, 246, 0.08);
    border: 1px solid rgba(59, 130, 246, 0.2);
    font-size: 0.85rem;
    color: var(--muted);
}

.help-box strong {
    display: block;
    color: var(--text);
    margin-bottom: 4px;
}

.help-box p {
    margin: 0;
}

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

/* —— Buttons —— */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 16px;
    border-radius: 10px;
    font-size: 0.95rem;
    font-weight: 600;
    border: none;
    cursor: pointer;
    text-decoration: none !important;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
    font-family: inherit;
}

.btn-primary {
    background: var(--primary);
    color: #fff;
}

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

.btn-outline {
    background: transparent;
    color: var(--text);
    border: 1px solid var(--border);
}

.btn-outline:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.btn-ghost {
    background: transparent;
    color: var(--muted);
    border: 1px solid transparent;
}

.btn-ghost:hover {
    color: var(--text);
    background: var(--bg-hover);
}

.btn-block {
    width: 100%;
    padding: 13px 16px;
}

.btn-sm {
    padding: 7px 12px;
    font-size: 0.85rem;
}

/* —— Alerts —— */
.alert {
    padding: 12px 14px;
    border-radius: 10px;
    margin-bottom: 16px;
    font-size: 0.9rem;
}

.alert-error {
    background: var(--danger-bg);
    color: #fca5a5;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.alert-success {
    background: rgba(34, 197, 94, 0.12);
    color: #86efac;
    border: 1px solid rgba(34, 197, 94, 0.3);
}

.btn-danger {
    background: var(--danger);
    color: #fff;
}

.btn-danger:hover {
    background: #dc2626;
}

.btn-danger:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.container-narrow {
    max-width: 520px;
}

.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
}

.form-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 8px;
}

.toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
    padding: 10px 14px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
}

.check-all {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    color: var(--muted);
    cursor: pointer;
    user-select: none;
}

.check-all input {
    width: 16px;
    height: 16px;
    accent-color: var(--primary);
}

.mail-check {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
    cursor: pointer;
}

.mail-check input {
    width: 16px;
    height: 16px;
    accent-color: var(--primary);
}

.mail-link {
    display: grid;
    grid-template-columns: minmax(100px, 180px) 1fr auto;
    gap: 12px 16px;
    align-items: center;
    flex: 1;
    min-width: 0;
    color: inherit;
    text-decoration: none !important;
}

.btn-icon-del {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: var(--muted);
    font-size: 1.4rem;
    line-height: 1;
    cursor: pointer;
    transition: background 0.12s, color 0.12s;
}

.btn-icon-del:hover {
    background: var(--danger-bg);
    color: #fca5a5;
}

.inline-form {
    display: inline;
    margin: 0;
}

.view-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
}

code {
    font-size: 0.85em;
    background: var(--bg);
    padding: 2px 6px;
    border-radius: 4px;
    color: #93c5fd;
}

/* —— Topbar —— */
.topbar {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 50;
}

.topbar-inner {
    max-width: 960px;
    margin: 0 auto;
    padding: 12px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

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

.logo-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--primary);
    box-shadow: 0 0 10px var(--primary);
}

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

.user-email {
    color: var(--muted);
    font-size: 0.85rem;
    max-width: 220px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* —— Layout —— */
.container {
    max-width: 960px;
    margin: 0 auto;
    padding: 24px 20px 48px;
}

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

.page-head h1 {
    margin: 0 0 4px;
    font-size: 1.5rem;
}

.muted {
    color: var(--muted);
    margin: 0;
    font-size: 0.9rem;
}

.badge-unread {
    color: #93c5fd;
    font-weight: 600;
}

/* —— Mail list —— */
.mail-list {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

.mail-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 14px;
    border-bottom: 1px solid var(--border);
    color: inherit;
    transition: background 0.12s;
}

.mail-row:last-child {
    border-bottom: none;
}

.mail-row:hover {
    background: var(--bg-hover);
}

.mail-row.unread {
    background: rgba(59, 130, 246, 0.06);
}

.mail-row.unread .mail-from,
.mail-row.unread .mail-subject {
    font-weight: 700;
    color: #fff;
}

.mail-from {
    font-size: 0.9rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--text);
}

.mail-subject {
    font-size: 0.92rem;
    color: var(--muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 8px;
}

.mail-subject .dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--primary);
    flex-shrink: 0;
}

.mail-meta {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
    font-size: 0.8rem;
    color: var(--muted);
    white-space: nowrap;
}

.mail-size {
    opacity: 0.7;
    font-size: 0.75rem;
}

/* —— Pagination —— */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    margin-top: 24px;
}

.page-info {
    color: var(--muted);
    font-size: 0.9rem;
}

/* —— Empty —— */
.empty-state {
    text-align: center;
    padding: 64px 24px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.empty-icon {
    font-size: 3rem;
    margin-bottom: 12px;
}

.empty-state h2 {
    margin: 0 0 8px;
}

.empty-state p {
    margin: 0;
    color: var(--muted);
}

/* —— View mail —— */
.view-actions {
    margin-bottom: 16px;
}

.view-actions.bottom {
    margin-top: 20px;
    margin-bottom: 0;
}

.mail-view {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

.mail-view-head {
    padding: 24px;
    border-bottom: 1px solid var(--border);
}

.mail-view-subject {
    margin: 0 0 16px;
    font-size: 1.35rem;
    line-height: 1.35;
    word-break: break-word;
}

.mail-view-meta {
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.mail-view-meta > div {
    display: grid;
    grid-template-columns: 70px 1fr;
    gap: 8px;
    font-size: 0.9rem;
}

.mail-view-meta dt {
    color: var(--muted);
    font-weight: 600;
}

.mail-view-meta dd {
    margin: 0;
    word-break: break-word;
}

.mail-view-body {
    padding: 24px;
}

.text-body {
    margin: 0;
    white-space: pre-wrap;
    word-break: break-word;
    font-family: inherit;
    font-size: 0.95rem;
    line-height: 1.6;
}

.html-body {
    font-size: 0.95rem;
    line-height: 1.6;
    word-break: break-word;
    overflow-x: auto;
}

.html-body img {
    max-width: 100%;
    height: auto;
}

.html-body a {
    color: #60a5fa;
}

/* —— Layout: folder nav —— */
.layout-with-nav {
    display: grid;
    grid-template-columns: 200px 1fr;
    gap: 24px;
    align-items: start;
}

.folder-nav {
    display: flex;
    flex-direction: column;
    gap: 4px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 10px;
    position: sticky;
    top: 72px;
}

.folder-link {
    display: block;
    padding: 10px 12px;
    border-radius: 8px;
    color: var(--muted);
    font-size: 0.9rem;
    font-weight: 600;
    text-decoration: none !important;
    transition: background 0.12s, color 0.12s;
}

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

.folder-link.active {
    background: rgba(59, 130, 246, 0.15);
    color: #93c5fd;
}

.mail-main {
    min-width: 0;
}

/* —— Search —— */
.search-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 16px;
    align-items: center;
}

.search-bar input[type="search"] {
    flex: 1;
    min-width: 180px;
    padding: 10px 14px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--text);
    font-size: 0.95rem;
    outline: none;
}

.search-bar input[type="search"]:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.25);
}

/* —— Attachments —— */
.attachments {
    padding: 16px 24px;
    border-bottom: 1px solid var(--border);
    background: rgba(59, 130, 246, 0.05);
}

.attachments-title {
    display: block;
    font-size: 0.85rem;
    color: var(--muted);
    margin-bottom: 10px;
}

.attachment-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.attachment-link {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 8px 12px;
    padding: 10px 12px;
    border-radius: 8px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text);
    text-decoration: none !important;
    transition: border-color 0.12s, background 0.12s;
}

.attachment-link:hover {
    border-color: var(--primary);
    background: var(--bg-hover);
}

.att-name {
    font-weight: 600;
    font-size: 0.9rem;
    word-break: break-all;
}

.att-meta {
    font-size: 0.78rem;
    color: var(--muted);
}

/* —— Responsive —— */
@media (max-width: 700px) {
    .layout-with-nav {
        grid-template-columns: 1fr;
    }

    .folder-nav {
        flex-direction: row;
        flex-wrap: wrap;
        position: static;
        gap: 6px;
    }

    .folder-link {
        padding: 8px 12px;
        font-size: 0.82rem;
    }

    .mail-link {
        grid-template-columns: 1fr auto;
        grid-template-rows: auto auto;
    }

    .mail-link .mail-from {
        grid-column: 1;
        grid-row: 1;
    }

    .mail-link .mail-meta {
        grid-column: 2;
        grid-row: 1;
    }

    .mail-link .mail-subject {
        grid-column: 1 / -1;
        grid-row: 2;
        white-space: normal;
    }

    .user-email {
        display: none;
    }

    .page-head {
        flex-direction: column;
    }

    .toolbar {
        flex-wrap: wrap;
    }
}

