/* ===============================================
   Payment App Styles - RTL Support
   =============================================== */

/* ===== CSS Variables ===== */
:root {
    --primary-color: #4A90E2;
    --primary-dark: #357ABD;
    --secondary-color: #FFD700;
    --success-color: #4CAF50;
    --error-color: #F44336;
    --warning-color: #FF9800;
    --info-color: #2196F3;
    
    --bg-primary: #F5F7FA;
    --bg-secondary: #FFFFFF;
    --bg-overlay: rgba(0, 0, 0, 0.5);
    
    --text-primary: #1A1A1A;
    --text-secondary: #666666;
    --text-muted: #999999;
    
    --border-radius-sm: 8px;
    --border-radius-md: 12px;
    --border-radius-lg: 16px;
    --border-radius-xl: 20px;
    
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.08);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.12);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.15);
    
    --transition-fast: 0.2s ease;
    --transition-normal: 0.3s ease;
    --transition-slow: 0.5s ease;
    
    --gold-gradient: linear-gradient(135deg, #FFD700 0%, #FFA500 100%);
    --diamond-gradient: linear-gradient(135deg, #00D4FF 0%, #0099CC 100%);
}

/* ===== Reset & Base ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Vazir', 'Inter', 'Soleil', -apple-system, BlinkMacSystemFont, sans-serif;
    background: linear-gradient(135deg, #5BA0FB 0%, #2A70E9 50%, #215FDA 100%);
    color: var(--text-primary);
    direction: rtl;
    text-align: right;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
    position: relative;
}

/* ===== Background Patterns ===== */
.bg-pattern {
    position: fixed;
    pointer-events: none;
    z-index: 0;
    transition: opacity 0.5s ease;
}

.bg-pattern img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* English text uses Soleil/Inter */
:lang(en) {
    font-family: 'Inter', 'Soleil', -apple-system, BlinkMacSystemFont, sans-serif;
}

/* Farsi text uses Vazir */
:lang(fa), :lang(ar) {
    font-family: 'Vazir', sans-serif;
}

/* ===== Main Container ===== */
.container {
    max-width: 600px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
    position: relative;
    z-index: 1;
}

/* ===== Sections ===== */
.section {
    display: none;
    animation: fadeIn 0.3s ease;
}

.section.active {
    display: block;
}

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

/* ===== Mascot ===== */
.mascot-container {
    display: flex;
    justify-content: center;
    margin: 20px 0;
}

/* ===== Hero Text ===== */
.hero-text {
    text-align: center;
    font-size: 20px;
    font-weight: 700;
    color: white;
    margin-bottom: 24px;
}

/* ===== Duration Toggle ===== */
.duration-toggle {
    display: flex;
    gap: 12px;
    margin-bottom: 24px;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    padding: 6px;
    border-radius: var(--border-radius-xl);
}

.toggle-btn {
    flex: 1;
    padding: 12px 24px;
    border: none;
    border-radius: var(--border-radius-lg);
    background: transparent;
    color: white;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.toggle-btn.active {
    background: white;
    color: var(--primary-color);
    box-shadow: var(--shadow-sm);
}

.toggle-btn:hover:not(.active) {
    background: rgba(255, 255, 255, 0.5);
}

/* ===== Plans Grid ===== */
.plans-grid {
    display: flex;
    flex-wrap: nowrap;
    gap: 32px;
    margin-bottom: 40px;
    justify-content: space-between;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    padding: 24px;
    border-radius: var(--border-radius-xl);
}

.plan-card-container {
    width: 50%;
    display: flex;
    flex-direction: column;
}

.plan-card {
    border-radius: var(--border-radius-lg);
    padding: 24px;
    padding-top: 15%;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    justify-content: center;
    align-items: center;
    transition: transform var(--transition-fast), box-shadow var(--transition-fast);
    box-shadow: var(--shadow-md);
    color: white;
    width: 95%;
    aspect-ratio: 15 / 16;
    flex-shrink: 0;
}

.plan-card-bg-animation {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
}

.plan-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-lg);
}

.plan-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.2) 0%, rgba(255, 255, 255, 0) 100%);
    opacity: 0;
    transition: opacity var(--transition-fast);
}

.plan-card:hover::before {
    opacity: 1;
}

.discount-badge {
    position: absolute;
    top: -24px;
    left: -24px;
    background: #E53935;
    color: white;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    z-index: 2;
}

.plan-header {
    position: relative;
    justify-content: space-between;
    align-items: center;
    z-index: 1;
    margin-bottom: 16px;
}

.plan-name {
    font-size: 20px;
    text-align: center;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.plan-duration {
    font-size: 16px;
    text-align: center;
    opacity: 0.9;
}

.plan-coins {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    position: relative;
    z-index: 1;
}

.coins-number {
    font-size: 16px;
}

.coins-icon {
    width: 20px;
    height: 20px;
    object-fit: contain;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
}

.plan-pricing {
    text-align: center;
    margin-bottom: 8px;
    position: relative;
    z-index: 1;
}

.original-price {
    text-decoration: line-through;
    opacity: 0.7;
    font-size: 14px;
    display: block;
    margin-bottom: 4px;
}

.current-price {
    font-size: 18px;
    font-weight: 700;
}

.plan-features {
    list-style: none;
    padding: 0;
    padding-right: 8px;
    position: relative;
    z-index: 1;
}

.feature-item {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    font-size: 14px;
    opacity: 0.95;
    color: white;
}

.feature-icon {
    flex-shrink: 0;
}

/* ===== Section Divider ===== */
.section-divider {
    margin: 40px 0 24px;
}

.section-title {
    font-size: 20px;
    font-weight: 700;
    color: white;
    text-align: center;
}

/* ===== IAP Grid ===== */
.iap-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 16px;
    margin-bottom: 30px;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    padding: 24px;
    border-radius: var(--border-radius-xl);
}

.iap-card {
    background: var(--bg-secondary);
    border-radius: var(--border-radius-lg);
    padding: 20px;
    text-align: center;
    cursor: pointer;
    transition: all var(--transition-fast);
    box-shadow: var(--shadow-sm);
    border: 2px solid transparent;
}

.iap-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
    border-color: var(--primary-color);
}

.iap-icon-container {
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 12px;
}

.iap-icon-img {
    width: 56px;
    height: 56px;
    object-fit: contain;
    filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.15));
}

.iap-name {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.iap-coins {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.iap-price {
    font-size: 16px;
    font-weight: 700;
    color: var(--primary-color);
}

/* ===== Tutorial Button ===== */
.tutorial-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 16px;
    background: var(--primary-color);
    border: 2px dashed var(--bg-secondary);
    border-radius: var(--border-radius-lg);
    color: var(--bg-secondary);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.tutorial-btn:hover {
    background: var(--bg-secondary);
    color: var(--primary-color);
    border-style: solid;
}

/* ===== Form Container ===== */
.form-container {
    background: var(--bg-secondary);
    border-radius: var(--border-radius-xl);
    padding: 32px;
    box-shadow: var(--shadow-md);
    position: relative;
}

.back-btn {
    position: absolute;
    top: 16px;
    left: 16px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--bg-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--transition-fast);
    color: var(--text-secondary);
}

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

.section-heading {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 12px;
    text-align: center;
}

.section-description {
    font-size: 14px;
    color: var(--text-secondary);
    text-align: center;
    margin-bottom: 32px;
}

/* ===== How-to Guide ===== */
.how-to-guide {
    background: var(--bg-secondary);
    border-radius: var(--border-radius-md);
    padding: 16px;
    margin-bottom: 24px;
    box-shadow: var(--shadow-sm);
    text-align: center;
}

.how-to-thumbnail-container {
    position: relative;
    width: 150px;
    height: 150px;
    margin: 0 auto 12px;
    cursor: pointer;
    border-radius: var(--border-radius-md);
    overflow: hidden;
    transition: transform var(--transition-normal), box-shadow var(--transition-normal);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.how-to-thumbnail-container:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.how-to-thumbnail {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.thumbnail-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity var(--transition-normal);
}

.how-to-thumbnail-container:hover .thumbnail-overlay {
    opacity: 1;
}

.how-to-caption {
    font-size: 13px;
    color: var(--text-secondary);
    margin: 0;
    line-height: 1.5;
}

/* ===== Input Group ===== */
.input-group {
    margin-bottom: 24px;
}

.input-group label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.input-group input {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid #E0E0E0;
    border-radius: var(--border-radius-md);
    font-size: 16px;
    transition: all var(--transition-fast);
    background: var(--bg-primary);
}

.input-group input:focus {
    outline: none;
    border-color: var(--primary-color);
    background: white;
}

.input-error {
    display: none;
    color: var(--error-color);
    font-size: 13px;
    margin-top: 8px;
}

.input-hint {
    display: block;
    color: var(--text-secondary);
    font-size: 12px;
    margin-top: 6px;
    opacity: 0.7;
}

/* ===== Primary Button ===== */
.primary-btn {
    width: 100%;
    padding: 16px;
    background: var(--primary-color);
    border: none;
    border-radius: var(--border-radius-lg);
    color: white;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: all var(--transition-fast);
    position: relative;
    overflow: hidden;
}

.primary-btn:hover:not(:disabled) {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.primary-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.primary-btn.loading {
    pointer-events: none;
}

.btn-text {
    transition: opacity var(--transition-fast);
}

.btn-loader {
    display: none;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 24px;
    height: 24px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: translate(-50%, -50%) rotate(360deg); }
}

.primary-btn.success {
    background: var(--success-color);
}

.primary-btn.error {
    background: var(--error-color);
}

/* ===== User Info Card ===== */
.user-info-card {
    background: var(--bg-primary);
    border-radius: var(--border-radius-md);
    padding: 20px;
    margin-bottom: 24px;
}

.user-info-row {
    display: flex;
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px solid #E0E0E0;
}

.user-info-row:last-child {
    border-bottom: none;
}

.info-label {
    color: var(--text-secondary);
    font-size: 14px;
}

.info-value {
    color: var(--text-primary);
    font-weight: 600;
    font-size: 14px;
}

/* ===== Selected Plan Card ===== */
.selected-plan-card {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    border-radius: var(--border-radius-md);
    padding: 20px;
    margin-bottom: 24px;
    color: white;
}

.selected-plan-title {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 16px;
    opacity: 0.9;
}

.confirm-plan-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    font-size: 14px;
}

.confirm-plan-row.highlight {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.3);
    font-size: 18px;
    font-weight: 700;
}

/* ===== Status Container ===== */
.status-container {
    text-align: center;
    padding: 60px 20px;
}

.spinner {
    width: 60px;
    height: 60px;
    border: 4px solid var(--bg-primary);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 24px;
}

.status-heading {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 12px;
}

.status-description {
    font-size: 16px;
    color: var(--text-secondary);
    margin-bottom: 32px;
}

.success-icon,
.error-icon,
.warning-icon {
    margin: 0 auto 24px;
}

/* ===== Instructions Card ===== */
.instructions-card {
    background: var(--bg-primary);
    border-radius: var(--border-radius-md);
    padding: 24px;
    margin: 32px 0;
    text-align: right;
}

.instructions-card h3 {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 16px;
    color: var(--text-primary);
}

.instructions-card ol {
    padding-right: 20px;
}

.instructions-card li {
    font-size: 16px;
    color: var(--text-secondary);
    margin-bottom: 12px;
    line-height: 1.6;
}

/* ===== Modal ===== */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-overlay);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-content {
    background: var(--bg-secondary);
    border-radius: var(--border-radius-xl);
    max-width: 500px;
    width: 100%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    animation: slideUp 0.3s ease;
}

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

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px;
    border-bottom: 1px solid #E0E0E0;
}

.modal-header h2 {
    font-size: 20px;
    font-weight: 700;
}

.modal-close {
    width: 36px;
    height: 36px;
    border: none;
    background: var(--bg-primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--transition-fast);
    color: var(--text-secondary);
}

.modal-close:hover {
    background: var(--error-color);
    color: white;
}

.modal-body {
    padding: 24px;
}

/* ===== Tutorial Steps ===== */
.tutorial-step {
    display: flex;
    gap: 16px;
    margin-bottom: 24px;
    padding-bottom: 24px;
    border-bottom: 1px solid #E0E0E0;
}

.tutorial-step:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.step-number {
    width: 48px;
    height: 48px;
    background: var(--primary-color);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    font-weight: 700;
    flex-shrink: 0;
}

.step-content h4 {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.step-content p {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.6;
}

/* ===== Image Viewer Modal ===== */
.image-modal {
    background: rgba(0, 0, 0, 0.9);
}

.image-modal-content {
    position: relative;
    max-width: 90%;
    max-height: 90vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.image-modal-close {
    position: absolute;
    top: -50px;
    right: 0;
    width: 40px;
    height: 40px;
    border: none;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--transition-fast);
    color: var(--text-primary);
    z-index: 1001;
}

.image-modal-close:hover {
    background: white;
    transform: scale(1.1);
}

.viewer-image {
    max-width: 100%;
    max-height: 90vh;
    width: auto;
    height: auto;
    border-radius: var(--border-radius-md);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

/* ===== Toast ===== */
.toast {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--text-primary);
    color: white;
    padding: 16px 24px;
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-lg);
    font-size: 14px;
    font-weight: 600;
    z-index: 1001;
    opacity: 0;
    transition: all var(--transition-normal);
    max-width: 90%;
    text-align: center;
}

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

.toast.success {
    background: var(--success-color);
}

.toast.error {
    background: var(--error-color);
}

.toast.warning {
    background: var(--warning-color);
}

.toast.info {
    background: var(--info-color);
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
    .plan-card-container {
        width: 50%;
    }
    
    .plan-card {
        width: 100%;
    }
}

@media (max-width: 600px) {
    .plan-card-container {
        width: 50%;
    }
    
    .plan-card {
        width: 100%;
    }
    
    .form-container {
        padding: 24px;
    }
    
    .section-heading {
        font-size: 20px;
    }
    
    .hero-text {
        font-size: 18px;
    }
}

@media (max-width: 400px) {
    .iap-grid {
        grid-template-columns: 1fr;
    }
    
    .duration-toggle {
        flex-direction: column;
    }
}

/* ===== Utility Classes ===== */
.text-center {
    text-align: center;
}

.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mt-4 { margin-top: 32px; }

.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.mb-4 { margin-bottom: 32px; }

.p-1 { padding: 8px; }
.p-2 { padding: 16px; }
.p-3 { padding: 24px; }
.p-4 { padding: 32px; }

/* ===== Footer Styles ===== */
.footer {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border-top: 1px solid rgba(255, 255, 255, 0.2);
    padding: 16px 0;
    margin-top: auto;
}

.footer-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.security-message {
    flex: 1;
}

.security-text {
    color: rgba(255, 255, 255, 0.9);
    font-size: 14px;
    font-weight: 500;
    text-align: right;
}

.certificate-link {
    margin-right: 20px;
}

.cert-link {
    display: inline-block;
    transition: transform var(--transition-fast);
}

.cert-link:hover {
    transform: scale(1.1);
}

.cert-image {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.3);
    transition: border-color var(--transition-fast);
}

.cert-link:hover .cert-image {
    border-color: rgba(255, 255, 255, 0.6);
}

.trust-seals {
    display: flex;
    align-items: center;
    gap: 16px;
}

#zibal {
    height: 60px;
    display: flex;
    align-items: center;
    pointer-events: none;
}

#zibal * {
    pointer-events: none;
}

#zibal img {
    height: 60px !important;
    width: auto;
}

.enamad-seal {
    margin-right: 0;
}

.enamad-seal img {
    width: 80px;
    height: auto;
    border-radius: var(--border-radius-sm);
    transition: transform var(--transition-fast);
}

.enamad-seal a:hover img {
    transform: scale(1.05);
}

/* Footer Responsive */
@media (max-width: 768px) {
    .footer-content {
        flex-direction: column;
        gap: 12px;
        text-align: center;
    }
    
    .security-text {
        text-align: center;
        font-size: 13px;
    }
    
    .certificate-link {
        margin-right: 0;
    }
    
    .trust-seals {
        justify-content: center;
        gap: 12px;
    }
    
    #zibal {
        height: 50px;
    }
    
    #zibal img {
        height: 50px !important;
    }
    
    .enamad-seal img {
        width: 70px;
    }
}

@media (max-width: 400px) {
    .footer {
        padding: 12px 0;
    }
    
    .footer-content {
        padding: 0 16px;
    }
    
    .security-text {
        font-size: 12px;
    }
    
    .cert-image {
        width: 35px;
        height: 35px;
    }
    
    .enamad-seal img {
        width: 70px;
    }
    
    #zibal {
        height: 45px;
    }
    
    #zibal img {
        height: 45px !important;
    }
}

