:root {
    /* Color Palette */
    --primary: #10b981;
    --primary-rgb: 16, 185, 129;
    --primary-dark: #059669;
    --primary-light: #34d399;
    --secondary: #f59e0b;
    --accent: #6366f1;

    /* Light Theme Defaults */
    --bg-color: #f8fafc;
    --text-color: #1e293b;
    --text-muted: #64748b;
    --card-bg: rgba(255, 255, 255, 0.85);
    --card-border: rgba(226, 232, 240, 0.8);
    --header-bg: rgba(255, 255, 255, 0.8);
    --glass-bg: rgba(255, 255, 255, 0.7);
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    --glass-border: 1px solid rgba(255, 255, 255, 0.2);

    /* Transitions */
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="dark"] {
    --bg-color: #0f172a;
    --text-color: #f1f5f9;
    --text-muted: #94a3b8;
    --card-bg: rgba(30, 41, 59, 0.7);
    --card-border: rgba(51, 65, 85, 0.8);
    --header-bg: rgba(15, 23, 42, 0.8);
    --glass-bg: rgba(30, 41, 59, 0.5);
    --shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.3);
    --glass-border: 1px solid rgba(255, 255, 255, 0.05);
}

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

body {
    font-family: 'Tajawal', 'Outfit', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
    transition: var(--transition);
    overflow-x: hidden;
    direction: rtl;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-color);
}

::-webkit-scrollbar-thumb {
    background: var(--primary-light);
    border-radius: 10px;
}

/* Background Particles */
#particles-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: 1;
    overflow: hidden;
}

.particle {
    position: absolute;
    background: linear-gradient(var(--primary), var(--accent));
    border-radius: 50%;
    opacity: 0.15;
    filter: blur(1px);
    animation: floatParticle 15s infinite linear;
}

@keyframes floatParticle {
    0% {
        transform: translateY(110vh) translateX(0);
        opacity: 0;
    }

    10% {
        opacity: 0.3;
    }

    90% {
        opacity: 0.3;
    }

    100% {
        transform: translateY(-10vh) translateX(50px);
        opacity: 0;
    }
}

.app-container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    position: relative;
    z-index: 2;
}

/* Header */
.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 70px;
    background: var(--header-bg);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 5%;
    z-index: 1000;
    border-bottom: var(--glass-border);
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo i {
    font-size: 24px;
    color: var(--primary);
    text-shadow: 0 0 10px rgba(16, 185, 129, 0.3);
}

.logo h1 {
    font-size: 24px;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.header-actions {
    display: flex;
    gap: 10px;
}

.icon-btn {
    background: var(--glass-bg);
    border: var(--glass-border);
    cursor: pointer;
    font-size: 18px;
    color: var(--text-color);
    width: 42px;
    height: 42px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.icon-btn:hover {
    background: var(--primary);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.2);
}

/* Main Content */
main {
    margin-top: 70px;
    flex: 1;
    padding-bottom: 60px;
}

/* Hero Section */
.hero {
    padding: 120px 5%;
    text-align: center;
    background: linear-gradient(rgba(15, 23, 42, 0.6), rgba(15, 23, 42, 0.6)), url('assets/bg.png');
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    margin-bottom: 40px;
    border-radius: 0 0 50px 50px;
    color: white;
    position: relative;
    overflow: hidden;
}

.hero-content {
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    padding: 40px;
    border-radius: 35px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    display: inline-block;
    max-width: 800px;
    animation: fadeInUp 1s ease-out;
}

.hero h2 {
    font-family: 'Amiri', serif;
    font-size: 48px;
    margin-bottom: 15px;
    color: var(--primary-light);
    text-shadow: 0 2px 15px rgba(0, 0, 0, 0.5);
}

.hero p {
    font-size: 20px;
    color: #cbd5e1;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

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

/* Categories Grid */
.categories-section {
    padding: 0 5%;
}

.section-title {
    font-size: 26px;
    font-weight: 700;
    margin-bottom: 30px;
    position: relative;
    padding-right: 15px;
}

.section-title::before {
    content: '';
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 4px;
    height: 26px;
    background-color: var(--primary);
    border-radius: 2px;
}

.categories-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 25px;
}

.category-card {
    background: var(--card-bg);
    border: var(--glass-border);
    border-radius: 25px;
    padding: 40px 30px;
    cursor: pointer;
    transition: var(--transition);
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    backdrop-filter: blur(10px);
}

.category-card:hover {
    transform: translateY(-10px);
    border-color: var(--primary);
    box-shadow: var(--shadow-lg);
    background: var(--glass-bg);
}

.category-icon {
    width: 65px;
    height: 65px;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 26px;
    box-shadow: 0 8px 15px rgba(16, 185, 129, 0.2);
}

.category-card h4 {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-color);
}

/* Dhikr View */
.dhikr-view {
    padding: 0 5%;
    max-width: 900px;
    margin: 0 auto;
}

.view-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 40px;
}

.back-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--glass-bg);
    border: var(--glass-border);
    padding: 10px 20px;
    border-radius: 15px;
    cursor: pointer;
    color: var(--text-color);
    font-weight: 600;
    transition: var(--transition);
}

.back-btn:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

/* View Mode Toggle - Premium */
#view-mode-toggle {
    background: linear-gradient(135deg, var(--primary), var(--accent));
    color: white;
    width: 48px;
    height: 48px;
    border-radius: 15px;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    transition: var(--transition);
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.3);
}

#view-mode-toggle:hover {
    transform: rotate(90deg) scale(1.1);
    box-shadow: 0 6px 20px rgba(16, 185, 129, 0.5);
}

/* Dhikr List & Cards */
.dhikr-list {
    width: 100%;
}

.dhikr-card {
    background: var(--card-bg);
    border: var(--glass-border);
    border-radius: 35px;
    padding: 40px;
    margin-bottom: 30px;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-shadow: var(--shadow);
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 25px;
}

.dhikr-content {
    font-family: 'Amiri', serif;
    font-size: 32px;
    font-weight: 700;
    line-height: 1.8;
    text-align: center;
    color: var(--text-color);
}

.dhikr-description {
    font-size: 16px;
    font-weight: 500;
    color: var(--text-muted);
    text-align: center;
    padding: 18px;
    background: rgba(var(--primary-rgb), 0.08);
    border-radius: 20px;
    width: 100%;
    border: 1px dashed rgba(var(--primary-rgb), 0.2);
}

.dhikr-footer {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 25px;
    width: 100%;
}

.counter-btn {
    width: 120px;
    height: 120px;
    border-radius: 40px;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    border: none;
    color: white;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    box-shadow: 0 15px 35px rgba(16, 185, 129, 0.4);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    /* Prevent selection and improve mobile touch */
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.counter-btn:hover {
    transform: scale(1.05) translateY(-5px);
}

.counter-btn .remaining {
    font-size: 42px;
    font-weight: 800;
}

.counter-btn .label {
    font-size: 13px;
    opacity: 0.9;
    margin-top: -2px;
}

.counter-btn.done {
    background: linear-gradient(135deg, var(--secondary), #ea580c);
    box-shadow: 0 15px 35px rgba(245, 158, 11, 0.4);
}

.dhikr-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
    width: 100%;
}

.action-btn {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--glass-bg);
    border: var(--glass-border);
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    transition: var(--transition);
}

.action-btn:hover {
    background: var(--primary);
    color: white;
    transform: scale(1.15) rotate(10deg);
}

/* List Mode vs Card Mode */
.dhikr-list.list-mode {
    display: flex;
    flex-direction: column;
}

.dhikr-list.card-mode .dhikr-card {
    display: none;
    width: 100%;
    max-width: 650px;
    margin: 0 auto;
}

.dhikr-list.card-mode .dhikr-card.active-card {
    display: flex;
    animation: premiumFadeIn 0.6s cubic-bezier(0.23, 1, 0.32, 1);
}

@keyframes premiumFadeIn {
    0% {
        opacity: 0;
        transform: scale(0.9) translateY(40px) rotateX(-10deg);
    }

    100% {
        opacity: 1;
        transform: scale(1) translateY(0) rotateX(0);
    }
}

/* Navigation for Card Mode */
.card-nav {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    margin-top: 40px;
}

.nav-btn {
    background: var(--glass-bg);
    border: var(--glass-border);
    padding: 12px 25px;
    border-radius: 18px;
    cursor: pointer;
    color: var(--text-color);
    font-weight: 700;
    transition: var(--transition);
}

.nav-btn:hover:not(:disabled) {
    background: var(--primary);
    color: white;
    transform: translateY(-3px);
}

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

.card-counter {
    background: var(--glass-bg);
    padding: 8px 18px;
    border-radius: 20px;
    font-weight: 800;
    color: var(--primary);
    border: 1px solid var(--primary);
}

/* Progress Bar */
.progress-container {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 8px;
    background: rgba(0, 0, 0, 0.05);
    z-index: 1001;
}

.progress-bar {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--primary), var(--accent), var(--primary));
    background-size: 200% 100%;
    animation: shimmerProgress 3s infinite linear;
    transition: width 0.5s cubic-bezier(0.1, 0, 0.1, 1);
    box-shadow: 0 0 15px var(--primary);
}

@keyframes shimmerProgress {
    0% {
        background-position: 200% 0;
    }

    100% {
        background-position: -200% 0;
    }
}

/* Footer */
.footer {
    padding: 50px;
    text-align: center;
    border-top: var(--glass-border);
    color: var(--text-muted);
    font-size: 15px;
}

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

.toast {
    position: fixed;
    bottom: 40px;
    left: 50%;
    transform: translateX(-50%);
    background: #1e293b;
    color: white;
    padding: 14px 28px;
    border-radius: 50px;
    font-size: 15px;
    z-index: 2000;
    box-shadow: var(--shadow-lg);
    animation: toastIn 0.4s ease-out;
}

@keyframes toastIn {
    from {
        opacity: 0;
        transform: translate(-50%, 30px);
    }

    to {
        opacity: 1;
        transform: translate(-50%, 0);
    }
}

/* Animations Trigger */
.fadeIn {
    animation: fadeInAnim 0.8s ease-out forwards;
}

@keyframes fadeInAnim {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

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

/* Responsive */
@media (max-width: 768px) {
    .hero h2 {
        font-size: 36px;
    }

    .dhikr-content {
        font-size: 26px;
    }

    .hero-content {
        padding: 30px 20px;
    }

    .category-card {
        padding: 30px 20px;
    }

    .counter-btn {
        width: 100px;
        height: 100px;
    }

    .counter-btn .remaining {
        font-size: 34px;
    }

    .nav-btn span {
        display: none;
    }
}