/* ══════════════════════════════════════════════════════════════════════════
   MAIN — User mailbox layout (user.html)
   ══════════════════════════════════════════════════════════════════════════ */

/* ── CSS Variables ── */
:root {
    --primary-color: #1a73e8;
    --primary-hover: #1557b0;
    --secondary-color: #f8f9fa;
    --text-primary: #202124;
    --text-secondary: #5f6368;
    --border-color: #dadce0;
    --hover-bg: #f1f3f4;
    --unread-bg: #e8f0fe;
    --danger-color: #dc3545;
}

/* ── Reset / Base ── */
body {
    font-family: Arial, sans-serif;
    margin: 0;
    padding: 0;
    background-color: #f5f5f5;
    color: var(--text-primary);
}

textarea {
    font-family: Arial, sans-serif;
    font-size: 15px;
    line-height: 1.15;
}

.email-preview-content {
    font-family: Arial, sans-serif;
    font-size: 15px;
    line-height: 1.3;
}

/* ── Layout ── */
.container {
    max-width: 100%;
    margin: 0;
    display: flex;
    height: 100vh;
}

.sidebar {
    width: 220px;
    flex: 0 0 220px;
    background: linear-gradient(180deg, #202124 0%, #292a2d 100%);
    color: white;
    padding: 20px;
    box-shadow: 2px 0 8px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
}

.main-content {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background-color: white;
}

.email-container {
    display: flex;
    flex-grow: 1;
    overflow: hidden;
}

.email-list-section {
    width: 25%;
    min-width: 200px;
    max-width: 350px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    border-right: 1px solid #ddd;
}

/* ── Sidebar nav ── */
.compose-button {
    width: 100%;
    padding: 10px;
    margin-bottom: 20px;
    background: white;
    color: var(--text-primary);
    border: none;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    border-radius: 4px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
    transition: all 0.2s ease;
}

.compose-button:hover {
    background: var(--secondary-color);
    transform: scale(1.02);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.15);
}

.sidebar ul {
    list-style: none;
    padding: 0;
    margin: 0;
    flex-grow: 1;
}

.sidebar li {
    padding: 10px;
    cursor: pointer;
    border-radius: 4px;
    transition: background-color 0.2s ease;
}

.sidebar li:hover {
    background-color: #3c4043;
}

.sidebar li.active {
    background-color: #1a73e8;
}

.unread-badge {
    display: inline-block;
    background-color: #e53935;
    color: #fff;
    font-size: 11px;
    font-weight: bold;
    min-width: 18px;
    height: 18px;
    line-height: 18px;
    border-radius: 9px;
    text-align: center;
    padding: 0 5px;
    margin-left: 4px;
    vertical-align: middle;
}

.folder-count {
    font-size: 12px;
    color: #ccc;
    margin-left: 4px;
}

/* ── Header / Search / Timer ── */
.header {
    padding: 15px 20px;
    border-bottom: 1px solid #ccc;
    background-color: white;
    z-index: 2;
    display: flex;
    align-items: center;
    gap: 12px;
}

.header .search-bar {
    flex: 1;
}

.search-bar {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 14px;
    background: var(--secondary-color);
    transition: all 0.2s ease;
}

.search-bar:focus {
    outline: none;
    border-color: #1a73e8;
    background: white;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
}

.timer-display {
    display: flex;
    align-items: center;
    gap: 6px;
    background: #f1f3f4;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 6px 14px;
    font-size: 15px;
    font-weight: 600;
    color: #202124;
    white-space: nowrap;
    flex-shrink: 0;
}

.timer-display.warning {
    background: #fff3cd;
    border-color: #ffc107;
    color: #856404;
}

.timer-display.danger {
    background: #fde8e8;
    border-color: #dc3545;
    color: #dc3545;
    animation: timerPulse 1s ease-in-out infinite;
}

@keyframes timerPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

/* ── Tryout Banner ── */
#tryoutBanner {
    position: fixed;
    top: 0; left: 0; right: 0;
    z-index: 9999;
    background: #f59e0b;
    color: #1c1917;
    text-align: center;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.3px;
    padding: 8px 16px;
    border-bottom: 2px solid #d97706;
}

body.tryout-banner-visible .container {
    padding-top: 38px;
}

/* ── Tryout Mode (sidebar panel) ── */
#tryoutBadge {
    display: flex;
    align-items: center;
    gap: 6px;
    background: #fff3cd;
    border: 1px solid #f59e0b;
    border-radius: 8px;
    padding: 6px 14px;
    font-size: 14px;
    font-weight: 700;
    color: #92400e;
    white-space: nowrap;
    flex-shrink: 0;
}

.tryout-badge-icon { font-size: 16px; }

.fullscreen-btn {
    padding: 6px 12px;
    background: #1b4332;
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    white-space: nowrap;
    flex-shrink: 0;
    transition: background 0.15s;
}
.fullscreen-btn:hover { background: #2d6a4f; }

/* ── Fullscreen warning banner (user.html) ── */
.fs-warning-banner {
    position: fixed;
    top: 0; left: 0; right: 0;
    background: #b45309;
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    padding: 10px 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    z-index: 9000;
}
.fs-warning-banner button {
    background: #fff;
    color: #b45309;
    border: none;
    border-radius: 6px;
    padding: 5px 14px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    font-family: inherit;
}
.fs-warning-banner button:hover { background: #fef3c7; }

#tryoutSidebarPanel {
    margin: 0 0 16px 0;
    background: #fff8e1;
    border: 1px solid #f59e0b;
    border-radius: 8px;
    padding: 12px;
}

.tryout-label {
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: #92400e;
    margin-bottom: 6px;
}

.tryout-hint {
    font-size: 11px;
    color: #78350f;
    line-height: 1.5;
    margin: 0 0 10px;
}

.tryout-start-btn {
    width: 100%;
    padding: 9px 0;
    background: #1b4332;
    color: #fff;
    border: none;
    border-radius: 7px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    letter-spacing: 0.2px;
    transition: background 0.18s;
}

.tryout-start-btn:hover { background: #2d6a4f; }

/* ── Email List ── */
.email-list-container {
    flex-grow: 1;
    overflow-y: auto;
}

.email-list {
    display: none;
    list-style: none;
    margin: 0;
    padding: 0;
    width: 100%;
}

.email-list.active {
    display: block;
}

.email-item {
    width: 100%;
    display: flex;
    align-items: center;
    padding: 16px;
    margin: 4px 8px;
    border-bottom: 1px solid #eee;
    cursor: pointer;
    border-radius: 8px;
    border: none;
    box-sizing: border-box;
    background-color: #ffffff;
    transition: all 0.2s ease;
}

.email-item:hover {
    background: var(--hover-bg);
    transform: translateX(4px);
}

.email-item.unread {
    background: var(--unread-bg);
    box-shadow: inset 3px 0 0 var(--primary-color);
}

.email-item.unread .subject,
.email-item.unread .from {
    color: #202124;
    font-weight: 600;
}

.email-item .subject {
    font-weight: bold;
    margin-bottom: 5px;
    font-size: 15px;
}

.email-item .from {
    color: #5f6368;
    font-size: 12px;
}

/* ── Compose ── */
.compose-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 2000;
}

.compose-panel {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 80%;
    max-width: 1100px;
    min-width: 320px;
    max-height: 90vh;
    height: auto;
    overflow-y: auto;
    overflow-x: hidden;
    background: white;
    padding: 0;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
}

.compose-panel header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid #ccc;
    flex-shrink: 0;
    position: sticky;
    top: 0;
    background: white;
    z-index: 10;
}

.compose-panel header h3 {
    margin: 0;
    color: #202124;
    font-size: 18px;
}

.compose-header-actions {
    display: flex;
    align-items: center;
    gap: 4px;
}

.compose-panel header button {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #5f6368;
    transition: color 0.2s ease;
}

.compose-panel header button:hover {
    color: #202124;
}

#maximizeComposeBtn {
    font-size: 20px;
}

.compose-panel.maximized {
    top: 0;
    left: 0;
    transform: none;
    width: 100% !important;
    max-width: 100% !important;
    max-height: 100vh;
    height: 100vh;
    border-radius: 0;
    padding: 0;
}

.compose-panel.maximized #maximizeComposeBtn {
    transform: rotate(45deg);
    display: inline-block;
}

.compose-panel.maximized .tox-tinymce {
    height: 550px !important;
}

.compose-panel form {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 20px 20px 8px 20px;
}

.compose-panel label {
    font-weight: bold;
    font-size: 14px;
    color: #202124;
}

.compose-panel input,
.compose-panel textarea {
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 15px;
    transition: border-color 0.2s ease;
}

.compose-panel input:focus,
.compose-panel textarea:focus {
    border-color: #1a73e8;
    outline: none;
}

.compose-panel textarea {
    resize: vertical;
    min-height: 200px;
}

.compose-panel button[type="submit"] {
    padding: 12px;
    background-color: #1a73e8;
    border: none;
    color: white;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    border-radius: 4px;
    transition: background-color 0.2s ease;
}

.compose-panel button[type="submit"]:hover {
    background-color: #185abc;
}

.compose-panel .file-list {
    margin: 10px 0;
    padding: 0;
    list-style: none;
}

.compose-panel .file-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px;
    background: #f5f5f5;
    margin: 5px 0;
    border-radius: 4px;
    font-size: 14px;
}

.compose-panel .file-item button {
    background: none;
    border: none;
    color: #dc3545;
    cursor: pointer;
    font-size: 18px;
    padding: 0 8px;
}

.compose-panel .file-item button:hover {
    color: #c82333;
}

.email-field {
    display: flex;
    align-items: center;
    gap: 10px;
}

.email-field label {
    min-width: 30px;
}

.email-field input {
    flex-grow: 1;
}

.pick-contact-btn {
    flex-shrink: 0;
    background: none;
    border: 1px solid #ccc;
    border-radius: 4px;
    cursor: pointer;
    color: #5f6368;
    font-size: 13px;
    line-height: 1;
    padding: 4px 7px;
}

.pick-contact-btn:hover {
    background: #e8f0fe;
    border-color: #1a73e8;
    color: #1a73e8;
}

.clear-field-btn {
    flex-shrink: 0;
    background: none;
    border: 1px solid #ccc;
    border-radius: 4px;
    color: #999;
    cursor: pointer;
    font-size: 14px;
    line-height: 1;
    padding: 4px 7px;
}

.clear-field-btn:hover {
    background: #fee;
    border-color: #e74c3c;
    color: #e74c3c;
}

.names-textarea {
    min-height: 100px;
    font-family: Arial, sans-serif;
    line-height: 1.5;
    width: 100%;
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    box-sizing: border-box;
    resize: vertical;
}

.email-field input.clickable {
    cursor: pointer;
    background-color: #f8f9fa;
    transition: background-color 0.2s ease;
}

.email-field input.clickable:hover {
    background-color: #e9ecef;
}

.compose-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    background: white;
    padding-top: 8px;
    padding-bottom: 8px;
    margin-top: 4px;
    border-top: 1px solid #eee;
}

.draft-button {
    padding: 12px;
    background-color: #5f6368;
    border: none;
    color: white;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    border-radius: 4px;
    transition: background-color 0.2s ease;
}

.draft-button:hover {
    background-color: #494c50;
}

/* ── Priority radio group ── */
.priority-group {
    display: flex;
    gap: 20px;
    margin: 10px 0;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 4px;
}

.priority-option {
    display: flex;
    align-items: center;
    gap: 5px;
}

.priority-option input[type="radio"] {
    margin: 0;
}

/* ── Address Selector ── */
.contact-avatar {
    width: 40px;
    height: 40px;
    background: #1a73e8;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
}

.address-selector-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 3000;
}

.address-selector-panel {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 40%;
    min-width: 320px;
    max-width: 600px;
    height: auto;
    max-height: 80vh;
    background: white;
    padding: 0;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.address-selector-panel header {
    background: #1a73e8;
    color: white;
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.address-selector-panel header h3 {
    margin: 0;
    font-size: 18px;
}

.address-selector-panel header button {
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    padding: 0 5px;
}

.address-selector-search {
    padding: 10px 20px;
    background: #f8f9fa;
    border-bottom: 1px solid #eee;
}

.address-selector-search input {
    width: 100%;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.address-selector-search input:focus {
    border-color: #1a73e8;
    outline: none;
}

#contactSelectList {
    padding: 10px;
    max-height: 400px;
    overflow-y: auto;
}

.contact-select-item {
    display: flex;
    align-items: center;
    padding: 12px;
    margin: 4px 8px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
}

.contact-select-item:hover {
    background: var(--hover-bg);
    transform: translateX(4px);
}

.contact-select-item .contact-avatar {
    width: 36px;
    height: 36px;
    background: #1a73e8;
    border-radius: 50%;
    margin-right: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    flex-shrink: 0;
}

.contact-select-item .contact-info {
    flex-grow: 1;
}

.contact-select-item .contact-name {
    font-weight: 500;
    color: #202124;
    margin-bottom: 2px;
}

.contact-select-item .contact-description {
    font-size: 13px;
    color: #5f6368;
}

.contact-select-item.selected {
    background: #e8f0fe;
}

.contact-select-item.selected::before {
    content: "✓";
    position: absolute;
    right: 12px;
    color: #1a73e8;
    font-weight: bold;
}

.address-selector-actions {
    padding: 10px 20px;
    background: #f8f9fa;
    border-top: 1px solid #eee;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.address-selector-actions button {
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
}

.address-selector-actions .done-btn {
    background: #1a73e8;
    color: white;
}

.address-selector-actions .cancel-btn {
    background: #f1f3f4;
    color: #202124;
}

/* ── Email Preview ── */
.email-preview {
    display: none;
    flex-grow: 1;
    padding: 24px;
    background-color: white;
    border-left: 1px solid #ddd;
    overflow-y: auto;
    overflow-x: auto;
    flex: 1;
    min-width: 0;
}

.email-preview.active {
    display: block;
}

.email-preview-header {
    border-bottom: 1px solid #ddd;
    padding-bottom: 15px;
    margin-bottom: 15px;
    user-select: none;
    -webkit-user-select: none;
}

.email-preview-subject {
    font-size: 22px;
    font-weight: 500;
    margin-bottom: 20px;
    color: var(--text-primary);
}

.email-preview-info {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 10px;
    font-size: 14px;
    color: #5f6368;
}

.email-preview-label {
    font-weight: bold;
}

.email-preview-content {
    margin-top: 20px;
    line-height: 1.3;
    font-size: 15px;
    user-select: none;
    -webkit-user-select: none;
}

.email-preview-content p {
    margin: 0 0 0.7em 0;
}

.email-preview-attachments {
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid #ddd;
}

.attachment-item {
    display: inline-flex;
    align-items: center;
    padding: 8px 12px;
    margin: 4px;
    background: var(--secondary-color);
    border-radius: 16px;
    font-size: 14px;
    transition: all 0.2s ease;
}

.attachment-item::before {
    content: "📎";
    margin-right: 8px;
}

.attachment-item:hover {
    background: var(--hover-bg);
    transform: translateY(-1px);
}

.email-preview-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 15px;
    padding: 15px;
    border-radius: 8px;
    background-color: var(--secondary-color);
}

.preview-action-btn {
    flex: 1;
    min-width: 120px;
    max-width: 200px;
    padding: 12px;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    border-radius: 6px;
    transition: all 0.2s ease;
    white-space: nowrap;
    background: white;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    border: none;
    color: #202124;
    cursor: pointer;
}

.preview-action-btn:hover {
    background: var(--hover-bg);
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
}

/* ── Attachment image viewer ── */
.attachment-image {
    display: block;
    max-width: 100%;
    width: auto;
    max-height: 280px;
    margin: 0;
    border: 1px solid #ddd;
    border-radius: 6px;
    cursor: zoom-in;
    background: #fff;
    object-fit: contain;
}

.attachment-image-card {
    margin: 10px 0;
}

.attachment-image-actions {
    display: flex;
    gap: 10px;
    margin-top: 6px;
}

.attachment-action-link {
    font-size: 13px;
    color: #1a73e8;
    text-decoration: underline;
}

.attachment-action-link:hover {
    color: #1557b0;
}

.table-scroll-wrapper {
    overflow-x: auto;
    max-width: 100%;
    margin: 10px 0;
    -webkit-overflow-scrolling: touch;
}

.email-preview-content table {
    width: auto !important;
    border-collapse: collapse !important;
}

.email-preview-content th,
.email-preview-content td {
    border: 1px solid #000 !important;
    padding: 6px 8px;
    vertical-align: top;
}

/* ── Image modal ── */
.image-modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 5000;
}

.image-modal.active {
    display: block;
}

.image-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
}

.image-modal-panel {
    position: relative;
    width: min(96vw, 1100px);
    height: min(94vh, 900px);
    margin: 3vh auto;
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.35);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.image-modal-close {
    position: absolute;
    top: 10px;
    right: 12px;
    border: none;
    background: transparent;
    font-size: 28px;
    line-height: 1;
    color: #444;
    cursor: pointer;
    z-index: 2;
}

.image-modal-toolbar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    border-bottom: 1px solid #e4e4e4;
}

.image-modal-toolbar button,
.image-modal-download {
    border: 1px solid #d0d0d0;
    background: #f8f9fa;
    color: #1f1f1f;
    border-radius: 6px;
    padding: 6px 10px;
    font-size: 14px;
    cursor: pointer;
    text-decoration: none;
}

.image-modal-stage {
    flex: 1;
    overflow: auto;
    background: #111;
    padding: 16px;
    cursor: grab;
    user-select: none;
}

.image-modal-stage.dragging {
    cursor: grabbing;
}

.image-modal-image {
    display: block;
    width: 100%;
    height: auto;
    transition: width 0.15s ease-out;
}

/* ── TinyMCE overrides ── */
.tox-tinymce {
    border-radius: 6px !important;
    border: 1px solid #d0d0d0 !important;
}

.tox .tox-toolbar,
.tox .tox-toolbar__overflow,
.tox .tox-toolbar__primary {
    background: #f7f7f7 !important;
}

/* TinyMCE popups must appear above compose overlay */
.tox .tox-tinymce-aux,
.tox-tinymce-aux,
.tox .tox-dialog-wrap,
.tox-dialog-wrap {
    z-index: 4000 !important;
}

/* ── Custom datetime row (email scheduling) ── */
.custom-datetime-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    padding: 8px 0;
}

.dt-label {
    font-weight: 600;
    font-size: 13px;
    color: #444;
    white-space: nowrap;
}

.dt-sep {
    font-weight: bold;
    font-size: 16px;
}

.dt-input-xs {
    width: 62px;
    padding: 6px 8px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 14px;
    text-align: center;
}

.dt-select {
    padding: 6px 8px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 14px;
    width: auto;
}

/* ── Timer Warning Notification ── */
.timer-warning {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 5000;
    pointer-events: none;
}

.timer-warning.active {
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: auto;
}

.timer-warning-box {
    background: white;
    border-radius: 12px;
    padding: 32px 28px;
    max-width: 380px;
    width: 90%;
    box-shadow: 0 8px 32px rgba(0,0,0,0.2);
    text-align: center;
    pointer-events: auto;
    position: relative;
    z-index: 1;
}

.timer-warning-icon {
    font-size: 44px;
    margin-bottom: 12px;
}

.timer-warning-box h3 {
    margin: 0 0 10px;
    font-size: 18px;
    color: #202124;
}

.timer-warning-box p {
    margin: 0 0 20px;
    font-size: 14px;
    color: #5f6368;
    line-height: 1.6;
}

.timer-warning-ok {
    padding: 10px 32px;
    background: #1a73e8;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.timer-warning-ok:hover {
    background: #185abc;
}

/* ── Time's Up Overlay ── */
.timesup-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    z-index: 99999;
    align-items: center;
    justify-content: center;
    pointer-events: all;
}

.timesup-overlay.active {
    display: flex;
}

.timesup-box {
    background: white;
    border-radius: 16px;
    padding: 48px 40px;
    max-width: 420px;
    width: 90%;
    text-align: center;
    box-shadow: 0 16px 48px rgba(0,0,0,0.4);
}

.timesup-icon {
    font-size: 56px;
    margin-bottom: 16px;
}

.timesup-box h2 {
    margin: 0 0 12px;
    font-size: 22px;
    color: #202124;
}

.timesup-box p {
    margin: 0 0 20px;
    font-size: 15px;
    color: #5f6368;
    line-height: 1.7;
}

.timesup-info {
    background: #f1f3f4;
    border-radius: 8px;
    padding: 12px 16px;
    font-size: 13px;
    color: #3c4043;
    font-weight: 500;
}

/* ── Toast Notifications ── */
.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 99999;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
}

.toast {
    padding: 10px 16px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    color: white;
    box-shadow: 0 2px 10px rgba(0,0,0,0.25);
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 0.2s, transform 0.2s;
    max-width: 320px;
    pointer-events: auto;
}

.toast.show { opacity: 1; transform: translateY(0); }
.toast-success { background: #1b5e20; }
.toast-error   { background: #b71c1c; }
.toast-info    { background: #1a237e; }

/* ── Search highlights ── */
.search-highlight {
    background-color: #fff3cd;
    padding: 0 2px;
    border-radius: 2px;
}

.no-results {
    padding: 20px;
    text-align: center;
    color: #666;
    font-style: italic;
}

/* ── Global button active state ── */
button {
    transition: all 0.2s ease;
}

button:active {
    transform: scale(0.98);
}

/* ── Scrollbar ── */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--secondary-color);
}

::-webkit-scrollbar-thumb {
    background: #bdc1c6;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #9aa0a6;
}

/* ── Fullscreen Lock Overlay ── */
#fsLockOverlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 99999;
    background: rgba(0, 0, 0, 0.92);
    align-items: center;
    justify-content: center;
}

#fsLockOverlay.active {
    display: flex;
}

.fs-lock-box {
    background: #1a1a2e;
    border: 1px solid #333;
    border-radius: 16px;
    padding: 48px 40px;
    text-align: center;
    max-width: 400px;
    color: #fff;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.fs-lock-icon {
    font-size: 48px;
    line-height: 1;
}

.fs-lock-box h2 {
    font-size: 20px;
    font-weight: 700;
    margin: 0;
    color: #fff;
}

.fs-lock-box p {
    font-size: 14px;
    color: #aaa;
    margin: 0;
    line-height: 1.5;
}

.fs-lock-status {
    font-size: 12px;
    color: #666;
    margin-top: 8px;
    animation: fs-blink 1.5s ease-in-out infinite;
}

/* Tombol yang muncul setelah admin membuka kunci. Kliknya menjadi gestur pengguna
   yang diwajibkan browser untuk menyalakan fullscreen kembali. */
.fs-lock-resume {
    margin-top: 10px;
    padding: 12px 26px;
    background: #1b4332;
    color: #fff;
    border: none;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.18s, transform 0.1s;
}

.fs-lock-resume:hover:not(:disabled)  { background: #2d6a4f; }
.fs-lock-resume:active:not(:disabled) { transform: scale(0.98); }
.fs-lock-resume:disabled {
    background: #4a5e52;
    cursor: not-allowed;
}

@keyframes fs-blink {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0.4; }
}

/* ── Mobile Block (peserta hanya boleh desktop) ── */
#mobileBlock {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 99998;
    background: #1b4332;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 32px;
    color: #fff;
    flex-direction: column;
    gap: 16px;
}

#mobileBlock .mb-icon { font-size: 48px; }
#mobileBlock h2 { font-size: 20px; font-weight: 700; margin: 0; }
#mobileBlock p  { font-size: 14px; color: #a8d5b5; margin: 0; line-height: 1.5; }

@media (max-width: 768px) {
    body.page-user #mobileBlock { display: flex; }
}

/* ── Responsive ── */
@media screen and (max-width: 1200px) {
    .container {
        max-width: 100%;
    }

    .sidebar {
        width: 220px;
        flex: 0 0 220px;
    }

    .email-list-section {
        width: 30%;
        flex-shrink: 0;
    }
}

@media screen and (max-width: 992px) {
    .sidebar {
        width: 220px;
        flex: 0 0 220px;
    }

    .email-list-section {
        width: 220px;
        flex-shrink: 0;
    }

    .compose-panel {
        width: 90%;
        max-width: 600px;
    }
}

@media screen and (max-width: 768px) {
    .container {
        flex-direction: column;
        height: auto;
    }

    .sidebar {
        width: 100%;
        height: auto;
        position: sticky;
        top: 0;
        z-index: 1000;
    }

    .sidebar ul {
        display: flex;
        flex-wrap: wrap;
        gap: 10px;
    }

    .sidebar li {
        flex: 1;
        text-align: center;
        min-width: 100px;
    }

    .main-content {
        height: calc(100vh - 200px);
    }

    .email-list-section {
        width: 100%;
        max-width: none;
        height: 200px;
        border-right: none;
        border-bottom: 1px solid #ddd;
    }

    .email-preview {
        padding: 15px;
    }

    .compose-panel {
        width: 95%;
        height: 90vh;
        overflow-y: auto;
    }

    .address-selector-panel {
        width: 95%;
        max-width: none;
        height: 90vh;
    }

    .email-preview-actions {
        padding: 10px;
        justify-content: center;
    }

    .preview-action-btn {
        min-width: calc(33.33% - 10px);
        max-width: none;
        padding: 10px;
        font-size: 13px;
    }
}

@media screen and (max-width: 576px) {
    .email-item {
        padding: 10px;
    }

    .email-preview-subject {
        font-size: 18px;
    }

    .email-preview-actions {
        flex-direction: column;
        gap: 8px;
    }

    .preview-action-btn {
        flex: 1;
        min-width: 0;
        max-width: none;
        width: 100%;
        justify-content: center;
    }

    .preview-action-btn span {
        display: inline-block;
        margin-left: 5px;
    }

    .compose-panel form {
        gap: 8px;
    }

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

    .email-field input {
        width: 100%;
    }

    .priority-group {
        flex-direction: column;
        gap: 5px;
    }

    .compose-actions {
        flex-direction: column;
        gap: 8px;
    }

    .compose-actions button {
        width: 100%;
    }
}

@media screen and (max-width: 360px) {
    .preview-action-btn {
        font-size: 12px;
        padding: 8px;
    }
}

@media screen and (min-width: 1921px) {
    .container {
        max-width: 1800px;
        margin: 0 auto;
    }
}

/* Persempit jarak antar grup ikon toolbar TinyMCE (default 11-12px) */
.tox-toolbar__group {
    padding: 0 4px !important;
}
