/**
 * Misbaha.net - Modern Custom Styles
 * Mobile-first, modern design with dark mode support
 */

/* CSS Variables for Theme Support */
:root {
    /* Light Mode Colors */
    --bg-primary: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --bg-secondary: linear-gradient(135deg, #f5f7fa 0%, #e8f5e9 100%);
    --bg-card: #ffffff;
    --bg-navbar: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
    --text-primary: #1f2937;
    --text-secondary: #6b7280;
    --text-muted: #9ca3af;
    --border-color: #e5e7eb;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    --accent-color: #22c55e;
    --accent-hover: #16a34a;
    --accent-light: rgba(34, 197, 94, 0.1);
    --counter-bg: linear-gradient(135deg, #f0f9f4 0%, #e8f5e9 100%);
}

[data-theme="dark"] {
    /* Dark Mode Colors */
    --bg-primary: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
    --bg-secondary: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
    --bg-card: #1e293b;
    --bg-navbar: linear-gradient(135deg, #16a34a 0%, #15803d 100%);
    --text-primary: #f1f5f9;
    --text-secondary: #cbd5e1;
    --text-muted: #94a3b8;
    --border-color: #334155;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4), 0 2px 4px -1px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.4), 0 4px 6px -2px rgba(0, 0, 0, 0.3);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.5), 0 10px 10px -5px rgba(0, 0, 0, 0.4);
    --accent-color: #22c55e;
    --accent-hover: #16a34a;
    --accent-light: rgba(34, 197, 94, 0.2);
    --counter-bg: linear-gradient(135deg, #000000 0%, #132a1b 100%);
}

/* RTL Support */
body.rtl {
    direction: rtl;
    text-align: right;
}

body.ltr {
    direction: ltr;
    text-align: left;
}

/* Arabic Font */
body.rtl,
body.rtl * {
    font-family: 'Segoe UI', Tahoma, Arial, 'Arabic Typesetting', 'Traditional Arabic', sans-serif;
}

/* Base Styles */
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg-secondary);
    min-height: 100vh;
    color: var(--text-primary);
    transition: background 0.3s ease, color 0.3s ease;
}

/* Navigation - Modern Gradient */
.navbar {
    background: var(--bg-navbar) !important;
    box-shadow: var(--shadow-lg);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.navbar-brand {
    font-size: 1.5rem;
    font-weight: 700;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* Theme Toggle Button */
.theme-toggle {
    border-radius: 50%;
    width: 40px;
    height: 40px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    border: 2px solid rgba(255, 255, 255, 0.3);
}

.theme-toggle:hover {
    transform: scale(1.1);
    border-color: rgba(255, 255, 255, 0.5);
    background-color: rgba(255, 255, 255, 0.1);
}

.theme-toggle .theme-icon-light,
.theme-toggle .theme-icon-dark {
    font-size: 1.2rem;
    transition: transform 0.3s ease;
}

[data-theme="dark"] .theme-icon-dark {
    display: none !important;
}

[data-theme="dark"] .theme-icon-light {
    display: inline-block !important;
}

.theme-icon-light {
    display: none;
}

/* Cards - Modern Glass Effect */
.card {
    background: var(--bg-card);
    border-radius: 20px;
    border: 1px solid var(--border-color);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--shadow-md);
    backdrop-filter: blur(10px);
}

.card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-xl);
    border-color: var(--accent-color);
}

.card-body {
    padding: 2rem;
}

/* Counter Display - Modern Typography */
#counter-display {
    font-size: 5rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--accent-color) 0%, var(--accent-hover) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: none;
    transition: all 0.3s ease;
    user-select: none;
    letter-spacing: -2px;
}

#counter-display.animate {
    transform: scale(1.15);
    filter: brightness(1.2);
}

/* Counter Button - Theme-Aware Gradient */
#counter-btn {
    background: var(--counter-bg);
    border-radius: 16px;
    font-weight: 700;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: none;
    box-shadow: 0 8px 16px rgba(34, 197, 94, 0.3);
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    position: relative;
    overflow: hidden;
    color: #22c55e;
}

#counter-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(34, 197, 94, 0.2), transparent);
    transition: left 0.5s;
}

#counter-btn:hover::before {
    left: 100%;
}

#counter-btn:active {
    transform: scale(0.96);
    box-shadow: 0 4px 8px rgba(34, 197, 94, 0.2);
}

/* Light mode active state */
:root:not([data-theme="dark"]) #counter-btn:active {
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.15) 0%, rgba(232, 245, 233, 0.95) 100%);
}

/* Dark mode active state */
[data-theme="dark"] #counter-btn:active {
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.1) 0%, rgba(19, 42, 27, 0.95) 100%);
}

#counter-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 24px rgba(34, 197, 94, 0.4);
}

/* Reset Button - Modern Style */
#reset-btn {
    border-radius: 12px;
    transition: all 0.3s ease;
    border: 2px solid var(--border-color);
    background: transparent;
    color: var(--text-secondary);
}

#reset-btn:hover {
    background: var(--text-secondary);
    color: var(--bg-card);
    border-color: var(--text-secondary);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

/* Buttons - Modern Touch Targets */
.btn {
    min-height: 48px;
    font-size: 1.1rem;
    border-radius: 12px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-weight: 600;
}

.btn-lg {
    min-height: 64px;
    font-size: 1.5rem;
    border-radius: 16px;
}

.btn-success {
    background: linear-gradient(135deg, var(--accent-color) 0%, var(--accent-hover) 100%);
    border: none;
    box-shadow: 0 4px 12px rgba(34, 197, 94, 0.3);
}

.btn-success:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(34, 197, 94, 0.4);
}

.btn-outline-success {
    border: 2px solid var(--accent-color);
    color: var(--accent-color);
    background: transparent;
}

.btn-outline-success:hover {
    background: var(--accent-color);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(34, 197, 94, 0.3);
}

/* Links - Modern Style */
a {
    color: var(--accent-color);
    text-decoration: none;
    transition: all 0.2s ease;
    font-weight: 500;
}

a:hover {
    color: var(--accent-hover);
    text-decoration: underline;
}

/* Footer - Modern Style */
footer {
    margin-top: auto;
    border-top: 1px solid var(--border-color);
    background: var(--bg-card);
    backdrop-filter: blur(10px);
}

footer .text-muted {
    color: var(--text-muted) !important;
}

/* Navigation Links */
.nav-link {
    transition: all 0.2s ease;
    border-radius: 8px;
    margin: 0 4px;
    padding: 8px 16px !important;
}

.nav-link:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: translateY(-1px);
}

.nav-link.active {
    background: rgba(255, 255, 255, 0.2);
    font-weight: 600;
}

/* Dropdown Menu - Modern Style */
.dropdown-menu {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    padding: 8px;
    margin-top: 8px;
}

.dropdown-item {
    border-radius: 8px;
    padding: 10px 16px;
    transition: all 0.2s ease;
    color: var(--text-primary);
}

.dropdown-item:hover {
    background: var(--accent-light);
    color: var(--accent-color);
    transform: translateX(4px);
}

.dropdown-item.active {
    background: var(--accent-color);
    color: white;
}

/* Mobile Optimizations */
@media (max-width: 768px) {
    #counter-display {
        font-size: 4rem;
        min-height: 100px;
        line-height: 100px;
    }
    
    .display-4 {
        font-size: 2rem;
    }
    
    .card-body {
        padding: 1.5rem !important;
    }
    
    #counter-btn {
        font-size: 1.3rem;
        padding: 1rem !important;
    }
    
    .container {
        padding-left: 1rem;
        padding-right: 1rem;
    }
    
    .theme-toggle {
        width: 36px;
        height: 36px;
    }
}

/* Very small screens */
@media (max-width: 480px) {
    #counter-display {
        font-size: 3rem;
        min-height: 80px;
        line-height: 80px;
    }
    
    .display-4 {
        font-size: 1.75rem;
    }
    
    #counter-btn {
        font-size: 1.2rem;
    }
}

/* Accessibility */
*:focus {
    outline: 2px solid var(--accent-color);
    outline-offset: 2px;
    border-radius: 4px;
}

/* Smooth scrolling */
html {
    scroll-behavior: smooth;
}

/* Loading state */
.loading {
    opacity: 0.6;
    pointer-events: none;
}

/* Dhikr Pages - Modern Typography */
.dhikr-content {
    font-size: 1.2rem;
    line-height: 1.8;
    color: var(--text-secondary);
}

.dhikr-title {
    color: var(--accent-color);
    font-weight: 700;
    margin-bottom: 1rem;
}

.dhikr-content p {
    margin-bottom: 1rem;
}

.dhikr-content strong {
    color: var(--text-primary);
    font-weight: 600;
}

/* Contact Form - Modern Style */
.form-control {
    background: var(--bg-card);
    border: 2px solid var(--border-color);
    border-radius: 12px;
    color: var(--text-primary);
    transition: all 0.3s ease;
    padding: 12px 16px;
}

.form-control:focus {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 4px var(--accent-light);
    background: var(--bg-card);
    color: var(--text-primary);
}

.form-control::placeholder {
    color: var(--text-muted);
}

.form-label {
    color: var(--text-primary);
    font-weight: 600;
    margin-bottom: 8px;
}

/* Alert Messages */
.alert {
    border-radius: 12px;
    border: none;
    box-shadow: var(--shadow-md);
}

.alert-success {
    background: var(--accent-light);
    color: var(--accent-color);
    border-left: 4px solid var(--accent-color);
}

.alert-danger {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
    border-left: 4px solid #ef4444;
}

/* Prevent text selection on counter */
#counter-display,
#counter-btn {
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

/* Smooth theme transition */
* {
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

/* Text colors */
.text-success {
    color: var(--accent-color) !important;
}

.text-muted {
    color: var(--text-muted) !important;
}

/* Background utilities */
.bg-light {
    background: var(--bg-card) !important;
}

/* Modern gradient text */
.gradient-text {
    background: linear-gradient(135deg, var(--accent-color) 0%, var(--accent-hover) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* ============================================
   MINIMAL DESIGN - BLACK BACKGROUND WITH GREEN NUMBER
   ============================================ */

body.minimal-layout {
    overflow: hidden;
}

.minimal-main {
    padding: 0;
    margin: 0;
    height: 100vh;
}

.minimal-counter-page {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    background: #000000;
    overflow: hidden;
}

/* Theme-aware background for minimal counter page */
[data-theme="light"] .minimal-counter-page {
    background: linear-gradient(135deg, #f5f7fa 0%, #e8f5e9 100%);
}

[data-theme="dark"] .minimal-counter-page {
    background: #000000;
}

/* Top Controls Bar */
.top-controls-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
    z-index: 1000;
    border-bottom: 2px solid rgba(34, 197, 94, 0.4);
}

.top-btn {
    width: 44px;
    height: 44px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    color: #ffffff;
    cursor: pointer;
    transition: all 0.2s ease;
    touch-action: manipulation;
}

.top-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.3);
    transform: scale(1.05);
}

.top-btn:active {
    transform: scale(0.95);
}

.top-btn svg {
    stroke: currentColor;
}

.top-actions {
    display: flex;
    gap: 8px;
}

/* Increment Dropdown */
.dropdown-increment {
    position: relative;
}

.dropdown-toggle-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 16px;
    min-width: 80px;
    justify-content: space-between;
}

.dropdown-toggle-btn svg {
    transition: transform 0.2s ease;
}

.dropdown-increment.active .dropdown-toggle-btn svg {
    transform: rotate(180deg);
}

.dropdown-increment-menu {
    position: absolute;
    top: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    padding: 8px;
    min-width: 120px;
    max-height: 300px;
    overflow-y: auto;
    display: none;
    flex-direction: column;
    gap: 4px;
    z-index: 2000;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
}

.dropdown-increment.active .dropdown-increment-menu {
    display: flex;
}

.increment-option {
    padding: 10px 16px;
    font-size: 0.9rem;
    font-weight: 500;
    background: transparent;
    border: none;
    border-radius: 8px;
    color: #ffffff;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
    touch-action: manipulation;
}

.increment-option:hover {
    background: rgba(34, 197, 94, 0.2);
    color: #22c55e;
}

.increment-option.active {
    background: #22c55e;
    color: #000000;
    font-weight: 600;
}

/* Counter Display - Black Background with Green Number */
.counter-display-minimal {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 100;
    text-align: center;
    pointer-events: none;
    width: 100%;
    padding: 0 20px;
}

.counter-number-minimal {
    font-size: 6rem;
    font-weight: 300;
    color: #22c55e;
    user-select: none;
    transition: all 0.2s ease;
    letter-spacing: -4px;
    line-height: 1;
    text-shadow: 0 0 20px rgba(34, 197, 94, 0.3);
}

.counter-number-minimal.animate {
    transform: scale(1.15);
    color: #16a34a;
    text-shadow: 0 0 30px rgba(34, 197, 94, 0.5);
}

.counter-hint {
    font-size: 0.875rem;
    color: rgba(255, 255, 255, 0.4);
    opacity: 0.6;
    font-weight: 400;
    margin-top: 16px;
}

/* Full Screen Counter Button */
.fullscreen-counter-btn-minimal {
    flex: 1;
    width: 100%;
    background: var(--counter-bg);
    border: none;
    cursor: pointer;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    transition: background 0.2s ease;
    margin-top: 60px;
}

.fullscreen-counter-btn-minimal:active {
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.1) 0%, rgba(19, 42, 27, 0.95) 100%);
}

/* Edit Modal */
.edit-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
    z-index: 3000;
    display: none;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.edit-modal.active {
    display: flex;
    opacity: 1;
}

.edit-modal-content {
    background: var(--bg-card);
    border-radius: 16px;
    padding: 24px;
    width: 90%;
    max-width: 400px;
    box-shadow: var(--shadow-xl);
    transform: scale(0.9);
    transition: transform 0.3s ease;
}

.edit-modal.active .edit-modal-content {
    transform: scale(1);
}

.edit-modal-content h3 {
    margin: 0 0 16px 0;
    color: var(--text-primary);
    font-size: 1.25rem;
    font-weight: 600;
}

.edit-input {
    width: 100%;
    padding: 16px;
    font-size: 2rem;
    text-align: center;
    border: 2px solid var(--border-color);
    border-radius: 12px;
    background: var(--bg-card);
    color: var(--text-primary);
    margin-bottom: 16px;
    transition: all 0.2s ease;
}

.edit-input:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 4px var(--accent-light);
}

.edit-modal-actions {
    display: flex;
    gap: 12px;
}

.edit-btn-cancel,
.edit-btn-save {
    flex: 1;
    padding: 12px;
    font-size: 1rem;
    font-weight: 600;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
}

.edit-btn-cancel {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
}

.edit-btn-cancel:hover {
    background: var(--border-color);
}

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

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


/* Minimal Menu Overlay */
.menu-overlay-minimal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
    z-index: 2000;
    display: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.menu-overlay-minimal.active {
    display: flex;
    opacity: 1;
}

.menu-content-minimal {
    background: rgba(0, 0, 0, 0.95);
    border-right: 1px solid rgba(255, 255, 255, 0.1);
    width: 85%;
    max-width: 320px;
    height: 100%;
    padding: 2rem;
    overflow-y: auto;
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.5);
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    position: relative;
}

body.rtl .menu-content-minimal {
    transform: translateX(100%);
}

.menu-overlay-minimal.active .menu-content-minimal {
    transform: translateX(0);
}

.menu-close-btn {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 36px;
    height: 36px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    border-radius: 8px;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s ease;
}

.menu-close-btn:hover {
    background: var(--accent-light);
    color: var(--accent-color);
}

.menu-nav-minimal {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-top: 2rem;
}

.menu-item-minimal {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    border-radius: 10px;
    color: #ffffff;
    text-decoration: none;
    transition: all 0.2s ease;
    border: none;
    background: transparent;
    width: 100%;
    text-align: left;
    font-size: 1rem;
    cursor: pointer;
}

body.rtl .menu-item-minimal {
    text-align: right;
}

.menu-item-minimal:hover {
    background: rgba(34, 197, 94, 0.2);
    color: #22c55e;
}

.menu-item-minimal.active {
    background: #22c55e;
    color: #000000;
    font-weight: 600;
}

.menu-divider {
    height: 1px;
    background: rgba(255, 255, 255, 0.1);
    margin: 16px 0;
}

.theme-toggle-minimal {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* Mobile adjustments */
@media (max-width: 768px) {
    .counter-number-minimal {
        font-size: 5rem;
    }
    
    .top-controls-bar {
        padding: 10px 12px;
    }
    
    .top-btn {
        width: 40px;
        height: 40px;
    }
    
    .dropdown-toggle-btn {
        min-width: 70px;
        padding: 0 12px;
    }
}

@media (max-width: 480px) {
    .counter-number-minimal {
        font-size: 4rem;
    }
    
    .counter-hint {
        font-size: 0.75rem;
    }
    
    .top-controls-bar {
        padding: 8px 10px;
    }
    
    .top-btn {
        width: 36px;
        height: 36px;
    }
    
    .dropdown-toggle-btn {
        min-width: 60px;
        padding: 0 10px;
        font-size: 0.85rem;
    }
}
