/* Font Vazir */
@font-face {
    font-family: 'vazir';
    src: url('./assets/fonts/vazir.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: "Vazir", -apple-system, BlinkMacSystemFont, sans-serif;
}

html, body {
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0;
    overflow: hidden;
    overscroll-behavior: none;
    
    /* Fallback: Static radial gradient for browsers without animation support */
    background: radial-gradient(circle at center,
        #0b006e, #210099, #3f6af5, #1c3874, #012b7a, #08428d, #19207e, #001b44
    );
    
    /* Animated radial gradient - Royal Soft Circle */
    background: radial-gradient(circle at 50% 50%,
        #013ec4 0%,    /* طلایی درخشان - مرکز */
        #0b4191 10%,   /* طلایی ملایم */
        #0257c5 25%,   /* برنز */
        #09247c 40%,   /* آبی فیروزه‌ای */
        #08265e 55%,   /* آبی اقیانوس */
        #0b073d 70%,   /* آبی دریای عمیق */
        #050e36 85%,   /* آبی شب */
        #0a192f 100%   /* آبی سیاه عمیق */
    );
    
    background-size: 600% 600%;
    animation: radialMove 15s ease infinite;
    -webkit-animation: radialMove 15s ease infinite;
    
    /* Performance optimization */
    will-change: background-position;
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
}

/* Standard keyframes for radial */
@keyframes radialMove {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

/* WebKit keyframes for iOS */
@-webkit-keyframes radialMove {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

body {
    font-family: "vazir", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: transparent;
    color: #ffffff;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}

.root {
    width: 100%;
    height: 100%;
    max-width: 600px;
    display: flex;
    flex-direction: column;
    padding: 15px;
    gap: 12px;
}

.title {
    font-size: clamp(14px, 5vw, 24px);
    font-weight: regular;
    text-align: center;
    flex-shrink: 0;
    white-space: normal; 
    word-wrap: break-word;  
    line-height: 1.4;  
    background: rgba(0, 0, 0, 0.555);
    border: 2px solid rgba(255, 255, 255, 0.5);
    border-radius: 16px;
    padding: 16px;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.6);
    
    color: #ffffff;
    
    /* iOS optimization */
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
}

.image-container {
    position: relative;
    width: 100%;
    flex: 1;
    min-height: 0;
    
    background: rgba(0, 0, 0, 0.726);
    border: 2px solid rgba(255, 255, 255, 0.4);
    border-radius: 20px;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.6);
    
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
    
    /* iOS optimization */
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
}

.image-container > * {
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
}

.image-preview {
    max-width: 100%;
    max-height: 100%;
    display: none;
    object-fit: contain;
}

.placeholder {
    font-size: clamp(14px, 3.5vw, 16px);
    color: #ffffff;
    text-align: center;
    padding: 20px;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.8);
    font-weight: 500;
}

.button-row {
    display: flex;
    gap: 12px;
    width: 100%;
    flex-shrink: 0;
}

.button-row .btn {
    flex: 1;
}

.btn {
    padding: clamp(12px, 2.5vh, 16px) clamp(16px, 4vw, 20px);
    font-size: clamp(13px, 3.5vw, 16px);
    font-weight: 600;
    font-family: "vazir", sans-serif;
    border: none;
    border-radius: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
    color: white;
    width: 100%;
    white-space: nowrap;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    
    background: rgba(0, 0, 0, 0.5);
    border: 2px solid rgba(255, 255, 255, 0.4);
    box-shadow: 0 4px 16px 0 rgba(0, 0, 0, 0.5);
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.8);
    
    /* iOS optimization */
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
}

.btn:active {
    transform: scale(0.97);
    -webkit-transform: scale(0.97);
}

.btn:disabled {
    opacity: 0.4;
}

.btn-camera {
    background: linear-gradient(135deg, #667eea, #0a01419c);
    border-color: #00979c;
}

.btn-gallery {
    background: linear-gradient(135deg, #5d0068a2, #4d0000);
    border-color: #7d0181;
}

.btn-share {
    background: linear-gradient(135deg, #002d55ad, #00f2fe);
    border-color: #00f2fe;
}

.developer {
    text-align: center;
    font-size: 12px;
    color: #ffffff;
    flex-shrink: 0;
    padding-top: 8px;
    text-shadow: 0 2px 6px rgba(0, 0, 0, 0.8);
    font-weight: 500;
}

.hidden-input {
    display: none;
}

/* iPhone SE و گوشی‌های کوچک */
@media (max-height: 667px) {
    .title { 
        font-size: clamp(16px, 4.5vw, 20px);
        padding: 12px;
    }
    .btn { 
        padding: 10px 14px;
        font-size: clamp(12px, 3vw, 14px);
    }
    .root { padding: 10px; gap: 8px; }
}

/* گوشی‌های بزرگ */
@media (min-height: 800px) {
    .title { 
        font-size: clamp(13px, 4.5vw, 20px);
        padding: 18px;
    }
    .btn { 
        padding: 18px 24px;
        font-size: clamp(12px, 3vw, 16px);
    }
    
    .root { padding: 18px; gap: 15px; }
}

/* تبلت و بزرگتر */
@media (min-width: 768px) {
    .root { max-width: 550px; }
}

/* Landscape mode */
@media (orientation: landscape) {
    .root { gap: 10px; padding: 12px; }
    .title { font-size: 20px; padding: 14px; }
    .btn { padding: 14px 18px; font-size: 15px; }
}

/* Safe area support for iOS */
@supports (padding: max(0px)) {
    body {
        padding-top: max(env(safe-area-inset-top), 10px);
        padding-bottom: max(env(safe-area-inset-bottom), 10px);
    }
}

/* Reduce motion for accessibility */
@media (prefers-reduced-motion: reduce) {
    html, body {
        animation: none;
        -webkit-animation: none;
    }
    
    .btn {
        transition: none;
    }
}
