/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
}

/* RTL Support for Persian/Farsi */
html[lang="fa"] {
    direction: rtl;
}

html[lang="fa"] body {
    font-family: 'Segoe UI', Tahoma, 'Vazirmatn', 'B Nazanin', sans-serif;
}

html[lang="fa"] .language-selector {
    /* Centered layout works for RTL too */
}

html[lang="fa"] .name-details {
    direction: rtl;
}

html[lang="fa"] .modal-close {
    right: auto;
    left: 20px;
}

.container {
    max-width: 800px;
    margin: 0 auto;
    position: relative;
}

/* Language Selector */
.language-selector {
    display: flex;
    gap: 5px;
    justify-content: center;
    margin-bottom: 15px;
    flex-wrap: wrap;
}

.lang-btn {
    width: 40px;
    height: 40px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    font-size: 0.75rem;
    font-weight: 700;
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lang-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.1);
}

.lang-btn.active {
    background: rgba(255, 255, 255, 0.3);
    border-color: white;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

/* Header */
header {
    text-align: center;
    padding: 30px 0;
    color: white;
}

header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
}

header p {
    font-size: 1.1rem;
    opacity: 0.9;
    margin-bottom: 15px;
}

/* Buy Me a Coffee button */
.coffee-link {
    display: inline-block;
    transition: transform 0.3s ease;
}

.coffee-link:hover {
    transform: scale(1.05);
}

.coffee-btn {
    height: 45px;
    width: auto;
    border-radius: 8px;
}

.book-btn {
    display: inline-block;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 12px 24px;
    border-radius: 30px;
    font-size: 1rem;
    font-weight: 600;
    text-decoration: none;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
    transition: all 0.3s ease;
}

.book-btn:hover {
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.6);
    transform: translateY(-2px);
}

header .book-btn {
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    border: 2px solid rgba(255, 255, 255, 0.3);
}

header .book-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
}

.header-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
}

/* Social Share Buttons */
.social-buttons {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-top: 20px;
}

.social-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    border: 2px solid rgba(255, 255, 255, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    text-decoration: none;
    transition: all 0.3s ease;
}

.social-btn svg {
    width: 20px;
    height: 20px;
}

.social-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

#shareWhatsApp:hover {
    background: #25D366;
    border-color: #25D366;
}

#shareFacebook:hover {
    background: #1877F2;
    border-color: #1877F2;
}

#shareTwitter:hover {
    background: #000;
    border-color: #000;
}

#shareTelegram:hover {
    background: #0088cc;
    border-color: #0088cc;
}

#copyLink:hover {
    background: #667eea;
    border-color: #667eea;
}

.about-btn {
    display: inline-block;
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    border: 2px solid rgba(255, 255, 255, 0.3);
    color: white;
    padding: 12px 24px;
    border-radius: 30px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.about-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
    transform: translateY(-2px);
}

/* Modal styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    padding: 20px;
}

.modal-overlay.hidden {
    display: none;
}

.modal-content {
    background: white;
    border-radius: 20px;
    padding: 30px;
    max-width: 500px;
    width: 100%;
    position: relative;
    animation: modalFadeIn 0.3s ease;
    text-align: center;
}

.modal-content h3 {
    color: #667eea;
    font-size: 1.5rem;
    margin-bottom: 20px;
}

.modal-content .story {
    color: #555;
    font-size: 1rem;
    line-height: 1.6;
    margin-bottom: 15px;
    text-align: left;
}

.modal-close {
    position: absolute;
    top: 15px;
    right: 20px;
    background: none;
    border: none;
    font-size: 2rem;
    color: #999;
    cursor: pointer;
    transition: color 0.3s ease;
}

.modal-close:hover {
    color: #333;
}

.modal-book-btn {
    margin-top: 10px;
}

@keyframes modalFadeIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.coffee-section {
    text-align: center;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #e0e0e0;
}

.coffee-section p {
    color: #666;
    margin-bottom: 8px;
    font-size: 1rem;
}

.about-me {
    background: linear-gradient(135deg, #f5f7fa 0%, #e8ecf1 100%);
    border-radius: 15px;
    padding: 25px;
    margin-bottom: 20px;
    text-align: left;
}

.about-me h3 {
    color: #667eea;
    font-size: 1.3rem;
    margin-bottom: 15px;
    text-align: center;
}

.about-me .story {
    color: #555;
    font-size: 1rem;
    line-height: 1.6;
    margin-bottom: 12px;
}

.about-me .story:last-child {
    margin-bottom: 0;
}

/* Main content */
main {
    background: white;
    border-radius: 20px;
    padding: 40px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

/* Questions */
.questionnaire {
    min-height: 300px;
}

.question {
    display: none;
    animation: fadeIn 0.5s ease;
}

.question.active {
    display: block;
}

.question.completed {
    display: none;
}

.question h2 {
    text-align: center;
    color: #333;
    margin-bottom: 30px;
    font-size: 1.5rem;
}

/* Options */
.options {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 15px;
    justify-content: center;
}

/* Letter options - special grid for alphabet */
.letter-options {
    grid-template-columns: repeat(auto-fit, minmax(60px, 1fr));
    gap: 10px;
}

.letter-btn {
    padding: 15px 10px;
    font-size: 1.2rem;
    font-weight: bold;
}

.letter-btn .icon {
    display: none;
}

.option-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 25px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 15px;
    background: white;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 1rem;
    color: #333;
}

.option-btn:hover {
    border-color: #667eea;
    transform: translateY(-3px);
    box-shadow: 0 5px 20px rgba(102, 126, 234, 0.3);
}

.option-btn.selected {
    border-color: #667eea;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    transform: scale(1.02);
}

.option-btn .icon {
    font-size: 2.5rem;
    margin-bottom: 10px;
}

/* Progress bar */
.progress-container {
    margin-top: 40px;
    text-align: center;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: #e0e0e0;
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 10px;
}

.progress {
    height: 100%;
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
    border-radius: 10px;
    transition: width 0.5s ease;
    width: 0%;
}

.progress-text {
    color: #666;
    font-size: 0.9rem;
}

/* Results */
.results {
    animation: fadeIn 0.5s ease;
}

.results h2 {
    text-align: center;
    color: #333;
    margin-bottom: 30px;
    font-size: 1.5rem;
}

.name-cards {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.name-card {
    background: linear-gradient(135deg, #f5f7fa 0%, #e4e8eb 100%);
    border-radius: 15px;
    padding: 25px;
    animation: slideIn 0.5s ease forwards;
    opacity: 0;
    transform: translateY(20px);
}

.name-header {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 10px;
}

.name-icon {
    font-size: 2rem;
}

.name-title {
    font-size: 1.8rem;
    color: #333;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.name-meaning {
    color: #666;
    font-style: italic;
    margin-bottom: 10px;
    font-size: 1rem;
}

.name-details {
    display: flex;
    gap: 20px;
    margin-bottom: 15px;
    color: #555;
    font-size: 0.9rem;
}

.name-details .detail {
    display: flex;
    gap: 5px;
}

.name-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.tag {
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 500;
}

.tag.origin {
    background: #e3f2fd;
    color: #1976d2;
}

.tag.style {
    background: #f3e5f5;
    color: #7b1fa2;
}

.tag.religious {
    background: #fff3e0;
    color: #f57c00;
}

.tag.meaning {
    background: #e8f5e9;
    color: #388e3c;
}

/* Result action buttons */
.result-actions {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    margin-top: 30px;
}

.btn-more {
    display: block;
    width: 100%;
    max-width: 350px;
    padding: 15px 30px;
    border: 2px solid #667eea;
    border-radius: 30px;
    background: white;
    color: #667eea;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-more:hover {
    background: #667eea;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(102, 126, 234, 0.3);
}

.btn-restart {
    display: block;
    width: 100%;
    max-width: 350px;
    padding: 15px 30px;
    border: none;
    border-radius: 30px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    font-size: 1.1rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-restart:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(102, 126, 234, 0.4);
}

/* No results */
.no-results {
    text-align: center;
    padding: 40px;
    color: #666;
}

.no-results p {
    margin-bottom: 10px;
}

/* Footer */
footer {
    text-align: center;
    padding: 20px 0;
    margin-top: 20px;
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.9rem;
}

footer p {
    margin: 0;
}

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

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Responsive */
@media (max-width: 600px) {
    body {
        padding: 10px;
    }

    header {
        padding: 20px 0;
    }

    header h1 {
        font-size: 1.6rem;
        margin-bottom: 8px;
    }

    header p {
        font-size: 0.95rem;
    }

    .language-selector {
        gap: 8px;
        margin-bottom: 12px;
    }

    .lang-btn {
        width: 36px;
        height: 36px;
        font-size: 0.7rem;
    }

    .header-buttons {
        gap: 10px;
    }

    .book-btn, .about-btn {
        padding: 10px 18px;
        font-size: 0.9rem;
    }

    .social-buttons {
        gap: 8px;
        margin-top: 15px;
    }

    .social-btn {
        width: 36px;
        height: 36px;
    }

    .social-btn svg {
        width: 18px;
        height: 18px;
    }

    main {
        padding: 25px;
        border-radius: 15px;
    }

    .question h2 {
        font-size: 1.2rem;
    }

    .options {
        grid-template-columns: repeat(2, 1fr);
    }

    .letter-options {
        grid-template-columns: repeat(5, 1fr);
    }

    .option-btn {
        padding: 20px 10px;
    }

    .option-btn .icon {
        font-size: 2rem;
    }

    .name-title {
        font-size: 1.4rem;
    }

    .name-details {
        flex-direction: column;
        gap: 5px;
    }
}

@media (max-width: 400px) {
    .options {
        grid-template-columns: 1fr;
    }

    .letter-options {
        grid-template-columns: repeat(4, 1fr);
    }

    .option-btn {
        flex-direction: row;
        justify-content: flex-start;
        gap: 15px;
    }

    .option-btn .icon {
        margin-bottom: 0;
    }

    .letter-btn {
        flex-direction: column;
        justify-content: center;
    }
}
