/* إعدادات عامة */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #6366f1;
    --primary-dark: #4f46e5;
    --primary-light: #818cf8;
    --secondary-color: #8b5cf6;
    --accent-color: #ec4899;
    --text-color: #1e293b;
    --text-light: #64748b;
    --bg-color: #0f172a;
    --card-bg: rgba(255, 255, 255, 0.95);
    --card-bg-dark: rgba(30, 41, 59, 0.8);
    --border-color: rgba(255, 255, 255, 0.2);
    --border-light: rgba(255, 255, 255, 0.1);
    --success-color: #10b981;
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 8px 15px rgba(0, 0, 0, 0.15);
    --shadow-lg: 0 15px 30px rgba(0, 0, 0, 0.2);
    --shadow-xl: 0 25px 50px rgba(0, 0, 0, 0.3);
    --glow: 0 0 20px rgba(99, 102, 241, 0.5);
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 25%, #334155 50%, #475569 75%, #64748b 100%);
    background-size: 400% 400%;
    animation: gradientShift 15s ease infinite;
    color: var(--text-color);
    line-height: 1.6;
    padding: 0;
    min-height: 100vh;
    position: relative;
    overflow-x: hidden;
}

/* خلفية متحركة */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: 
        radial-gradient(circle at 20% 50%, rgba(99, 102, 241, 0.3) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(139, 92, 246, 0.3) 0%, transparent 50%),
        radial-gradient(circle at 40% 20%, rgba(236, 72, 153, 0.2) 0%, transparent 50%);
    animation: pulse 20s ease-in-out infinite;
    pointer-events: none;
    z-index: 0;
}

@keyframes gradientShift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.8; transform: scale(1.1); }
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    background: transparent;
    padding: 40px 20px;
    position: relative;
    z-index: 1;
}

/* الهيدر */
header {
    text-align: center;
    margin-bottom: 48px;
    padding: 60px 40px;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.9) 0%, rgba(139, 92, 246, 0.9) 100%);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 24px;
    box-shadow: 
        0 20px 60px rgba(99, 102, 241, 0.4),
        0 0 40px rgba(139, 92, 246, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
    position: relative;
    overflow: hidden;
    animation: slideDown 0.8s ease-out;
}

header::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(45deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    animation: shine 3s infinite;
}

@keyframes shine {
    0% { transform: translateX(-100%) translateY(-100%) rotate(45deg); }
    100% { transform: translateX(100%) translateY(100%) rotate(45deg); }
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

header h1 {
    font-size: 3rem;
    color: white;
    margin-bottom: 16px;
    font-weight: 800;
    letter-spacing: -0.02em;
    text-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    position: relative;
    z-index: 1;
}

.subtitle {
    font-size: 1.25rem;
    color: rgba(255, 255, 255, 0.95);
    font-weight: 400;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    position: relative;
    z-index: 1;
}

/* القسم الرئيسي */
.generator-wrapper {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 32px;
    margin-bottom: 48px;
}

@media (max-width: 968px) {
    .generator-wrapper {
        grid-template-columns: 1fr;
        gap: 24px;
    }
}

/* قسم الإدخال */
.input-section {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    padding: 40px;
    border-radius: 24px;
    box-shadow: 
        0 20px 60px rgba(0, 0, 0, 0.2),
        0 0 0 1px rgba(255, 255, 255, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.3);
    animation: fadeInUp 0.8s ease-out 0.2s both;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.input-section:hover {
    transform: translateY(-5px);
    box-shadow: 
        0 25px 70px rgba(0, 0, 0, 0.25),
        0 0 0 1px rgba(255, 255, 255, 0.4),
        0 0 30px rgba(99, 102, 241, 0.2);
}

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

.input-group {
    margin-bottom: 28px;
}

.input-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 12px;
    color: var(--text-color);
    font-size: 0.95rem;
    letter-spacing: 0.01em;
    text-transform: none;
}

#inputText {
    width: 100%;
    padding: 18px 20px;
    border: 2px solid rgba(99, 102, 241, 0.2);
    border-radius: 16px;
    font-size: 1rem;
    font-family: inherit;
    resize: vertical;
    min-height: 120px;
    transition: all 0.3s ease;
    background: rgba(255, 255, 255, 0.8);
    color: var(--text-color);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}

#inputText:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 
        0 0 0 4px rgba(99, 102, 241, 0.1),
        0 8px 15px rgba(99, 102, 241, 0.2);
    background: white;
    transform: translateY(-2px);
}

.char-count {
    display: block;
    text-align: left;
    font-size: 0.875rem;
    color: var(--text-light);
    margin-top: 8px;
    font-weight: 500;
}

/* خيارات الجوال */
.phone-options {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.1) 0%, rgba(139, 92, 246, 0.1) 100%);
    padding: 24px;
    border-radius: 20px;
    margin-bottom: 28px;
    border: 2px solid rgba(99, 102, 241, 0.3);
    backdrop-filter: blur(10px);
    animation: slideIn 0.5s ease-out;
}

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

.phone-options label {
    display: block;
    font-weight: 600;
    margin-bottom: 16px;
    color: var(--primary-color);
    font-size: 0.95rem;
    text-transform: none;
}

.radio-group {
    display: flex;
    gap: 16px;
}

.radio-label {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    cursor: pointer;
    padding: 14px 24px;
    background: white;
    border-radius: 16px;
    border: 2px solid rgba(99, 102, 241, 0.2);
    transition: all 0.3s ease;
    flex: 1;
    font-weight: 600;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}

.radio-label:hover {
    border-color: var(--primary-color);
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.05) 0%, rgba(139, 92, 246, 0.05) 100%);
    transform: translateY(-2px);
    box-shadow: 0 8px 15px rgba(99, 102, 241, 0.2);
}

.radio-label input[type="radio"]:checked + span {
    color: var(--primary-color);
}

.radio-label input[type="radio"]:checked ~ span,
.radio-label:has(input[type="radio"]:checked) {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.1) 0%, rgba(139, 92, 246, 0.1) 100%);
    border-color: var(--primary-color);
    box-shadow: 0 0 20px rgba(99, 102, 241, 0.3);
}

.radio-label input[type="radio"] {
    margin: 0;
    width: 20px;
    height: 20px;
    cursor: pointer;
    accent-color: var(--primary-color);
}

/* مجموعة مفتاح الدولة */
.country-code-group {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 2px solid rgba(99, 102, 241, 0.2);
}

.country-code-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 12px;
    color: var(--primary-color);
    font-size: 0.95rem;
    text-transform: none;
}

.country-code-select {
    width: 100%;
    padding: 14px 18px;
    border: 2px solid rgba(99, 102, 241, 0.2);
    border-radius: 16px;
    font-size: 1rem;
    font-family: inherit;
    background: white;
    color: var(--text-color);
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}

.country-code-select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 
        0 0 0 4px rgba(99, 102, 241, 0.1),
        0 8px 15px rgba(99, 102, 241, 0.2);
    transform: translateY(-2px);
}

.country-code-select:hover {
    border-color: var(--primary-color);
    background: rgba(99, 102, 241, 0.02);
}

/* خيارات التخصيص */
.customization-options {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.option-group {
    display: flex;
    align-items: center;
    gap: 16px;
}

.option-group label {
    flex: 1;
    font-weight: 600;
    color: var(--text-color);
    font-size: 0.95rem;
    text-transform: none;
}

#qrColor {
    width: 70px;
    height: 50px;
    border: 2px solid rgba(99, 102, 241, 0.2);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

#qrColor:hover {
    border-color: var(--primary-color);
    transform: scale(1.05);
    box-shadow: 0 8px 15px rgba(0, 0, 0, 0.2);
}

input[type="file"] {
    flex: 1;
    padding: 14px 18px;
    border: 2px solid rgba(99, 102, 241, 0.2);
    border-radius: 16px;
    background: white;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.95rem;
    font-weight: 500;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}

input[type="file"]:hover {
    background: rgba(99, 102, 241, 0.02);
    border-color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: 0 8px 15px rgba(99, 102, 241, 0.15);
}

input[type="range"] {
    flex: 1;
    height: 6px;
    border-radius: 10px;
    background: rgba(99, 102, 241, 0.2);
    outline: none;
    cursor: pointer;
    transition: all 0.3s ease;
}

input[type="range"]:hover {
    background: rgba(99, 102, 241, 0.3);
}

input[type="range"]::-webkit-slider-thumb {
    appearance: none;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    cursor: pointer;
    border: 3px solid white;
    box-shadow: 0 4px 10px rgba(99, 102, 241, 0.4);
    transition: all 0.3s ease;
}

input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.2);
    box-shadow: 0 6px 15px rgba(99, 102, 241, 0.6);
}

input[type="range"]::-moz-range-thumb {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    cursor: pointer;
    border: 3px solid white;
    box-shadow: 0 4px 10px rgba(99, 102, 241, 0.4);
    transition: all 0.3s ease;
}

input[type="range"]::-moz-range-thumb:hover {
    transform: scale(1.2);
    box-shadow: 0 6px 15px rgba(99, 102, 241, 0.6);
}

.option-group span {
    font-weight: 700;
    color: var(--primary-color);
    min-width: 70px;
    text-align: left;
    font-size: 1rem;
}

/* الأزرار */
.generate-btn, .download-btn {
    width: 100%;
    padding: 18px 36px;
    font-size: 1.1rem;
    font-weight: 700;
    color: white;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    border: none;
    border-radius: 16px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 
        0 8px 20px rgba(99, 102, 241, 0.4),
        0 0 0 0 rgba(99, 102, 241, 0.5);
    text-transform: none;
    letter-spacing: 0.02em;
    position: relative;
    overflow: hidden;
}

.generate-btn::before, .download-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: left 0.5s ease;
}

.generate-btn:hover::before, .download-btn:hover::before {
    left: 100%;
}

.generate-btn:hover, .download-btn:hover {
    transform: translateY(-3px);
    box-shadow: 
        0 12px 30px rgba(99, 102, 241, 0.5),
        0 0 0 4px rgba(99, 102, 241, 0.2);
}

.generate-btn:active, .download-btn:active {
    transform: translateY(-1px);
    box-shadow: 
        0 6px 15px rgba(99, 102, 241, 0.4),
        0 0 0 2px rgba(99, 102, 241, 0.3);
}

.button-group {
    display: flex;
    gap: 16px;
    margin-top: 20px;
}

.generate-btn {
    flex: 2;
}

.clear-btn {
    flex: 1;
    padding: 18px 28px;
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-color);
    background: white;
    border: 2px solid rgba(99, 102, 241, 0.2);
    border-radius: 16px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: none;
    letter-spacing: 0.02em;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}

.clear-btn:hover {
    background: rgba(99, 102, 241, 0.05);
    border-color: var(--primary-color);
    color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: 0 8px 15px rgba(99, 102, 241, 0.15);
}

.clear-btn:active {
    transform: translateY(0);
}

/* قسم الإخراج */
.output-section {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    padding: 40px;
    border-radius: 24px;
    box-shadow: 
        0 20px 60px rgba(0, 0, 0, 0.2),
        0 0 0 1px rgba(255, 255, 255, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.3);
    display: flex;
    flex-direction: column;
    align-items: center;
    animation: fadeInUp 0.8s ease-out 0.4s both;
}

.qr-container {
    width: 100%;
    min-height: 400px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.05) 0%, rgba(139, 92, 246, 0.05) 100%);
    border-radius: 20px;
    border: 2px dashed rgba(99, 102, 241, 0.3);
    position: relative;
    transition: all 0.3s ease;
    overflow: hidden;
}

.qr-container::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(45deg, transparent, rgba(99, 102, 241, 0.05), transparent);
    animation: shimmer 3s infinite;
}

@keyframes shimmer {
    0% { transform: translateX(-100%) translateY(-100%) rotate(45deg); }
    100% { transform: translateX(100%) translateY(100%) rotate(45deg); }
}

.qr-container:has(canvas) {
    border-style: solid;
    border-color: rgba(99, 102, 241, 0.4);
    background: white;
    box-shadow: 0 8px 20px rgba(99, 102, 241, 0.2);
}

.placeholder {
    color: var(--text-light);
    font-size: 1.25rem;
    text-align: center;
    font-weight: 500;
    position: relative;
    z-index: 1;
}

#qrContainer canvas {
    max-width: 100%;
    height: auto;
    border-radius: 16px;
    border: 3px solid rgba(99, 102, 241, 0.2);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    animation: scaleIn 0.5s ease-out;
    position: relative;
    z-index: 1;
}

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

.download-section {
    margin-top: 24px;
    display: flex;
    gap: 16px;
    width: 100%;
}

.download-btn {
    flex: 1;
    font-size: 1rem;
    padding: 14px 28px;
}

/* قسم المعلومات */
.info-section {
    margin-top: 60px;
    padding: 50px 40px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    border-radius: 24px;
    box-shadow: 
        0 20px 60px rgba(0, 0, 0, 0.2),
        0 0 0 1px rgba(255, 255, 255, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.3);
    animation: fadeInUp 0.8s ease-out 0.6s both;
}

.info-section h2 {
    text-align: center;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 48px;
    font-size: 2.5rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    text-transform: none;
}

.features {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 32px;
}

.feature {
    text-align: center;
    padding: 36px 28px;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.8) 0%, rgba(255, 255, 255, 0.6) 100%);
    border-radius: 20px;
    border: 2px solid rgba(99, 102, 241, 0.2);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    backdrop-filter: blur(10px);
}

.feature::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.3s ease;
}

.feature:hover::before {
    transform: scaleX(1);
}

.feature:hover {
    transform: translateY(-8px);
    box-shadow: 
        0 20px 40px rgba(99, 102, 241, 0.3),
        0 0 0 1px rgba(99, 102, 241, 0.2);
    border-color: rgba(99, 102, 241, 0.4);
}

.feature .icon {
    font-size: 4rem;
    display: block;
    margin-bottom: 24px;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.1));
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.feature h3 {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 16px;
    font-size: 1.3rem;
    font-weight: 700;
    letter-spacing: -0.01em;
}

.feature p {
    color: var(--text-light);
    font-size: 1rem;
    line-height: 1.7;
}

/* الفوتر */
footer {
    text-align: center;
    padding: 40px 20px;
    margin-top: 60px;
    color: rgba(255, 255, 255, 0.8);
    position: relative;
    z-index: 1;
}

footer p {
    color: rgba(255, 255, 255, 0.9);
    font-size: 1rem;
    font-weight: 500;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

/* تحسينات للهواتف */
@media (max-width: 768px) {
    .container {
        padding: 20px 16px;
    }

    header {
        padding: 40px 24px;
    }

    header h1 {
        font-size: 2rem;
    }

    .subtitle {
        font-size: 1rem;
    }

    .input-section,
    .output-section {
        padding: 28px;
    }

    .radio-group {
        flex-direction: column;
    }

    .download-section {
        flex-direction: column;
    }

    .info-section {
        padding: 36px 24px;
    }

    .info-section h2 {
        font-size: 1.75rem;
        margin-bottom: 32px;
    }

    .features {
        grid-template-columns: 1fr;
        gap: 24px;
    }

    .feature {
        padding: 32px 24px;
    }
}

/* تأثيرات حركية إضافية */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* تحسينات إضافية */
.radio-label {
    font-weight: 600;
}

/* إزالة الـ scrollbar الأزرق على Chrome */
input[type="range"]::-webkit-slider-runnable-track {
    background: transparent;
}

input[type="range"]::-moz-range-track {
    background: transparent;
}

/* تأثيرات التحميل */
@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* تحسينات للوضع الداكن المحتمل */
@media (prefers-color-scheme: dark) {
    .input-section,
    .output-section,
    .info-section {
        background: rgba(30, 41, 59, 0.95);
        color: rgba(255, 255, 255, 0.9);
    }
    
    .input-group label,
    .option-group label {
        color: rgba(255, 255, 255, 0.9);
    }
    
    #inputText {
        background: rgba(15, 23, 42, 0.8);
        color: rgba(255, 255, 255, 0.9);
        border-color: rgba(99, 102, 241, 0.3);
    }
}
