/* ═══════════════════════════════════════════════
   Component Styles — Buttons, Inputs, Cards, Modals, Toasts
   ═══════════════════════════════════════════════ */

/* ─── Buttons ─── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--sp-sm);
    padding: 0.625rem 1.25rem;
    font-family: var(--font-sans);
    font-size: var(--fs-sm);
    font-weight: var(--fw-semibold);
    line-height: 1;
    border: 1px solid transparent;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--duration-base) var(--ease-out);
    text-decoration: none;
    white-space: nowrap;
    user-select: none;
}

.btn:active {
    transform: scale(0.97);
}

.btn-primary {
    background: linear-gradient(135deg, var(--gold-deep), var(--gold-primary));
    color: #1A1A2E;
    border-color: var(--gold-primary);
    box-shadow: var(--shadow-glow);
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--gold-primary), var(--gold-light));
    box-shadow: 0 0 30px rgba(212, 160, 23, 0.3);
    transform: translateY(-1px);
}

.btn-rose {
    background: linear-gradient(135deg, var(--rose-deep), var(--rose-primary));
    color: white;
    border-color: var(--rose-primary);
    box-shadow: var(--shadow-rose);
}

.btn-rose:hover {
    background: linear-gradient(135deg, var(--rose-primary), var(--rose-soft));
    box-shadow: 0 0 30px rgba(233, 30, 99, 0.3);
    transform: translateY(-1px);
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    border-color: var(--border-subtle);
}

.btn-ghost:hover {
    background: var(--bg-glass-hover);
    color: var(--text-primary);
    border-color: rgba(255, 255, 255, 0.15);
}

.btn-danger {
    background: transparent;
    color: var(--danger);
    border-color: var(--danger-soft);
}

.btn-danger:hover {
    background: var(--danger-soft);
    border-color: var(--danger);
}

.btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: var(--fs-xs);
    border-radius: var(--radius-sm);
}

.btn-icon {
    width: 36px;
    height: 36px;
    padding: 0;
    border-radius: var(--radius-full);
    font-size: var(--fs-md);
}

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

/* ─── Input Fields ─── */
.input-field {
    width: 100%;
    padding: 0.75rem 1rem;
    font-family: var(--font-sans);
    font-size: var(--fs-base);
    color: var(--text-primary);
    background: var(--bg-input);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    outline: none;
    transition: all var(--duration-base) var(--ease-out);
}

.input-field::placeholder {
    color: var(--text-muted);
}

.input-field:focus {
    border-color: var(--gold-primary);
    box-shadow: 0 0 0 3px rgba(212, 160, 23, 0.15);
    background: rgba(255, 255, 255, 0.1);
}

textarea.input-field {
    resize: vertical;
    min-height: 80px;
    line-height: 1.5;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: var(--sp-xs);
}

.input-label {
    font-size: var(--fs-sm);
    font-weight: var(--fw-medium);
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* ─── Glass Cards ─── */
.glass-card {
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: var(--sp-lg);
    transition: all var(--duration-base) var(--ease-out);
}

.glass-card:hover {
    background: var(--bg-glass-hover);
    border-color: rgba(255, 255, 255, 0.12);
}

.glass-card-static {
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: var(--sp-lg);
}

/* ─── Section Headers ─── */
.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--sp-md);
}

.section-title {
    font-family: var(--font-serif);
    font-size: var(--fs-lg);
    font-weight: var(--fw-semibold);
    display: flex;
    align-items: center;
    gap: var(--sp-sm);
}

/* ─── Task Items ─── */
.task-item {
    display: flex;
    align-items: flex-start;
    gap: var(--sp-md);
    padding: var(--sp-md);
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid transparent;
    transition: all var(--duration-base) var(--ease-out);
}

.task-item:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: var(--border-subtle);
}

.task-item.completed {
    opacity: 0.6;
}

.task-item.completed .task-text {
    text-decoration: line-through;
    color: var(--text-muted);
}

.task-checkbox {
    appearance: none;
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    min-width: 20px;
    border: 2px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--duration-fast) var(--ease-out);
    position: relative;
    margin-top: 2px;
}

.task-checkbox:checked {
    background: var(--gold-primary);
    border-color: var(--gold-primary);
}

.task-checkbox:checked::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: var(--charcoal);
    font-size: 12px;
    font-weight: bold;
}

.task-text {
    flex: 1;
    font-size: var(--fs-base);
}

.task-meta {
    font-size: var(--fs-xs);
    color: var(--text-muted);
    margin-top: var(--sp-xs);
}

/* ─── Entry Items (food, learned) ─── */
.entry-item {
    display: flex;
    align-items: flex-start;
    gap: var(--sp-md);
    padding: var(--sp-sm) var(--sp-md);
    border-radius: var(--radius-sm);
    transition: background var(--duration-fast) var(--ease-out);
}

.entry-item:hover {
    background: rgba(255, 255, 255, 0.03);
}

.entry-time {
    font-size: var(--fs-xs);
    color: var(--text-muted);
    font-family: var(--font-sans);
    font-weight: var(--fw-medium);
    min-width: 60px;
    padding-top: 2px;
}

.entry-text {
    flex: 1;
    font-size: var(--fs-base);
}

/* ─── Timeline Items ─── */
.timeline-item {
    display: flex;
    gap: var(--sp-md);
    padding: var(--sp-sm) 0;
    position: relative;
}

.timeline-item::before {
    content: '';
    position: absolute;
    left: 5px;
    top: 28px;
    bottom: -8px;
    width: 1px;
    background: var(--border-subtle);
}

.timeline-item:last-child::before {
    display: none;
}

.timeline-dot {
    width: 11px;
    height: 11px;
    min-width: 11px;
    border-radius: var(--radius-full);
    background: var(--gold-primary);
    margin-top: 6px;
    box-shadow: 0 0 8px rgba(212, 160, 23, 0.4);
}

.timeline-content {
    flex: 1;
}

.timeline-time {
    font-size: var(--fs-xs);
    color: var(--text-muted);
    margin-bottom: 2px;
}

.timeline-text {
    font-size: var(--fs-base);
    color: var(--text-primary);
}

/* ─── Modal ─── */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: var(--z-modal);
    opacity: 0;
    visibility: hidden;
    transition: all var(--duration-base) var(--ease-out);
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: var(--charcoal);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-xl);
    padding: var(--sp-xl);
    width: 90%;
    max-width: 520px;
    max-height: 85vh;
    overflow-y: auto;
    transform: scale(0.95) translateY(10px);
    transition: transform var(--duration-base) var(--ease-spring);
    box-shadow: var(--shadow-lg);
}

.modal-overlay.active .modal {
    transform: scale(1) translateY(0);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--sp-lg);
}

.modal-title {
    font-family: var(--font-serif);
    font-size: var(--fs-xl);
}

.modal-close {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-size: var(--fs-lg);
    cursor: pointer;
    border-radius: var(--radius-full);
    transition: all var(--duration-fast) var(--ease-out);
}

.modal-close:hover {
    background: var(--bg-glass-hover);
    color: var(--text-primary);
}

.modal-body {
    display: flex;
    flex-direction: column;
    gap: var(--sp-md);
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: var(--sp-sm);
    margin-top: var(--sp-lg);
}

/* ─── Toast Notifications ─── */
.toast-container {
    position: fixed;
    bottom: var(--sp-xl);
    right: var(--sp-xl);
    display: flex;
    flex-direction: column;
    gap: var(--sp-sm);
    z-index: var(--z-toast);
    pointer-events: none;
}

.toast {
    padding: var(--sp-md) var(--sp-lg);
    border-radius: var(--radius-md);
    background: var(--charcoal);
    border: 1px solid var(--border-subtle);
    color: var(--text-primary);
    font-size: var(--fs-sm);
    box-shadow: var(--shadow-md);
    pointer-events: auto;
    animation: slideUp var(--duration-base) var(--ease-spring);
    display: flex;
    align-items: center;
    gap: var(--sp-sm);
}

.toast.success {
    border-left: 3px solid var(--success);
}

.toast.error {
    border-left: 3px solid var(--danger);
}

.toast.info {
    border-left: 3px solid var(--gold-primary);
}

.toast-icon {
    font-size: var(--fs-md);
}

/* ─── Empty State ─── */
.empty-state {
    text-align: center;
    padding: var(--sp-3xl) var(--sp-xl);
    color: var(--text-muted);
}

.empty-state-icon {
    font-size: 3rem;
    margin-bottom: var(--sp-md);
    opacity: 0.5;
}

.empty-state-text {
    font-family: var(--font-serif);
    font-size: var(--fs-lg);
    font-style: italic;
}

/* ─── Badges ─── */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.2rem 0.6rem;
    font-size: var(--fs-xs);
    font-weight: var(--fw-semibold);
    border-radius: var(--radius-full);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.badge-active {
    background: var(--success-soft);
    color: var(--success);
}

.badge-completed {
    background: var(--warning-soft);
    color: var(--warning);
}

.badge-deleted {
    background: var(--danger-soft);
    color: var(--danger);
}

.badge-admin {
    background: linear-gradient(135deg, var(--gold-deep), var(--gold-primary));
    color: var(--charcoal);
}

/* ─── Inline Edit ─── */
.inline-edit {
    background: transparent;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: inherit;
    padding: 2px 6px;
    width: 100%;
    transition: all var(--duration-fast) var(--ease-out);
}

.inline-edit:hover {
    border-color: var(--border-subtle);
}

.inline-edit:focus {
    outline: none;
    border-color: var(--gold-primary);
    background: var(--bg-input);
    box-shadow: 0 0 0 2px rgba(212, 160, 23, 0.1);
}

/* ─── Divider ─── */
.divider {
    height: 1px;
    background: var(--border-subtle);
    margin: var(--sp-md) 0;
}

/* ─── Loading Spinner ─── */
.spinner {
    width: 24px;
    height: 24px;
    border: 2px solid var(--border-subtle);
    border-top-color: var(--gold-primary);
    border-radius: var(--radius-full);
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.loading-overlay {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--sp-3xl);
}