/* Dashboard Chrome CSS */
:root {
    --brand: #1a5276;
    --brand-light: #e8f0f7;
    --success: #27ae60;
    --danger: #c0392b;
    --border: #dce4f0;
    --bg: #f4f6fb;
    --toolbar-h: 112px;
}

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

body {
    font-family: Arial, sans-serif;
    direction: rtl;
    background: var(--bg);
    color: #222;
}

/* ── Login Page ────────────────────────── */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100vh;
}
.login-card {
    background: #fff;
    padding: 40px;
    border-radius: 12px;
    box-shadow: 0 4px 24px rgba(0,0,0,0.1);
    width: 360px;
    text-align: center;
}
.login-card h1 { margin-bottom: 24px; color: var(--brand); }
.login-card input[type="password"] {
    width: 100%;
    padding: 12px;
    border: 2px solid var(--border);
    border-radius: 8px;
    font-size: 16px;
    margin-bottom: 16px;
    direction: ltr;
    text-align: center;
}
.login-card .error { color: var(--danger); margin-bottom: 12px; font-size: 14px; }

/* ── Listing Page ──────────────────────── */
.listing-page { max-width: 960px; margin: 40px auto; padding: 0 20px; }
.listing-page h1 { color: var(--brand); margin-bottom: 24px; }

.report-table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 12px rgba(0,0,0,0.06);
}
.report-table thead th {
    background: var(--brand);
    color: #fff;
    padding: 14px 16px;
    text-align: right;
    font-weight: 600;
}
.report-table tbody td {
    padding: 12px 16px;
    border-bottom: 1px solid #eee;
}
.report-table tbody tr:hover { background: var(--brand-light); }

.status-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
}
.status-pending { background: #fff4e5; color: #e67e22; }
.status-sent { background: #e8f8ed; color: #27ae60; }

.btn {
    display: inline-block;
    padding: 8px 20px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    text-decoration: none;
    transition: opacity 0.2s;
}
.btn:hover { opacity: 0.85; }
.btn-edit { background: var(--brand); color: #fff; }
.btn-send { background: var(--success); color: #fff; }
.btn-save { background: #3498db; color: #fff; }
.btn-sm { padding: 6px 14px; font-size: 13px; }
.btn-block { display: block; width: 100%; text-align: center; }
.btn-blue { background: #3498db; color: #fff; }
.btn-purple { background: #8e44ad; color: #fff; }
.btn-orange { background: #e67e22; color: #fff; }
.btn-light { background: #eef3f8; color: #34495e; border: 1px solid var(--border); }
.btn-telegram { background: #0088cc; color: #fff; }
.btn-back { background: #eef3f8; color: #34495e; border: 1px solid var(--border); }

/* ── Editor Page ───────────────────────── */
.editor-layout {
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.editor-main {
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.top-sendbar {
    position: sticky;
    top: 0;
    z-index: 20;
    background: #fff;
    border-bottom: 2px solid var(--border);
    padding: 10px 16px;
    display: grid;
    grid-template-columns: minmax(150px, 220px) minmax(220px, 1fr) minmax(260px, 1.4fr) auto auto;
    align-items: center;
    gap: 10px;
    box-shadow: 0 2px 16px rgba(0,0,0,0.05);
}

.report-title {
    min-width: 0;
}

.report-title strong,
.report-title span {
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.report-title strong {
    color: var(--brand);
    font-size: 17px;
}

.report-title span {
    color: #777;
    font-size: 13px;
}

.toolbar-field {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 8px;
    align-items: center;
    min-width: 0;
}

.toolbar-field span {
    font-size: 13px;
    font-weight: 700;
    color: #555;
}

.toolbar-field input {
    width: 100%;
    min-width: 0;
    padding: 8px 10px;
    border: 2px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
    font-family: Arial, sans-serif;
    direction: rtl;
}

.toolbar-actions,
.send-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
}

.send-actions {
    justify-content: flex-end;
}

.editor-content {
    flex: 1;
    overflow: auto;
    padding: 18px;
    background: #eef2f7;
}

.inline-toolbar {
    position: sticky;
    top: 0;
    z-index: 15;
    min-height: 42px;
    background: #fff;
    border-bottom: 1px solid var(--border);
}

.report-editor {
    max-width: 940px;
    min-height: calc(100vh - 210px);
    margin: 0 auto 32px;
    outline: none;
}

.report-editor:focus {
    outline: none;
}

.report-editor .wrapper {
    margin-top: 0;
}

.field-group {
    margin-bottom: 18px;
}
.field-group label {
    display: block;
    font-weight: 700;
    font-size: 14px;
    margin-bottom: 6px;
    color: #444;
}
.field-group input[type="text"],
.field-group input[type="email"],
.field-group textarea {
    width: 100%;
    padding: 10px 12px;
    border: 2px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
    font-family: Arial, sans-serif;
    direction: rtl;
}
.field-group input:focus,
.field-group textarea:focus {
    border-color: var(--brand);
    outline: none;
}

/* Attachment list */
.attachment-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    grid-column: 1 / -1;
}
.attachment-list li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    max-width: 260px;
    padding: 6px 10px;
    background: var(--brand-light);
    border-radius: 6px;
    font-size: 13px;
}
.attachment-list li span {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.attachment-list li .remove-btn {
    background: none;
    border: none;
    color: var(--danger);
    cursor: pointer;
    font-weight: 700;
    font-size: 16px;
}

.separator {
    border: none;
    border-top: 1px solid var(--border);
    margin: 20px 0;
}

/* Toast notification */
.toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    padding: 12px 28px;
    border-radius: 8px;
    color: #fff;
    font-weight: 600;
    z-index: 9999;
    opacity: 0;
    transition: opacity 0.3s;
}
.toast.show { opacity: 1; }
.toast-success { background: var(--success); }
.toast-error { background: var(--danger); }

/* Empty state */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #888;
}
.empty-state h2 { margin-bottom: 8px; }

@media (max-width: 1100px) {
    .top-sendbar {
        grid-template-columns: 1fr 1fr;
    }

    .report-title,
    .toolbar-actions,
    .send-actions,
    .attachment-list {
        grid-column: 1 / -1;
    }
}

@media (max-width: 720px) {
    .top-sendbar {
        grid-template-columns: 1fr;
    }

    .toolbar-field,
    .subject-field,
    .recipients-field {
        grid-template-columns: 1fr;
    }

    .toolbar-actions,
    .send-actions {
        justify-content: stretch;
    }

    .toolbar-actions .btn,
    .send-actions .btn {
        flex: 1 1 auto;
        text-align: center;
    }
}
