:root {
    --primary-color: #6366f1;
    --primary-hover: #4f46e5;
    --bg-color: #0f172a;
    --card-bg: rgba(30, 41, 59, 0.85);
    --text-main: #f8fafc;
    --text-muted: #cbd5e1;
    --border-color: #334155;
    --radius: 16px;
    --shadow: 0 15px 35px -5px rgba(0, 0, 0, 0.5), 0 10px 15px -6px rgba(0, 0, 0, 0.3);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Cairo', sans-serif;
    background: linear-gradient(135deg, #0f172a 0%, #1e1b4b 100%);
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.app-container {
    background: var(--card-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius);
    padding: 2.5rem;
    width: 100%;
    max-width: 850px;
    box-shadow: var(--shadow);
}

header {
    text-align: center;
    margin-bottom: 2.5rem;
}

header h1 {
    font-size: 2.2rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    background: linear-gradient(to right, #818cf8, #c084fc);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

header p {
    color: var(--text-muted);
    font-size: 1.1rem;
}

main {
    display: flex;
    flex-direction: column;
    gap: 3rem;
}

@media (min-width: 768px) {
    main {
        flex-direction: row;
        align-items: center;
    }
}

.input-section {
    flex: 1.2;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

label {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text-muted);
}

/* New Input Styles */
.input-with-icon {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
}

.input-with-icon .icon {
    position: absolute;
    right: 14px;
    color: #64748b;
    display: flex;
    pointer-events: none;
    transition: color 0.3s ease;
}

.input-with-icon input {
    width: 100%;
    padding: 14px 16px 14px 45px;
    border-radius: 10px;
    border: 1.5px solid var(--border-color);
    background: rgba(15, 23, 42, 0.6);
    color: var(--text-main);
    font-family: inherit;
    font-size: 1rem;
    transition: all 0.3s ease;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.1);
}

[dir="rtl"] .input-with-icon input {
    padding: 14px 45px 14px 16px;
}

.input-with-icon input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2), inset 0 2px 4px rgba(0,0,0,0.1);
    background: rgba(30, 41, 59, 0.8);
}

.input-with-icon input:focus ~ .icon {
    color: var(--primary-color);
}

/* File Upload */
input[type="file"] {
    display: none;
}

.file-upload-label {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 14px 16px;
    border: 2px dashed var(--border-color);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    background: rgba(255, 255, 255, 0.03);
}

.file-upload-label:hover {
    border-color: var(--primary-color);
    background: rgba(99, 102, 241, 0.08);
    color: var(--text-main);
}

/* Colors */
.color-options {
    display: flex;
    gap: 1.5rem;
}

input[type="color"] {
    -webkit-appearance: none;
    appearance: none;
    border: none;
    width: 100%;
    height: 44px;
    border-radius: 10px;
    cursor: pointer;
    background: none;
}

input[type="color"]::-webkit-color-swatch-wrapper {
    padding: 0;
}

input[type="color"]::-webkit-color-swatch {
    border: 1px solid var(--border-color);
    border-radius: 8px;
}

/* Button */
.primary-btn {
    font-family: inherit;
    font-size: 1.05rem;
    font-weight: 700;
    padding: 16px 20px;
    border-radius: 10px;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    background-color: var(--primary-color);
    color: white;
    margin-top: 0.5rem;
}

.primary-btn:hover {
    background-color: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(99, 102, 241, 0.4);
}

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

/* Output Section */
.output-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1.5rem;
    padding: 2rem;
    background: rgba(15, 23, 42, 0.5);
    border-radius: var(--radius);
    border: 1px solid var(--border-color);
    box-shadow: inset 0 2px 10px rgba(0,0,0,0.2);
}

#qr-code-container {
    width: 280px;
    height: 280px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: white;
    border-radius: 16px;
    overflow: hidden;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    padding: 12px;
}

/* Fix SVG sizing issue inside container */
#qr-code-container svg,
#qr-code-container canvas {
    max-width: 100%;
    max-height: 100%;
}

.qr-placeholder {
    color: #64748b;
    font-weight: 600;
    border: 2px dashed #cbd5e1;
    background: transparent !important;
    box-shadow: none !important;
}

/* Download Group */
.downloads-container {
    width: 100%;
    text-align: center;
}

.downloads-container label {
    display: block;
    margin-bottom: 12px;
    margin-top: 5px;
    font-size: 0.95rem;
    color: var(--text-main);
    font-weight: 600;
}

.download-buttons {
    display: flex;
    gap: 12px;
    width: 100%;
}

.action-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    font-family: inherit;
    font-size: 0.85rem;
    font-weight: 600;
    padding: 12px 0;
    background-color: rgba(30, 41, 59, 0.8);
    color: var(--text-main);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.action-btn:not(:disabled):hover {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
    transform: translateY(-3px);
    box-shadow: 0 6px 12px rgba(99, 102, 241, 0.3);
}

.action-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    background-color: rgba(30, 41, 59, 0.4);
}

/* Alert Box */
.warning-box {
    background-color: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.4);
    color: #fca5a5;
    padding: 12px;
    border-radius: 8px;
    font-size: 0.9rem;
    line-height: 1.5;
}

/* Animations */
@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.03); }
    100% { transform: scale(1); }
}

.pulse-anim {
    animation: pulse 0.5s ease-in-out;
}
