/**
 * Tesbeh Zikr Counter Styles
 * Modern, minimal, mobile-first design
 */

/* CSS Variables for theming */
:root {
    --tesbeh-primary: #667eea;
    --tesbeh-primary-dark: #5568d3;
    --tesbeh-secondary: #764ba2;
    --tesbeh-success: #48bb78;
    --tesbeh-bg: #ffffff;
    --tesbeh-surface: #f7fafc;
    --tesbeh-text: #2d3748;
    --tesbeh-text-secondary: #718096;
    --tesbeh-border: #e2e8f0;
    --tesbeh-shadow: rgba(0, 0, 0, 0.1);
    --tesbeh-radius: 16px;
}

[data-theme="dark"] {
    --tesbeh-primary: #818cf8;
    --tesbeh-primary-dark: #6366f1;
    --tesbeh-secondary: #a78bfa;
    --tesbeh-success: #34d399;
    --tesbeh-bg: #1a202c;
    --tesbeh-surface: #2d3748;
    --tesbeh-text: #f7fafc;
    --tesbeh-text-secondary: #cbd5e0;
    --tesbeh-border: #4a5568;
    --tesbeh-shadow: rgba(0, 0, 0, 0.3);
}

/* Wrapper */
.tesbeh-zikr-wrapper {
    width: 100%;
    max-width: 500px;
    margin: 0 auto;
    padding: 20px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    transition: background-color 0.3s ease;
}

.tesbeh-zikr-wrapper:fullscreen {
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--tesbeh-bg);
    padding: 40px;
}

/* Container */
.tesbeh-container {
    background: var(--tesbeh-bg);
    border-radius: var(--tesbeh-radius);
    padding: 30px;
    box-shadow: 0 10px 40px var(--tesbeh-shadow);
    transition: all 0.3s ease;
}

/* Header */
.tesbeh-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
}

.tesbeh-title {
    color: var(--tesbeh-text);
    font-size: 24px;
    font-weight: 700;
    margin: 0;
}

.tesbeh-controls-top {
    display: flex;
    gap: 10px;
}

/* Progress Ring */
.tesbeh-progress-ring {
    position: relative;
    width: min(280px, 100%);
    aspect-ratio: 1 / 1;
    margin: 0 auto 30px;
}

.tesbeh-progress-ring svg {
    width: 100%;
    height: 100%;
    display: block;
    transform: rotate(-90deg);
}

.tesbeh-progress-bg {
    fill: none;
    stroke: var(--tesbeh-border);
    stroke-width: 12;
}

.tesbeh-progress-bar {
    fill: none;
    stroke: url(#tesbeh-gradient);
    stroke-width: 12;
    stroke-linecap: round;
    transition: stroke-dashoffset 0.5s ease;
}

.tesbeh-counter-display {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) translateX(-10px);
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.tesbeh-count {
    font-size: 72px;
    font-weight: 800;
    color: var(--tesbeh-text);
    line-height: 1;
    background: linear-gradient(135deg, var(--tesbeh-primary), var(--tesbeh-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Target Selector */
.tesbeh-target-selector {
    display: flex;
    gap: 12px;
    justify-content: center;
    margin-bottom: 30px;
}

.tesbeh-target-btn {
    padding: 12px 24px;
    background: var(--tesbeh-surface);
    border: 2px solid var(--tesbeh-border);
    border-radius: 12px;
    color: var(--tesbeh-text);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.tesbeh-target-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px var(--tesbeh-shadow);
}

.tesbeh-target-btn.active {
    background: linear-gradient(135deg, var(--tesbeh-primary), var(--tesbeh-secondary));
    color: white;
    border-color: transparent;
}

/* Main Counter Button */
.tesbeh-count-btn {
    position: relative;
    width: 160px;
    height: 160px;
    margin: 0 auto 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--tesbeh-primary), var(--tesbeh-secondary));
    border: none;
    border-radius: 50%;
    cursor: pointer;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(102, 126, 234, 0.4);
    transition: all 0.2s ease;
}

.tesbeh-count-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 15px 40px rgba(102, 126, 234, 0.5);
}

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

.tesbeh-count-btn-text {
    font-size: 64px;
    color: white;
    font-weight: 700;
    z-index: 1;
}

/* Ripple Effect */
.tesbeh-ripple {
    position: absolute;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    transform: scale(0);
    animation: ripple 0.6s ease-out;
}

@keyframes ripple {
    to {
        transform: scale(2);
        opacity: 0;
    }
}

/* Action Buttons */
.tesbeh-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
    margin-bottom: 30px;
}

.tesbeh-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    border: none;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.tesbeh-btn-secondary {
    background: var(--tesbeh-surface);
    color: var(--tesbeh-text);
    border: 2px solid var(--tesbeh-border);
}

.tesbeh-btn-secondary:hover {
    background: var(--tesbeh-border);
    transform: translateY(-2px);
}

.tesbeh-btn-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--tesbeh-surface);
    border: 2px solid var(--tesbeh-border);
    border-radius: 10px;
    cursor: pointer;
    color: var(--tesbeh-text);
    transition: all 0.2s ease;
}

.tesbeh-btn-icon:hover {
    background: var(--tesbeh-border);
    transform: translateY(-2px);
}

/* Sound Toggle Icons */
#tesbeh-sound-toggle .tesbeh-sound-off {
    display: none;
}

#tesbeh-sound-toggle.active .tesbeh-sound-on {
    display: none;
}

#tesbeh-sound-toggle.active .tesbeh-sound-off {
    display: inline;
}

/* Theme Toggle Icons */
[data-theme="light"] .tesbeh-icon-moon {
    display: none;
}

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

/* Stats */
.tesbeh-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    padding: 20px;
    background: var(--tesbeh-surface);
    border-radius: 12px;
}

.tesbeh-stat-item {
    text-align: center;
}

.tesbeh-stat-label {
    display: block;
    font-size: 13px;
    color: var(--tesbeh-text-secondary);
    margin-bottom: 4px;
}

.tesbeh-stat-value {
    display: block;
    font-size: 24px;
    font-weight: 700;
    color: var(--tesbeh-primary);
}

/* Celebration Animation */
@keyframes celebrate {

    0%,
    100% {
        transform: scale(1) rotate(0deg);
    }

    25% {
        transform: scale(1.05) rotate(-2deg);
    }

    75% {
        transform: scale(1.05) rotate(2deg);
    }
}

.tesbeh-celebrate {
    animation: celebrate 0.5s ease-in-out 2;
}

.tesbeh-toast {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, var(--tesbeh-primary), var(--tesbeh-secondary));
    color: #fff;
    padding: 16px 20px;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    font-weight: 600;
    letter-spacing: 0.2px;
    z-index: 9999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease, transform 0.25s ease;
}

.tesbeh-toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* Modal */
.tesbeh-modal-backdrop {
    position: fixed;
    inset: 0;
    background: radial-gradient(circle at 20% 20%, rgba(102, 126, 234, 0.35), transparent 35%),
                radial-gradient(circle at 80% 80%, rgba(118, 75, 162, 0.35), transparent 35%),
                rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 999999;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.tesbeh-modal-backdrop.show {
    opacity: 1;
}

.tesbeh-modal {
    background: radial-gradient(120% 140% at 10% 20%, rgba(102, 126, 234, 0.35), rgba(15, 23, 42, 0.95)),
                radial-gradient(120% 140% at 90% 80%, rgba(118, 75, 162, 0.35), rgba(15, 23, 42, 0.95));
    color: #e2e8f0;
    border-radius: 18px;
    padding: 26px 24px;
    width: min(420px, 92vw);
    box-shadow: 0 20px 70px rgba(0, 0, 0, 0.45);
    border: 1px solid rgba(255, 255, 255, 0.08);
    transform: translateY(10px);
    transition: transform 0.25s ease;
}

.tesbeh-modal-backdrop.show .tesbeh-modal {
    transform: translateY(0);
}

.tesbeh-modal h3 {
    margin: 0 0 8px;
    font-size: 18px;
    color: #fff;
    letter-spacing: 0.2px;
}

.tesbeh-modal p {
    margin: 0 0 16px;
    line-height: 1.55;
    color: #d9e3f0;
    font-size: 16px;
}

.tesbeh-modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.tesbeh-btn-modal {
    padding: 10px 16px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s ease;
    min-width: 120px;
    height: 42px;
}

.tesbeh-btn-modal.primary {
    background: linear-gradient(135deg, var(--tesbeh-primary), var(--tesbeh-secondary));
    color: #fff;
    border: none;
    box-shadow: 0 10px 30px rgba(102, 126, 234, 0.4);
}

.tesbeh-btn-modal.secondary {
    background: rgba(255, 255, 255, 0.08);
    color: #e2e8f0;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}

.tesbeh-btn-modal:hover {
    transform: translateY(-1px);
}

@media (max-width: 600px) {
    .tesbeh-modal {
        padding: 20px 18px;
        width: 92vw;
    }

    .tesbeh-modal h3 {
        font-size: 17px;
    }

    .tesbeh-modal p {
        font-size: 15px;
        margin-bottom: 14px;
    }

    .tesbeh-btn-modal {
        min-width: 105px;
        height: 40px;
        font-size: 14px;
    }

    .tesbeh-modal-actions {
        gap: 8px;
    }
}

/* Gradient Definition */
svg defs {
    position: absolute;
}

/* Responsive */
@media (max-width: 600px) {
    .tesbeh-zikr-wrapper {
        padding: 10px;
    }

    .tesbeh-container {
        padding: 20px;
    }

    .tesbeh-progress-ring {
        width: 240px;
        height: 240px;
    }

    .tesbeh-count {
        font-size: 56px;
    }

    .tesbeh-count-btn {
        width: 140px;
        height: 140px;
    }

    .tesbeh-count-btn-text {
        font-size: 56px;
    }

    .tesbeh-target-btn {
        padding: 10px 20px;
        font-size: 14px;
    }
}

/* SVG Gradient */
.tesbeh-progress-ring svg defs {
    display: none;
}

.tesbeh-progress-ring::before {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
}

/* Add gradient to SVG */
svg {
    overflow: visible;
}

.tesbeh-progress-bar {
    stroke: var(--tesbeh-primary);
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
    * {
        animation: none !important;
        transition: none !important;
    }
}

/* Print */
@media print {
    .tesbeh-zikr-wrapper {
        display: none;
    }
}
