@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

/* Fallback font-face definitions */
@font-face {
    font-family: 'ArabicFont';
    src: url('29LTZaridSans-Variable.ttf') format('truetype');
}

@font-face {
    font-family: 'EnglishFont';
    src: url('EEMC%20Season%20Sans%20Bold.ttf') format('truetype');
}

:root {
    --bg-main: #fcfcfc;
    --panel-bg: #ffffff;
    --primary-red: #5b0b0e;
    --primary-light: #7a1215;
    --border-color: #e5e5e5;
    --text-main: #2b2b2b;
    --text-muted: #6b6b6b;
    --shadow-soft: 0 4px 20px rgba(0, 0, 0, 0.05);
    --shadow-hover: 0 8px 30px rgba(91, 11, 14, 0.15);
    --border-radius: 12px;
}

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

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-main);
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    background-image: radial-gradient(circle at 50% 0%, #fef0f1 0%, var(--bg-main) 70%);
}

.app-container {
    width: 100%;
    max-width: 1200px;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

header {
    text-align: center;
}

header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: var(--primary-red);
}

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

.content-wrapper {
    display: flex;
    flex-wrap: wrap;
    gap: 3rem;
    align-items: flex-start;
}

.controls-panel {
    flex: 1;
    min-width: 320px;
    background: var(--panel-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 2.5rem 2rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    box-shadow: var(--shadow-soft);
}

.preview-panel {
    flex: 2;
    min-width: 320px;
    display: flex;
    justify-content: center;
    align-items: flex-start;
}

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

.input-group label {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text-muted);
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

input[type="text"], select {
    width: 100%;
    background: #fafafa;
    border: 1px solid var(--border-color);
    color: var(--text-main);
    padding: 1rem 1.2rem;
    border-radius: 8px;
    font-family: inherit;
    font-size: 1.05rem;
    transition: all 0.3s ease;
}

input[type="text"]:focus, select:focus {
    outline: none;
    border-color: var(--primary-red);
    box-shadow: 0 0 0 3px rgba(91, 11, 14, 0.1);
    background: #ffffff;
}

.btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.8rem;
    background: var(--primary-red);
    color: #ffffff;
    border: none;
    padding: 1.1rem;
    border-radius: 8px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    margin-top: 1rem;
    box-shadow: 0 4px 15px rgba(91, 11, 14, 0.2);
}

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

.btn:active:not(:disabled) {
    transform: translateY(0);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: #ccc;
    box-shadow: none;
}

.canvas-wrapper {
    position: relative;
    width: 100%;
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--shadow-soft);
    background: #ffffff;
    border: 1px solid var(--border-color);
    min-height: 300px;
}

canvas {
    display: block;
    width: 100%;
    height: auto;
    object-fit: contain;
}

.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(8px);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    font-size: 1.2rem;
    font-weight: 500;
    color: var(--primary-red);
    z-index: 10;
    transition: opacity 0.5s ease;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(91, 11, 14, 0.1);
    border-radius: 50%;
    border-top-color: var(--primary-red);
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

@media (max-width: 768px) {
    .content-wrapper {
        flex-direction: column-reverse;
    }
    .app-container {
        padding: 1rem;
    }
    header h1 {
        font-size: 2rem;
    }
}
