/**
 * Menu Styles
 *
 * Styles for the menu modal, level selector (calendar view),
 * and cloud sync UI (status bar, sign-in button, auth form).
 */

/* ========== Menu Modal ========== */
.menu-modal-content {
    max-width: 400px;
}

.menu-options {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-top: 20px;
}

.menu-option-btn {
    padding: 0 20px;
    height: var(--ctrl-height);
    font-size: 1.1em;
    text-align: left;
    background: var(--surface-bg);
    border: 2px solid var(--accent);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    color: var(--text-primary);
    font-weight: bold;
}

.menu-option-btn:hover {
    background: linear-gradient(135deg, var(--accent-start) 0%, var(--accent-end) 100%);
    color: var(--text-on-accent);
    transform: translateX(5px);
}

/* ========== Level List ========== */
.level-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* -------- Calendar Navigation -------- */
.calendar-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

.calendar-nav-btn {
    background: none;
    border: 2px solid var(--accent);
    border-radius: 6px;
    color: var(--accent);
    font-size: 1.3em;
    line-height: 1;
    padding: 4px 10px;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease;
    height: auto;
}

.calendar-nav-btn:hover {
    background: var(--accent-start);
    color: var(--text-on-accent);
}

.calendar-nav-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.calendar-month-label {
    font-weight: bold;
    font-size: 1.05em;
    color: var(--text-primary);
}

.calendar-today-btn {
    width: 100%;
    padding: 0 8px;
    height: calc(var(--ctrl-height) - 8px);
    background: linear-gradient(135deg, var(--accent-start) 0%, var(--accent-end) 100%);
    color: var(--text-on-accent);
    border: none;
    border-radius: 8px;
    font-size: 0.9em;
    font-weight: bold;
    cursor: pointer;
    transition: opacity 0.2s ease;
}

.calendar-today-btn:hover {
    opacity: 0.85;
}

/* -------- Loading State -------- */
.level-list-loading {
    text-align: center;
    color: var(--text-muted);
    padding: 30px 20px;
    font-size: 0.95em;
}

/* -------- Calendar Grid -------- */
.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    grid-template-rows: auto repeat(6, minmax(80px, auto));
    gap: 4px;
}

.calendar-day-header {
    text-align: center;
    font-size: 0.7em;
    font-weight: bold;
    color: var(--text-muted);
    padding: 4px 0;
}

.calendar-day {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding: 4px 2px;
    border-radius: 6px;
    min-height: 80px;
    font-size: 0.72em;
    color: var(--text-muted);
    text-align: center;
}

.calendar-day-empty {
    background: transparent;
    min-height: 80px;
}

.calendar-day-level {
    background: var(--surface-bg);
    border: 2px solid var(--border-subtle);
    cursor: pointer;
    color: var(--text-primary);
    transition: background 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
    height: auto;
}

.calendar-day-level:hover {
    background: var(--surface-hover);
    border-color: var(--accent);
    transform: scale(1.06);
}

.calendar-day-level.active {
    background: linear-gradient(135deg, var(--accent-start) 0%, var(--accent-end) 100%);
    color: var(--text-on-accent);
    border-color: var(--accent);
}

.calendar-day-num {
    font-weight: bold;
    font-size: 1em;
    line-height: 1.2;
}

.calendar-level-num {
    font-size: 0.8em;
    opacity: 0.7;
    white-space: nowrap;
}

.calendar-level-name {
    font-size: 0.8em;
    font-weight: 500;
    white-space: normal;
    overflow-wrap: break-word;
    word-break: break-word;
    max-width: 100%;
}

.calendar-status {
    font-size: 1em;
    line-height: 1.2;
    margin-top: 2px;
}

.calendar-status-syncing {
    color: var(--text-muted);
    font-size: 0.85em;
}

/* ========== Cloud Sync Bar ========== */
.cloud-sync-bar {
    text-align: center;
    margin-bottom: 8px;
    min-height: 32px;
}

.cloud-sync-login-btn {
    background: none;
    border: 1px solid var(--accent);
    color: var(--accent);
    padding: 4px 12px;
    border-radius: 16px;
    cursor: pointer;
    font-size: 0.85em;
    transition: background 0.2s, color 0.2s;
    height: auto;
}

.cloud-sync-login-btn:hover {
    background: var(--accent-start);
    color: var(--text-on-accent);
}

.cloud-sync-user-info {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    flex-wrap: wrap;
    font-size: 0.85em;
    flex-direction: column;
}

.cloud-sync-email {
    color: var(--text-secondary);
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: block;
}

.cloud-sync-status {
    font-size: 0.8em;
    padding: 2px 8px;
    border-radius: 10px;
    display: block;
}

.cloud-sync-status.synced {
    color: var(--success-text);
    background: var(--success-bg);
}

.cloud-sync-status.syncing {
    color: var(--warning-text);
    background: var(--warning-bg);
}

.cloud-sync-status.error {
    color: var(--error-text);
    background: var(--error-bg);
}

/* ========== Cloud Sync Auth Modal ========== */
.cloud-sync-modal-content {
    max-width: 400px;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 15px;
}

.auth-form label {
    font-weight: 600;
    font-size: 0.9em;
    color: var(--text-primary);
}

.auth-input {
    padding: 0 12px;
    height: var(--ctrl-height);
    border: 1px solid var(--border-default);
    border-radius: 8px;
    font-size: 1em;
    width: 100%;
    box-sizing: border-box;
    background: var(--surface-bg);
    color: var(--text-primary);
}

.auth-input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 2px var(--accent-glow);
}

.auth-error {
    color: var(--error-text);
    background: var(--error-bg);
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 0.9em;
}

.profile-success {
    color: var(--success-text);
    background: var(--success-bg);
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 0.9em;
}

.auth-buttons {
    display: flex;
    gap: 10px;
    margin-top: 5px;
}

.auth-btn {
    flex: 1;
    padding: 0 10px;
    height: var(--ctrl-height);
    border: none;
    border-radius: 8px;
    font-size: 0.95em;
    cursor: pointer;
    transition: opacity 0.2s;
}

.auth-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.auth-btn-primary {
    background: linear-gradient(135deg, var(--accent-start) 0%, var(--accent-end) 100%);
    color: var(--text-on-accent);
}

.auth-btn-primary:hover:not(:disabled) {
    opacity: 0.9;
}

.auth-btn-secondary {
    background: var(--surface-bg);
    color: var(--text-primary);
    border: 1px solid var(--border-default);
}

.auth-btn-secondary:hover:not(:disabled) {
    background: var(--surface-hover);
}

.auth-btn-sm {
    flex: none;
    padding: 0 14px;
    height: calc(var(--ctrl-height) - 8px);
    font-size: 0.85em;
}

.auth-oauth-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 0 11px;
    height: var(--ctrl-height);
    border: none;
    border-radius: 8px;
    font-size: 0.95em;
    cursor: pointer;
    transition: opacity 0.2s;
    font-weight: 600;
}

.auth-oauth-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.auth-oauth-google {
    background: var(--oauth-bg);
    color: var(--oauth-text);
    border: 1px solid var(--border-default);
}

.auth-oauth-google:hover:not(:disabled) {
    background: var(--surface-hover);
}

.auth-oauth-icon {
    font-size: 1.1em;
    font-weight: 700;
    line-height: 1;
}

.auth-divider {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-muted);
    font-size: 0.85em;
    margin: 4px 0;
}

.auth-divider::before,
.auth-divider::after {
    content: '';
    flex: 1;
    border-top: 1px solid var(--border-subtle);
}

.profile-linked-accounts {
    margin-top: 8px;
}

.profile-section-label {
    font-size: 0.85em;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin: 0 0 8px;
}

.linked-account-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 7px 0;
    border-bottom: 1px solid var(--border-subtle);
}

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

.linked-account-name {
    font-size: 0.9em;
    color: var(--text-primary);
}

.linked-account-disconnect {
    background: var(--error-bg);
    color: var(--error-text);
    border: 1px solid var(--error-border);
}

.linked-account-disconnect:hover:not(:disabled) {
    background: var(--error-bg-hover);
}

/* ========== Options Account Section ========== */
.options-account-section {
    border-top: 1px solid var(--border-subtle);
    padding-top: 15px;
}

.options-account-info {
    color: var(--text-secondary);
    margin-bottom: 10px;
    font-size: 0.95em;
}

.options-account-buttons {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.options-account-btn {
    padding: 0 16px;
    height: var(--ctrl-height);
    border: 1px solid var(--accent);
    border-radius: 8px;
    background: none;
    color: var(--accent);
    cursor: pointer;
    font-size: 0.9em;
    transition: background 0.2s, color 0.2s;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
}

.options-account-btn:hover {
    background: var(--accent-start);
    color: var(--text-on-accent);
}

.options-account-delete {
    border-color: var(--error-border);
    color: var(--error-text);
}

.options-account-delete:hover {
    background: var(--error-bg);
    color: var(--error-text);
}

/* Sync error modal */
.sync-error-details {
    background: var(--error-bg);
    border: 1px solid var(--error-border);
    border-radius: 6px;
    padding: 12px;
    font-size: 0.85em;
    white-space: pre-wrap;
    word-break: break-word;
    max-height: 200px;
    overflow-y: auto;
    margin: 8px 0;
    color: var(--error-text);
}
