@font-face {
    font-family: 'IRANSansWeb';
    src: url('../fonts/IRANSansWeb.woff2') format('woff2'),
         url('../fonts/IRANSansWeb.woff') format('woff'),
         url('../fonts/IRANSansWeb.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

:root {
    --primary: #2C7BE5;
    --primary-dark: #1A4F8A;
    --primary-light: #E8F0FE;
    --primary-gradient: linear-gradient(135deg, #2C7BE5 0%, #1A4F8A 100%);
    --bg-body: #F5F7FA;
    --bg-card: #FFFFFF;
    --text-primary: #1A2332;
    --text-secondary: #64748B;
    --text-light: #94A3B8;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.06);
    --shadow-md: 0 4px 20px rgba(44, 123, 229, 0.15);
    --shadow-lg: 0 10px 40px rgba(44, 123, 229, 0.20);
    --radius: 16px;
    --radius-sm: 10px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --font: 'IRANSansWeb', tahoma, sans-serif;
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    overflow-x: hidden;
}

body {
    font-family: var(--font);
    background: var(--bg-body);
    color: var(--text-primary);
    line-height: 1.7;
    direction: rtl;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    width: 100%;
}

.app-wrapper {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    width: 100%;
    overflow-x: hidden;
}

.header {
    background: var(--primary-gradient);
    color: #fff;
    padding: 0 16px;
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 2px 20px rgba(44, 123, 229, 0.3);
    width: 100%;
}

.header-container {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 70px;
    width: 100%;
}

.header-logo {
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

.logo-img {
    height: 40px;
    width: auto;
    display: block;
}

.nav-toggle {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    border-radius: 8px;
    transition: var(--transition);
    flex-shrink: 0;
}

.nav-toggle:hover {
    background: rgba(255,255,255,0.15);
}

.nav-toggle-icon {
    display: block;
    width: 25px;
    height: 3px;
    background: #fff;
    border-radius: 3px;
    transition: var(--transition);
}

.nav-toggle.active .nav-toggle-icon:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

.nav-toggle.active .nav-toggle-icon:nth-child(2) {
    opacity: 0;
}

.nav-toggle.active .nav-toggle-icon:nth-child(3) {
    transform: rotate(-45deg) translate(5px, -5px);
}

.nav-menu {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.nav-link {
    color: rgba(255,255,255,0.85);
    text-decoration: none;
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    transition: var(--transition);
    position: relative;
    white-space: nowrap;
}

.nav-link:hover {
    color: #fff;
    background: rgba(255,255,255,0.15);
}

.nav-link.active {
    color: #fff;
    background: rgba(255,255,255,0.25);
}

.nav-link.active::after {
    content: '';
    position: absolute;
    bottom: 2px;
    left: 50%;
    transform: translateX(-50%);
    width: 20px;
    height: 3px;
    background: #fff;
    border-radius: 3px;
}

.main-content {
    flex: 1;
    padding: 30px 16px 40px;
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
    padding: 0 4px;
}

.metronome-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    margin-bottom: 40px;
    width: 100%;
}

.metronome-col {
    display: flex;
    flex-direction: column;
    gap: 24px;
    min-width: 0;
}

.metronome-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    overflow: hidden;
    transition: var(--transition);
    border: 1px solid rgba(44, 123, 229, 0.08);
    width: 100%;
}

.metronome-card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}

.card-header {
    padding: 16px 24px;
    background: var(--primary-light);
    border-bottom: 2px solid var(--primary);
}

.card-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--primary-dark);
    margin: 0;
    letter-spacing: 0.5px;
}

.card-body {
    padding: 24px;
}

.card-body.text-center {
    text-align: center;
}

.bpm-display,
.meter-display {
    margin-bottom: 16px;
}

.bpm-number {
    font-size: 72px;
    font-weight: 700;
    color: var(--primary);
    line-height: 1;
    display: inline-block;
    transition: var(--transition);
    font-family: 'IRANSansWeb', tahoma;
}

.bpm-number.pulse {
    animation: bpmPulse 0.5s ease-in-out;
}

@keyframes bpmPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.08); color: var(--primary-dark); }
}

.bpm-unit,
.meter-unit {
    font-size: 20px;
    font-weight: 400;
    color: var(--text-secondary);
    margin-right: 4px;
}

.meter-number {
    font-size: 56px;
    font-weight: 700;
    color: var(--primary);
    line-height: 1;
}

.slider-wrapper {
    padding: 8px 0;
}

.metronome-slider {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 6px;
    border-radius: 10px;
    background: var(--primary-light);
    outline: none;
    transition: var(--transition);
    cursor: pointer;
}

.metronome-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--primary-gradient);
    cursor: pointer;
    box-shadow: 0 2px 10px rgba(44, 123, 229, 0.4);
    transition: var(--transition);
}

.metronome-slider::-webkit-slider-thumb:hover {
    transform: scale(1.15);
    box-shadow: 0 4px 20px rgba(44, 123, 229, 0.5);
}

.metronome-slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--primary-gradient);
    cursor: pointer;
    border: none;
}

.metronome-slider.volume-slider {
    background: #E2E8F0;
    direction: rtl;
}

.metronome-slider.volume-slider::-webkit-slider-thumb {
    background: var(--primary-gradient);
}

.slider-labels {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: var(--text-light);
    margin-top: 4px;
    padding: 0 4px;
}

.play-control {
    margin-top: 20px;
    display: flex;
    justify-content: center;
}

.play-btn {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    border: none;
    background: var(--primary-gradient);
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    box-shadow: 0 4px 25px rgba(44, 123, 229, 0.4);
    position: relative;
}

.play-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 35px rgba(44, 123, 229, 0.5);
}

.play-btn:active {
    transform: scale(0.95);
}

.play-btn .play-icon {
    width: 36px;
    height: 36px;
    transition: var(--transition);
}

.play-btn.playing::before {
    content: '';
    position: absolute;
    inset: -6px;
    border-radius: 50%;
    border: 3px solid var(--primary);
    animation: playPulse 1.5s ease-out infinite;
}

@keyframes playPulse {
    0% {
        transform: scale(0.9);
        opacity: 0.8;
    }
    100% {
        transform: scale(1.4);
        opacity: 0;
    }
}

.volume-group {
    margin-bottom: 14px;
    width: 100%;
}

.volume-group:last-child {
    margin-bottom: 0;
}

.volume-label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 6px;
}

.volume-info {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--primary-light);
    color: var(--primary);
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
    position: relative;
    border: none;
    font-family: var(--font);
}

.volume-info:hover {
    background: var(--primary);
    color: #fff;
    transform: scale(1.1);
}

.volume-info:active {
    transform: scale(0.9);
}

.content-section {
    text-align: right;
    direction: rtl;
    color: var(--text-primary);
    line-height: 1.8;
    margin: 40px auto 20px;
    max-width: 900px;
    padding: 30px 40px;
    background: var(--bg-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    border: 1px solid rgba(44, 123, 229, 0.06);
    width: 100%;
    overflow-wrap: break-word;
    word-wrap: break-word;
}

.content-section h1 {
    font-size: 2em;
    margin-bottom: 20px;
    font-weight: 700;
    color: var(--primary-dark);
    border-bottom: 3px solid var(--primary-light);
    padding-bottom: 12px;
}

.content-section h2 {
    font-size: 1.5em;
    margin-top: 30px;
    margin-bottom: 12px;
    font-weight: 600;
    color: var(--primary);
}

.content-section h3 {
    font-size: 1.3em;
    margin-top: 25px;
    margin-bottom: 10px;
    font-weight: 600;
    color: var(--text-primary);
}

.content-section h4 {
    font-size: 1.1em;
    margin-top: 20px;
    margin-bottom: 8px;
    font-weight: 600;
}

.content-section h5 {
    font-size: 1em;
    margin-top: 15px;
    margin-bottom: 6px;
    font-weight: 600;
}

.content-section h6 {
    font-size: 0.9em;
    margin-top: 10px;
    margin-bottom: 4px;
    font-weight: 600;
}

.content-section p {
    margin-bottom: 16px;
    color: var(--text-secondary);
    text-align: justify;
}

.content-section ul {
    padding-right: 24px;
    list-style-type: disc;
    margin-bottom: 16px;
}

.content-section ul li {
    margin-bottom: 6px;
    color: var(--text-secondary);
}

.content-section a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
    transition: var(--transition);
    word-break: break-word;
}

.content-section a:hover {
    color: var(--primary-dark);
    text-decoration: underline;
}

.faq-item {
    border: 1px solid #E2E8F0;
    border-radius: var(--radius-sm);
    margin-bottom: 10px;
    overflow: hidden;
    transition: var(--transition);
}

.faq-item:hover {
    border-color: var(--primary);
}

.faq-question {
    padding: 14px 20px;
    background: var(--bg-body);
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 500;
    color: var(--text-primary);
    transition: var(--transition);
}

.faq-question:hover {
    background: var(--primary-light);
}

.faq-arrow {
    font-size: 14px;
    transition: var(--transition);
    color: var(--primary);
}

.faq-answer {
    padding: 16px 20px;
    display: none;
    background: #fff;
    color: var(--text-secondary);
    border-top: 1px solid #E2E8F0;
}

.footer {
    background: var(--primary-dark);
    color: rgba(255,255,255,0.85);
    text-align: center;
    padding: 24px 20px;
    margin-top: auto;
    font-size: 14px;
    width: 100%;
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
}

.footer p {
    margin: 0;
}

.visuallyhidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

.text-center {
    text-align: center;
}

@media (max-width: 1200px) {
    .container {
        padding: 0 8px;
    }
}

@media (max-width: 992px) {
    .metronome-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .metronome-col {
        gap: 20px;
    }
}

@media (max-width: 768px) {
    .header {
        padding: 0 12px;
    }
    
    .header-container {
        height: 60px;
    }
    
    .nav-toggle {
        display: flex;
        order: 0;
    }
    
    .header-logo {
        order: 1;
        flex: 1;
        display: flex;
        justify-content: center;
    }
    
    .logo-img {
        height: 32px;
    }
    
    .nav-menu {
        display: none;
        position: absolute;
        top: 60px;
        left: 0;
        right: 0;
        background: var(--primary-dark);
        flex-direction: column;
        padding: 16px 20px;
        gap: 4px;
        box-shadow: 0 10px 30px rgba(0,0,0,0.2);
        border-top: 1px solid rgba(255,255,255,0.1);
        width: 100%;
    }
    
    .nav-menu.open {
        display: flex;
    }
    
    .nav-link {
        padding: 12px 16px;
        width: 100%;
        border-radius: 8px;
        font-size: 15px;
        white-space: normal;
    }
    
    .nav-link.active::after {
        display: none;
    }
    
    .bpm-number {
        font-size: 52px;
    }
    
    .meter-number {
        font-size: 42px;
    }
    
    .play-btn {
        width: 70px;
        height: 70px;
    }
    
    .play-btn .play-icon {
        width: 30px;
        height: 30px;
    }
    
    .content-section {
        padding: 20px 16px;
        margin: 20px 0;
        width: 100%;
    }
    
    .content-section h1 {
        font-size: 1.6em;
    }
    
    .content-section h2 {
        font-size: 1.3em;
    }
    
    .card-body {
        padding: 18px 16px;
    }
    
    .card-header {
        padding: 12px 16px;
    }
    
    .main-content {
        padding: 20px 8px 30px;
    }
}

@media (max-width: 480px) {
    .bpm-number {
        font-size: 42px;
    }
    
    .meter-number {
        font-size: 36px;
    }
    
    .play-btn {
        width: 60px;
        height: 60px;
    }
    
    .play-btn .play-icon {
        width: 26px;
        height: 26px;
    }
    
    .volume-label {
        font-size: 13px;
    }
    
    .content-section {
        padding: 14px 12px;
    }
    
    .faq-question {
        font-size: 14px;
        padding: 12px 14px;
    }
    
    .faq-answer {
        padding: 12px 14px;
    }
    
    .header-container {
        height: 54px;
    }
    
    .logo-img {
        height: 28px;
    }
}

@media (min-width: 769px) and (max-width: 1024px) {
    .bpm-number {
        font-size: 60px;
    }
    
    .meter-number {
        font-size: 48px;
    }
    
    .content-section {
        padding: 24px 28px;
    }
}

@media (min-width: 1025px) and (max-width: 1440px) {
    .container {
        padding: 0 16px;
    }
}

@media (min-width: 1441px) {
    .container {
        padding: 0 24px;
    }
    
    .bpm-number {
        font-size: 84px;
    }
    
    .meter-number {
        font-size: 64px;
    }
}