/* --- Variables & Themes --- */
:root {
    --bg-color: #f3f4f6;
    --card-bg: #ffffff;
    --text-primary: #1f2937;
    --text-secondary: #6b7280;
    --primary: #4f46e5;
    --primary-hover: #4338ca;
    --border: #e5e7eb;
    --red: #ef4444;
    --nav-bg: #ffffff;
    --overlay: rgba(0,0,0,0.6);
    --success: #10b981;
}

[data-theme="dark"] {
    --bg-color: #111827;
    --card-bg: #1f2937;
    --text-primary: #f9fafb;
    --text-secondary: #9ca3af;
    --border: #374151;
    --nav-bg: #1f2937;
    --overlay: rgba(0,0,0,0.8);
}

* { margin: 0; padding: 0; box-sizing: border-box; font-family: 'Inter', sans-serif; -webkit-tap-highlight-color: transparent; }
body { background-color: var(--bg-color); color: var(--text-primary); transition: background 0.3s; overflow-x: hidden; }

/* --- Header --- */
header { display: flex; justify-content: space-between; align-items: center; padding: 1rem 1.5rem; background: var(--card-bg); box-shadow: 0 2px 10px rgba(0,0,0,0.05); position: sticky; top: 0; z-index: 100; }
.logo { font-size: 1.2rem; font-weight: 700; color: var(--primary); display: flex; align-items: center; gap: 8px; }
.profile-icon img { width: 35px; height: 35px; border-radius: 50%; cursor: pointer; border: 2px solid var(--primary); }

/* --- Layout --- */
main { padding: 1rem; padding-bottom: 90px; min-height: 100vh; position: relative; }
.screen { display: none; animation: fadeIn 0.3s ease-in-out; }
.screen.active { display: block; }
.empty-state { display: none; text-align: center; color: var(--text-secondary); margin-top: 3rem; }
.empty-state i { font-size: 3rem; margin-bottom: 1rem; opacity: 0.5; }

/* Spacing */
.fav-spacing { margin-top: 25px; }
.history-spacing { margin-top: 25px; }

/* --- Tracker Card --- */
.tracker-card { background: var(--card-bg); border-radius: 16px; padding: 15px; margin-bottom: 15px; display: flex; align-items: center; gap: 15px; box-shadow: 0 4px 15px rgba(0,0,0,0.03); border: 2px solid var(--border); transition: all 0.2s; position: relative; }
.tracker-card.selectable { cursor: pointer; }
.tracker-card.selected { border-color: var(--primary); background: rgba(79, 70, 229, 0.05); }

/* Multi-select Checkbox */
.select-check { display: none; position: absolute; top: 10px; right: 10px; width: 22px; height: 22px; background: var(--card-bg); border: 2px solid var(--border); border-radius: 50%; align-items: center; justify-content: center; color: white; font-size: 12px; z-index: 5; }
.selectable .select-check { display: flex; }
.selected .select-check { background: var(--primary); border-color: var(--primary); }

.circle-counter { width: 65px; height: 65px; min-width: 65px; border-radius: 50%; border: 3px solid var(--primary); display: flex; flex-direction: column; justify-content: center; align-items: center; color: var(--primary); }
.circle-counter.future { border-color: var(--success); color: var(--success); }
.circle-counter span { font-size: 1.2rem; font-weight: 700; line-height: 1; }
.circle-counter small { font-size: 0.6rem; font-weight: 600; text-transform: uppercase; margin-top: 2px; text-align: center; line-height: 1.1; }

.card-info { flex: 1; overflow: hidden; }
.card-info h3 { font-size: 1.1rem; font-weight: 600; margin-bottom: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-info p { font-size: 0.85rem; color: var(--text-secondary); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

.card-actions { display: flex; flex-direction: column; gap: 15px; align-items: center; z-index: 10; }
.selectable .card-actions { display: none; }
.card-actions i { font-size: 1.2rem; color: var(--text-secondary); cursor: pointer; padding: 5px; }
.card-actions .fa-heart.active { color: var(--red); }
.card-actions .fa-trash { color: var(--red); }

/* --- Forms & Premium UI --- */
.form-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1.5rem; }
.icon-btn { background: rgba(79, 70, 229, 0.1); color: var(--primary); border: none; padding: 8px 15px; border-radius: 20px; font-weight: 600; cursor: pointer; display: flex; align-items: center; gap: 5px; }

/* Present vs Future Radio Cards */
.type-selector { display: flex; gap: 10px; margin-bottom: 1.5rem; width: 100%; }
.radio-card { flex: 1; cursor: pointer; }
.radio-card input { display: none; }
.card-content { border: 2px solid var(--border); border-radius: 12px; padding: 15px 10px; text-align: center; background: var(--card-bg); color: var(--text-secondary); transition: 0.2s; height: 100%; }
.card-content i { font-size: 1.5rem; display: block; margin-bottom: 8px; }
.card-content span { font-size: 0.9rem; font-weight: 600; display: block; }
.card-content small { font-size: 0.75rem; }
.radio-card input:checked + .card-content { border-color: var(--primary); color: var(--primary); background: rgba(79, 70, 229, 0.05); }

.input-group { margin-bottom: 1.2rem; }
.input-group label { display: block; font-size: 0.9rem; font-weight: 600; margin-bottom: 8px; color: var(--text-secondary); }
.premium-input, .input-group input, .input-group textarea { width: 100%; padding: 14px; border-radius: 12px; border: 2px solid var(--border); background: var(--bg-color); color: var(--text-primary); font-size: 1rem; outline: none; transition: 0.3s; }
.input-group input:focus, .input-group textarea:focus, .premium-input:focus { border-color: var(--primary); background: var(--card-bg); box-shadow: 0 4px 10px rgba(79, 70, 229, 0.1); }

.primary-btn { width: 100%; padding: 15px; background: var(--primary); color: #fff; border: none; border-radius: 12px; font-size: 1rem; font-weight: 600; cursor: pointer; transition: 0.2s; }
.primary-btn:active { background: var(--primary-hover); transform: scale(0.98); }

/* --- Bottom Nav --- */
.bottom-nav { position: fixed; bottom: 0; left: 0; width: 100%; background: var(--nav-bg); display: flex; justify-content: space-around; align-items: center; padding: 10px 0; box-shadow: 0 -2px 15px rgba(0,0,0,0.05); border-top: 1px solid var(--border); z-index: 100; transition: transform 0.3s; }
.bottom-nav.hidden { transform: translateY(100%); }
.nav-item { display: flex; flex-direction: column; align-items: center; gap: 4px; color: var(--text-secondary); cursor: pointer; font-size: 0.8rem; font-weight: 500; width: 60px; }
.nav-item i { font-size: 1.3rem; }
.nav-item.active { color: var(--primary); }
.add-btn { position: relative; top: -15px; }
.plus-icon { width: 55px; height: 55px; background: var(--primary); border-radius: 50%; display: flex; justify-content: center; align-items: center; color: white; font-size: 1.8rem; box-shadow: 0 4px 15px rgba(79, 70, 229, 0.4); border: 4px solid var(--nav-bg); }

/* --- Bulk Action Bar --- */
.bulk-bar { position: fixed; bottom: 0; left: 0; width: 100%; background: var(--card-bg); padding: 15px 20px; display: flex; justify-content: space-between; align-items: center; z-index: 150; box-shadow: 0 -5px 20px rgba(0,0,0,0.1); border-top: 1px solid var(--border); transform: translateY(100%); transition: transform 0.3s; }
.bulk-bar.active { transform: translateY(0); }
#selected-count { font-weight: 600; color: var(--text-primary); }
.bulk-actions { display: flex; gap: 10px; }
.bulk-actions button { padding: 8px 15px; border-radius: 8px; border: none; font-weight: 600; cursor: pointer; }
#bulk-cancel-btn { background: var(--border); color: var(--text-primary); }
#bulk-delete-btn { background: var(--red); color: white; }
#bulk-restore-btn { background: var(--success); color: white; display: none; }

/* =======================================================
   STRICT MODALS FIX (POPUPS) - This fixes the video bugs!
======================================================== */
.sm-modal { 
    display: none !important; /* Forces modals to stay hidden until activated */
    position: fixed !important; 
    top: 0 !important; 
    left: 0 !important; 
    width: 100% !important; 
    height: 100% !important; 
    background: var(--overlay) !important; 
    z-index: 9999 !important; 
    justify-content: center !important; 
    align-items: center !important; 
    padding: 20px !important; 
}
.sm-modal.active { display: flex !important; animation: fadeIn 0.2s; }
.sm-modal-content { background: var(--card-bg); width: 100%; max-width: 400px; border-radius: 20px; padding: 25px; box-shadow: 0 10px 40px rgba(0,0,0,0.3); transform: scale(0.9); transition: transform 0.2s; }
.sm-modal.active .sm-modal-content { transform: scale(1); }

.warning-icon { font-size: 3rem; color: var(--red); margin-bottom: 15px; text-align: center; display: block; }
.sm-modal-content h3 { font-size: 1.4rem; margin-bottom: 10px; text-align: center; color: var(--text-primary); }
.sm-modal-content p { color: var(--text-secondary); margin-bottom: 20px; font-size: 0.95rem; line-height: 1.5; text-align: center; }

.modal-buttons { display: flex; gap: 10px; }
.modal-buttons button { flex: 1; padding: 12px; border-radius: 10px; font-weight: 600; border: none; cursor: pointer; }
.btn-secondary { background: var(--border); color: var(--text-primary); }
.btn-danger { background: var(--red); color: white; }

/* Guide Popup Specific */
.guide-content { text-align: left; }
.guide-title { color: var(--primary) !important; margin-bottom: 15px !important; border-bottom: 1px solid var(--border); padding-bottom: 10px; }
.guide-box { background: rgba(79, 70, 229, 0.05); border: 1px solid rgba(79, 70, 229, 0.2); padding: 15px; border-radius: 12px; margin-top: 10px; }
.guide-box h4 { margin-bottom: 5px; color: var(--text-primary); font-size: 0.95rem; }
.guide-box p { font-size: 0.85rem; color: var(--text-secondary); text-align: left !important; margin-bottom: 0 !important; }
.guide-close-btn { margin-top: 20px; }

/* Shared Modal Specific */
.share-content { text-align: center; }
.share-icon { font-size: 3rem; color: var(--primary); margin-bottom: 15px; }
.share-btn { margin-top: 20px; }
.btn-text { background: none; border: none; color: var(--text-secondary); margin-top: 15px; font-weight: 600; cursor: pointer; width: 100%; font-size: 0.95rem; }

/* --- Profile & History (Slide Up) --- */
.slide-up { position: fixed; top: 0; left: 0; width: 100%; height: 100vh; background: var(--bg-color); z-index: 200; overflow-y: auto; padding: 1rem; transform: translateY(100%); transition: transform 0.3s ease-in-out; }
.slide-up.active { transform: translateY(0); display: block; }
.profile-header { display: flex; align-items: center; gap: 15px; margin-bottom: 2rem; }
.back-btn { background: none; border: none; font-size: 1.5rem; color: var(--text-primary); cursor: pointer; }
.danger-text-btn { margin-left: auto; background: none; border: none; color: var(--red); font-weight: 600; cursor: pointer; }

.profile-info { text-align: center; margin-bottom: 2rem; }
.profile-info img { width: 90px; height: 90px; border-radius: 50%; border: 3px solid var(--primary); margin-bottom: 15px; }

.settings-list { list-style: none; background: var(--card-bg); border-radius: 16px; overflow: hidden; border: 1px solid var(--border); }
.settings-list li { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--border); font-weight: 500; cursor: pointer; }
.settings-list li:last-child { border-bottom: none; }
.settings-list li i { width: 25px; color: var(--primary); }

.switch { position: relative; display: inline-block; width: 40px; height: 22px; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background-color: #ccc; transition: .4s; }
.slider:before { position: absolute; content: ""; height: 16px; width: 16px; left: 3px; bottom: 3px; background-color: white; transition: .4s; }
input:checked + .slider { background-color: var(--primary); }
input:checked + .slider:before { transform: translateX(18px); }
.slider.round { border-radius: 34px; }
.slider.round:before { border-radius: 50%; }

.app-footer { text-align: center; margin-top: 3rem; font-size: 0.85rem; color: var(--text-secondary); line-height: 1.6; padding-bottom: 2rem; }
.app-footer .dev { font-weight: 600; color: var(--primary); margin-top: 5px; }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
