/* ================================================================
   Thithi Event Manager — event-manager.css
   All selectors prefixed with .te- or #te- to avoid collisions
   with existing thithi_search styles.
   ================================================================ */

/* ── Shared overlay (reuses ts-overlay pattern) ─────────────────── */
#te-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.45);
    z-index: 1100;
    transition: opacity .2s;
}
#te-overlay.te-visible { display: block; }

/* ── User bar ────────────────────────────────────────────────────── */
#te-user-bar {
    display: none;          /* shown by JS when authenticated */
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 6px 14px;
    background: #e8f5e9;
    border-bottom: 1px solid #c8e6c9;
    font-size: 12px;
    color: #2e7d32;
    font-weight: 600;
}
#te-user-bar .te-user-info { display: flex; align-items: center; gap: 6px; }
#te-user-bar .te-user-icon { font-size: 15px; }
#te-logout-btn {
    padding: 3px 10px;
    background: none;
    border: 1.5px solid #a5d6a7;
    border-radius: 12px;
    color: #388e3c;
    font-size: 11px;
    cursor: pointer;
    transition: all .15s;
}
#te-logout-btn:hover { background: #fff; border-color: #388e3c; }

/* ── Login trigger button ────────────────────────────────────────── */
#te-login-btn {
    display: none;          /* shown by JS when NOT authenticated */
    align-items: center;
    gap: 5px;
    padding: 4px 12px;
    background: #1565c0;
    color: #fff;
    border: none;
    border-radius: 14px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    margin: 6px 14px;
    transition: background .15s;
}
#te-login-btn:hover { background: #0d47a1; }

/* ── Create "+" FAB ──────────────────────────────────────────────── */
#te-create-fab {
    display: none;          /* shown by JS when authenticated */
    position: fixed;
    bottom: 80px;           /* level with the existing search FAB (#ts-fab) */
    left: 16px;             /* opposite side from #ts-fab (right:16px) so they never overlap */
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: #EF6C00;
    color: #fff;
    font-size: 26px;
    font-weight: 300;
    line-height: 1;
    border: none;
    box-shadow: 0 3px 10px rgba(0,0,0,.3);
    cursor: pointer;
    align-items: center;
    justify-content: center;
    z-index: 1100;
    transition: background .15s, transform .15s;
}
#te-create-fab:hover { background: #E65100; transform: scale(1.07); }
#te-create-fab.te-active { background: #555; }

/* ── Bottom-sheet panels (login + form) ──────────────────────────── */
.te-panel {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    max-height: 92vh;
    background: #fff;
    border-radius: 16px 16px 0 0;
    box-shadow: 0 -4px 24px rgba(0,0,0,.18);
    z-index: 1200;
    display: flex;
    flex-direction: column;
    transform: translateY(110%);
    transition: transform .28s cubic-bezier(.4,0,.2,1);
}
.te-panel.te-open { transform: translateY(0); }

.te-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px 10px;
    border-bottom: 1px solid #eee;
    flex-shrink: 0;
}
.te-panel-title { font-size: 15px; font-weight: 700; color: #222; margin: 0; }
.te-panel-close {
    width: 32px; height: 32px;
    border: none; background: #f5f5f5; border-radius: 50%;
    font-size: 16px; cursor: pointer; display: flex;
    align-items: center; justify-content: center; color: #555;
    transition: background .15s;
}
.te-panel-close:hover { background: #eeeeee; }

.te-panel-body {
    overflow-y: auto;
    flex: 1;
    padding: 14px 16px;
    -webkit-overflow-scrolling: touch;
}

/* ── Login panel specifics ───────────────────────────────────────── */
#te-login-panel { max-height: 60vh; }

.te-login-step { margin-bottom: 16px; }
.te-login-step label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: #555;
    margin-bottom: 4px;
}
.te-login-step input[type="text"],
.te-login-step input[type="tel"] {
    width: 100%;
    padding: 10px 12px;
    border: 1.5px solid #ccc;
    border-radius: 8px;
    font-size: 16px;   /* 16px prevents iOS zoom */
    box-sizing: border-box;
    transition: border-color .15s;
}
.te-login-step input:focus { outline: none; border-color: #1565c0; }

.te-login-msg {
    font-size: 12px;
    margin: 6px 0;
    min-height: 16px;
    transition: color .2s;
}
.te-login-msg.error  { color: #c62828; }
.te-login-msg.success { color: #2e7d32; }

/* ── Primary button (shared) ─────────────────────────────────────── */
.te-btn-primary {
    display: block;
    width: 100%;
    padding: 12px;
    background: #1565c0;
    color: #fff;
    border: none;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    letter-spacing: .3px;
    transition: background .18s, opacity .18s;
}
.te-btn-primary:hover    { background: #0d47a1; }
.te-btn-primary:disabled { opacity: .55; cursor: default; }
.te-btn-secondary {
    display: block;
    width: 100%;
    padding: 11px;
    background: none;
    border: 1.5px solid #ccc;
    border-radius: 10px;
    font-size: 13px;
    color: #555;
    cursor: pointer;
    margin-top: 8px;
    transition: border-color .15s;
}
.te-btn-secondary:hover { border-color: #888; }

/* ── Create/Edit form panel ──────────────────────────────────────── */
#te-form-panel { max-height: 92vh; }

.te-form-section-title {
    font-size: 13px;
    font-weight: 700;
    color: #333;
    margin: 14px 0 8px;
    padding-bottom: 4px;
    border-bottom: 2px solid #fff3e0;
}

/* Combination cards */
.te-combo-list { display: flex; flex-direction: column; gap: 10px; }
.te-combo-card {
    border: 1.5px solid #ddd;
    border-radius: 10px;
    padding: 10px 12px;
    background: #fafafa;
    position: relative;
}
.te-combo-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}
.te-combo-label {
    font-size: 11px;
    font-weight: 700;
    color: #888;
    text-transform: uppercase;
    letter-spacing: .5px;
}
.te-remove-combo {
    width: 22px; height: 22px;
    border: none; background: #ffebee; border-radius: 50%;
    color: #c62828; font-size: 14px; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    line-height: 1;
    transition: background .15s;
}
.te-remove-combo:hover { background: #ffcdd2; }

/* Dimension rows within a combo card */
.te-dim-row { margin-bottom: 8px; }
.te-dim-label {
    font-size: 11px;
    font-weight: 600;
    color: #666;
    margin-bottom: 3px;
}
.te-chips { display: flex; flex-wrap: wrap; gap: 3px; }
.te-chip {
    padding: 2px 8px;
    border-radius: 12px;
    border: 1.5px solid #ffe0b2;
    background: #fff;
    font-size: 11px;
    cursor: pointer;
    color: #444;
    user-select: none;
    transition: all .13s;
}
.te-chip:hover { border-color: #ffa726; background: #fff8e1; }
.te-chip.te-sel {
    background: #EF6C00;
    color: #fff;
    border-color: #E65100;
    font-weight: 600;
}

/* Add combination button */
#te-add-combo-btn {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 7px 12px;
    background: none;
    border: 1.5px dashed #aaa;
    border-radius: 8px;
    font-size: 12px;
    color: #555;
    cursor: pointer;
    margin-top: 8px;
    width: 100%;
    justify-content: center;
    transition: border-color .15s, color .15s;
}
#te-add-combo-btn:hover { border-color: #EF6C00; color: #E65100; }

/* Form fields */
.te-field { margin-bottom: 12px; }
.te-field label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: #555;
    margin-bottom: 3px;
}
.te-field input[type="text"],
.te-field textarea {
    width: 100%;
    padding: 9px 11px;
    border: 1.5px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
    box-sizing: border-box;
    font-family: inherit;
    transition: border-color .15s;
}
.te-field input[type="text"]:focus,
.te-field textarea:focus { outline: none; border-color: #1565c0; }
.te-field textarea { resize: vertical; min-height: 72px; }
.te-field .te-required { color: #c62828; }

/* Form action bar */
.te-form-actions {
    flex-shrink: 0;
    padding: 12px 16px 16px;
    border-top: 1px solid #eee;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* Status message inside form */
.te-form-msg {
    font-size: 12px;
    padding: 8px 10px;
    border-radius: 6px;
    display: none;
}
.te-form-msg.error   { display: block; background: #ffebee; color: #c62828; }
.te-form-msg.success { display: block; background: #e8f5e9; color: #2e7d32; }
.te-form-msg.info    { display: block; background: #e3f2fd; color: #1565c0; }

/* ── Edit/Delete buttons on event rows ───────────────────────────── */
.te-row-actions {
    display: flex;
    gap: 6px;
    padding: 5px 0 2px;
    margin-top: 4px;
}
.te-row-btn {
    padding: 3px 9px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    border: 1.5px solid;
    transition: all .13s;
    background: #fff;
}
.te-row-btn.te-edit-btn   { color: #1565c0; border-color: #90caf9; }
.te-row-btn.te-edit-btn:hover   { background: #e3f2fd; border-color: #1565c0; }
.te-row-btn.te-delete-btn { color: #c62828; border-color: #ef9a9a; }
.te-row-btn.te-delete-btn:hover { background: #ffebee; border-color: #c62828; }

/* ── Delete confirmation toast-dialog ────────────────────────────── */
#te-delete-dialog {
    display: none;
    position: fixed;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%);
    width: min(340px, calc(100vw - 32px));
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0,0,0,.22);
    padding: 16px;
    z-index: 1300;
    text-align: center;
}
#te-delete-dialog.te-visible { display: block; }
#te-delete-dialog .te-dialog-title {
    font-size: 14px;
    font-weight: 700;
    margin-bottom: 4px;
}
#te-delete-dialog .te-dialog-body {
    font-size: 12px;
    color: #555;
    margin-bottom: 12px;
}
#te-delete-dialog .te-dialog-actions { display: flex; gap: 8px; }
#te-delete-dialog .te-dialog-actions button { flex: 1; padding: 9px; border-radius: 8px; font-size: 13px; font-weight: 600; cursor: pointer; border: none; }
#te-confirm-delete { background: #c62828; color: #fff; }
#te-cancel-delete  { background: #f5f5f5; color: #555; }
