:root {
    --bg-color: #0f172a;
    --card-bg: rgba(30, 41, 59, 0.7);
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --accent-color: #6366f1;
    /* Indigo */
    --accent-hover: #4f46e5;
    --success-color: #10b981;
    --danger-color: #ef4444;
    --input-bg: rgba(15, 23, 42, 0.5);
    --border-color: rgba(148, 163, 184, 0.2);
    --glass-border: 1px solid rgba(255, 255, 255, 0.1);
    --blur: 12px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    background-image:
        radial-gradient(circle at 10% 20%, rgba(99, 102, 241, 0.15) 0%, transparent 40%),
        radial-gradient(circle at 90% 80%, rgba(20, 184, 166, 0.15) 0%, transparent 40%);
}

#app {
    width: 100%;
    max-width: 480px;
    /* Mobile first constraint */
    padding: 20px;
    min-height: 100vh;
    position: relative;
}

/* Glassmorphism Cards */
.card {
    background: var(--card-bg);
    backdrop-filter: blur(var(--blur));
    -webkit-backdrop-filter: blur(var(--blur));
    border-radius: 20px;
    border: var(--glass-border);
    padding: 24px;
    margin-bottom: 20px;
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1);
    animation: fadeIn 0.5s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

h1,
h2,
h3 {
    font-weight: 700;
    letter-spacing: -0.025em;
    margin-bottom: 0.5rem;
}

h1 {
    font-size: 2rem;
    background: linear-gradient(to right, #818cf8, #2dd4bf);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

h2 {
    font-size: 1.5rem;
}

p {
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

/* Hero Critical State */
.card.hero-critical {
    border: 2px solid #ef4444;
    background: rgba(239, 68, 68, 0.1);
    animation: none;
    /* Pulse the border maybe? User said "visuals", app.js handled animation class on eeman. Let's keep hero static but red. */
}

.hero-critical .sub-stat {
    color: #fca5a5;
    font-weight: 700;
    color: #fca5a5;
    font-weight: 700;
    font-size: 0.85rem;
}

.hero-critical .hero-stat {
    color: #ef4444;
    text-shadow: 0 0 10px rgba(239, 68, 68, 0.5);
    color: #ef4444;
    text-shadow: 0 0 10px rgba(239, 68, 68, 0.5);
    font-size: 2rem;
}

.hero-critical #countdown {
    color: #fff !important;
}

.time-left {
    font-size: 0.75rem;
    color: var(--accent-color);
    background: rgba(99, 102, 241, 0.1);
    padding: 2px 6px;
    border-radius: 4px;
    margin-left: 8px;
    display: inline-block;
}

/* Forms */
.form-group {
    margin-bottom: 1.5rem;
    text-align: left;
}

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.form-control {
    width: 100%;
    padding: 12px 16px;
    background: var(--input-bg);
    border: var(--glass-border);
    border-radius: 12px;
    color: var(--text-primary);
    font-size: 1rem;
    transition: all 0.2s;
}

.form-control:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2);
}

/* Buttons */
.btn {
    display: block;
    width: 100%;
    padding: 14px;
    border-radius: 12px;
    border: none;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 1rem;
    text-align: center;
}

.btn-primary {
    background: var(--accent-color);
    color: white;
}

.btn-primary:hover {
    background: var(--accent-hover);
    transform: translateY(-1px);
}

.btn-text {
    background: transparent;
    color: var(--text-secondary);
    margin-top: 10px;
}

.btn-text:hover {
    color: var(--text-primary);
    text-decoration: underline;
}

.checkbox-wrapper {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid var(--border-color);
}

.checkbox-wrapper:last-child {
    border-bottom: none;
}

/* Custom Checkbox */
.custom-checkbox {
    width: 24px;
    height: 24px;
    border: 2px solid var(--text-secondary);
    border-radius: 6px;
    cursor: pointer;
    position: relative;
    transition: all 0.2s;
}

.custom-checkbox.checked {
    background: var(--success-color);
    border-color: var(--success-color);
}

.custom-checkbox.checked::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 14px;
}

/* Qalah Controls */
.qalah-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid var(--border-color);
}

.qalah-controls {
    display: flex;
    align-items: center;
    gap: 10px;
}

.btn-sm {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    font-size: 1.2rem;
    line-height: 1;
    padding: 0;
    display: grid;
    place-items: center;
    background: var(--input-bg);
    color: var(--text-primary);
    border: var(--glass-border);
}

.btn-sm:hover {
    background: var(--accent-color);
    border-color: transparent;
}

/* Date Navigator */
.date-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    background: var(--input-bg);
    padding: 8px;
    border-radius: 12px;
}

.date-display {
    font-weight: 600;
}

/* Profile/Location Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 100;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--bg-color);
    border: var(--glass-border);
    padding: 30px;
    border-radius: 20px;
    width: 100%;
    max-width: 400px;
    position: relative;
}

.close-modal {
    position: absolute;
    top: 15px;
    right: 15px;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.5rem;
    cursor: pointer;
}

/* Notifications */
.toast {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--card-bg);
    padding: 12px 24px;
    border-radius: 50px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    border: 1px solid var(--success-color);
    z-index: 200;
    transition: transform 0.3s ease-out;
    white-space: nowrap;
}

.toast.active {
    transform: translateX(-50%) translateY(0);
}

/* Utility */
.hidden {
    display: none !important;
}

.text-center {
    text-align: center;
}

.mt-4 {
    margin-top: 1rem;
}

.hero-stat {
    font-size: 3rem;
    font-weight: 800;
    line-height: 1;
    margin: 10px 0;
}

.sub-stat {
    font-size: 0.9rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

/* Heatmap */
.heatmap-container {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 5px;
    margin-top: 15px;
}

.heatmap-day {
    aspect-ratio: 1;
    border-radius: 4px;
    background: var(--input-bg);
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 0.7rem;
    color: var(--text-secondary);
}

.heatmap-0 {
    background: rgba(239, 68, 68, 0.2);
    color: #fca5a5;
}

/* Red (0 prayers) */
.heatmap-1 {
    background: rgba(239, 68, 68, 0.1);
}

.heatmap-2 {
    background: rgba(251, 191, 36, 0.1);
}

/* Yellow */
.heatmap-3 {
    background: rgba(251, 191, 36, 0.2);
}

.heatmap-4 {
    background: rgba(16, 185, 129, 0.15);
}

/* Greenish */
.heatmap-5 {
    background: rgba(16, 185, 129, 0.4);
    color: #6ee7b7;
    border: 1px solid rgba(16, 185, 129, 0.5);
}

/* Full Green */

/* Quotes */
.quote-card {
    font-style: italic;
    text-align: center;
    border-left: 3px solid var(--accent-color);
}

.quote-text {
    margin-bottom: 0;
    font-size: 0.95rem;
}

/* Expanded Qalah Controls */
.qalah-controls {
    gap: 5px;
}

.manual-input {
    width: 50px;
    padding: 5px;
    text-align: center;
    border-radius: 6px;
    border: var(--glass-border);
    background: var(--bg-color);
    color: var(--text-primary);
    display: none;
    /* Hidden by default */
}

.qalah-item.editing .manual-input {
    display: block;
}

.qalah-item.editing .count-display {
    display: none;
}

/* Eeman Status */
.eeman-card {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.2), rgba(20, 184, 166, 0.2));
    border: 2px solid rgba(130, 255, 200, 0.1);
    box-shadow: 0 0 20px rgba(99, 102, 241, 0.15);
    transform: scale(1.02);
    margin-bottom: 25px;
}

.eeman-level {
    font-size: 1.3rem;
    font-weight: 800;
    background: linear-gradient(to right, #ffffff, #a5f3fc);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

.eeman-bar-bg {
    background: rgba(0, 0, 0, 0.3);
    height: 12px;
    border-radius: 6px;
    margin: 15px 0;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.eeman-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #6366f1, #10b981, #f59e0b);
    width: 0%;
    transition: width 1s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 0 0 10px rgba(16, 185, 129, 0.5);
}

.eeman-card.critical {
    border-color: #ef4444;
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.2), rgba(0, 0, 0, 0.4));
    animation: pulse-danger 2s infinite;
}

.eeman-card.critical .eeman-level {
    background: linear-gradient(to right, #ef4444, #f87171);
    -webkit-background-clip: text;
    background-clip: text;
}

.eeman-card.critical .eeman-bar-fill {
    background: #ef4444;
    box-shadow: 0 0 15px rgba(239, 68, 68, 0.8);
}

.eeman-card.warning .eeman-bar-fill {
    background: #f59e0b;
}

@keyframes pulse-danger {
    0% {
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4);
    }

    70% {
        box-shadow: 0 0 0 10px rgba(239, 68, 68, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0);
    }
}

.eeman-msg {
    font-size: 1rem;
    color: #e2e8f0;
    font-weight: 500;
    text-align: center;
}

/* Search Results */
.search-results {
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    background: var(--bg-color);
    border: var(--glass-border);
    border-radius: 12px;
    margin-top: 5px;
    max-height: 200px;
    overflow-y: auto;
    z-index: 500;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}

.search-item {
    padding: 10px 15px;
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    font-size: 0.9rem;
    color: var(--text-primary);
}

.search-item:hover {
    background: var(--accent-color);
    color: white;
}