/* Admin Panel Styles */
.admin-panel-container {
    display: flex;
    flex-direction: column;
    gap: 24px;
    padding: 20px;
}

.admin-notice {
    background-color: #fef9e7;
    border-left: 4px solid #f39c12;
    padding: 15px;
    border-radius: 4px;
    margin-bottom: 20px;
    color: #333;
}

.admin-notice h3 {
    color: #d35400;
    margin-top: 0;
    margin-bottom: 8px;
}

.admin-section {
    background-color: var(--card-bg);
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.add-email-form {
    display: flex;
    gap: 10px;
    margin-top: 10px;
    flex-wrap: wrap;
    align-items: flex-end;
}
/* Access pickers in the add-email form sit at their natural width. */
#newEmailTabsMount, #newEmailTeamsMount { flex: 0 0 auto; }

.admin-input {
    flex: 1;
    padding: 10px;
    border: 1px solid #444;
    border-radius: 4px;
    font-size: 14px;
    background-color: #222;
    color: #eee;
}

.admin-btn {
    background-color: #2ecc71;
    color: white;
    border: none;
    padding: 10px 15px;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: background-color 0.2s;
}

.admin-btn:hover {
    background-color: #27ae60;
}

.allowed-emails-list {
    margin-top: 15px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.email-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    background-color: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.email-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
    min-width: 0;
}

/* ── Diary role/player controls (admin panel) ───────── */
.email-item .diary-row-controls {
    display: flex;
    gap: 6px;
    align-items: center;
    flex-wrap: wrap;
}
.email-item .diary-role-select,
.email-item .diary-player-select {
    background-color: rgba(0, 0, 0, 0.25);
    color: inherit;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 4px;
    padding: 4px 8px;
    font-size: 12px;
    cursor: pointer;
}
.email-item .diary-role-select:focus,
.email-item .diary-player-select:focus {
    outline: none;
    border-color: #10b981;
}
.diary-role-pill {
    background: #422006;
    color: #fbbf24;
    padding: 2px 10px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.4px;
}
.diary-role-pill.role-admin {
    background: #1f2937;
    color: #d1d5db;
}
@media (max-width: 720px) {
    .email-item { flex-wrap: wrap; }
}

/* ── Per-user tab/team access multi-select pickers ───── */
.ms-labeled {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.ms-label {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: #9ca3af;
}
.ms-wrap {
    position: relative;
}
.ms-button {
    background-color: rgba(0, 0, 0, 0.25);
    color: inherit;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 4px;
    padding: 4px 8px;
    font-size: 12px;
    cursor: pointer;
    min-width: 90px;
    max-width: 160px;
    text-align: left;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.ms-button:hover { border-color: rgba(255, 255, 255, 0.35); }
.ms-panel {
    position: absolute;
    top: calc(100% + 4px);
    right: 0;
    z-index: 50;
    min-width: 200px;
    max-height: 280px;
    overflow-y: auto;
    background: #111827;
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 6px;
    padding: 4px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
}
.ms-option {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 8px;
    font-size: 12px;
    border-radius: 4px;
    cursor: pointer;
    white-space: nowrap;
}
.ms-option:hover { background: rgba(255, 255, 255, 0.06); }
.ms-option input[type="checkbox"] { cursor: pointer; }
.ms-option input[type="checkbox"]:disabled { cursor: not-allowed; opacity: 0.7; }

.email-address {
    font-weight: 500;
    font-size: 14px;
}

.email-date {
    font-size: 12px;
    opacity: 0.7;
}

.delete-email-btn {
    background-color: rgba(231, 76, 60, 0.1);
    color: #e74c3c;
    border: 1px solid rgba(231, 76, 60, 0.3);
    border-radius: 4px;
    padding: 6px 10px;
    cursor: pointer;
    transition: all 0.2s;
}

.delete-email-btn:hover {
    background-color: rgba(231, 76, 60, 0.2);
}

.no-emails-message {
    padding: 15px;
    text-align: center;
    opacity: 0.7;
    font-style: italic;
}

.error-message {
    padding: 15px;
    text-align: center;
    color: #e74c3c;
    font-style: italic;
}

/* Data refresh controls */
.data-refresh-controls {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.admin-btn.primary {
    background: linear-gradient(135deg, #007bff, #0056b3);
    color: white;
    border: none;
}

.admin-btn.primary:hover {
    background: linear-gradient(135deg, #0056b3, #004085);
    transform: translateY(-2px);
}

.admin-btn.secondary {
    background: linear-gradient(135deg, #6c757d, #495057);
    color: white;
    border: none;
}

.admin-btn.secondary:hover {
    background: linear-gradient(135deg, #495057, #343a40);
    transform: translateY(-2px);
}

.admin-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
}

.refresh-status {
    margin-top: 15px;
    padding: 15px;
    border-radius: 8px;
    border: 1px solid #ddd;
    background: #f8f9fa;
    min-height: 20px;
}

.refresh-status:empty {
    display: none;
}

.refresh-status .loading {
    color: #007bff;
    font-weight: 500;
}

.refresh-status .success {
    color: #28a745;
    font-weight: 500;
    line-height: 1.5;
}

.refresh-status .error {
    color: #dc3545;
    font-weight: 500;
    line-height: 1.5;
}

.refresh-status .info {
    color: #17a2b8;
    line-height: 1.6;
}

.refresh-status .info h4 {
    margin: 0 0 10px 0;
    color: #17a2b8;
}

.refresh-status .info ol {
    margin: 10px 0;
    padding-left: 20px;
}

.refresh-status .info li {
    margin: 8px 0;
}

.refresh-status .info code {
    background: #f1f3f4;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
    border: 1px solid #ddd;
}

.refresh-status .info small {
    color: #6c757d;
    font-style: italic;
}

/* Header sync status (horizontal layout) */
.sync-status {
    display: none; /* Hidden by default, JS sets to flex when showing status */
    align-items: center;
    gap: 12px;
    margin-left: 15px;
    padding: 8px 12px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 6px;
    font-size: 13px;
    flex-wrap: wrap;
    max-width: 600px;
}

.sync-status span {
    white-space: nowrap;
}

.sync-loading {
    color: #ffc107;
    font-weight: 500;
}

.sync-success {
    color: #28a745;
    font-weight: 600;
}

.sync-info {
    color: #17a2b8;
    font-weight: 500;
}

.sync-time {
    color: #6c757d;
    font-size: 12px;
}

.sync-error {
    color: #dc3545;
    font-weight: 500;
}