:root {
    --primary-color: #3e7f72;
    --secondary-color: #2c5e54;
    --accent-color: #d4af37;
    --bg-color: #f8fafc;
    --text-color: #1f2937;
    --white: #ffffff;
    --shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
}

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

body {
    font-family: 'Cairo', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
}

.container {
    width: 90%;
    max-width: 600px;
    background: var(--white);
    padding: 2rem;
    border-radius: 20px;
    box-shadow: var(--shadow);
    text-align: center;
}

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

header p {
    color: #64748b;
    margin-bottom: 2rem;
}

.mini-logo {
    max-width: 150px;
    margin-bottom: 1rem;
    display: none; /* Hide if we use direct canvas drawing */
}

.template-selection {
    margin-bottom: 2rem;
    text-align: right;
}

.template-selection h3 {
    font-size: 1rem;
    margin-bottom: 0.8rem;
    color: var(--secondary-color);
}

.template-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
}

.template-item {
    cursor: pointer;
    border: 3px solid transparent;
    border-radius: 8px;
    overflow: hidden;
    transition: all 0.2s ease;
    aspect-ratio: 1;
}

.template-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.template-item:hover {
    border-color: #cbd5e1;
}

.template-item.active {
    border-color: var(--primary-color);
    box-shadow: 0 0 10px rgba(62, 127, 114, 0.3);
}

.card-preview {
    position: relative;
    width: 100%;
    margin-bottom: 1.5rem;
    border-radius: 12px;
    overflow: hidden;
    background: #eef2f6;
    min-height: 300px;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: inset 0 0 20px rgba(0,0,0,0.05);
}

.drag-hint {
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.5);
    color: white;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    pointer-events: none;
    opacity: 0.8;
}

canvas {
    max-width: 100%;
    height: auto;
    display: block;
    box-shadow: 0 4px 10px rgba(0,0,0,0.05);
}

.loader {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-weight: 700;
    color: var(--primary-color);
}

.controls {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.input-group input {
    width: 100%;
    padding: 1rem;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    font-size: 1.1rem;
    font-family: 'Cairo', sans-serif;
    text-align: center;
    transition: border-color 0.3s ease;
}

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

.button-group {
    display: flex;
    gap: 1rem;
}

.btn {
    flex: 1;
    padding: 1rem;
    border: none;
    border-radius: 12px;
    font-weight: 700;
    cursor: pointer;
    font-family: 'Cairo', sans-serif;
    transition: all 0.3s ease;
}

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

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

.btn.secondary {
    background-color: #64748b;
    color: var(--white);
}

.btn.secondary:hover {
    background-color: #475569;
}

.btn:disabled {
    background-color: #cbd5e1;
    cursor: not-allowed;
}

footer {
    margin-top: 2rem;
    font-size: 0.8rem;
    color: #94a3b8;
}

@media (max-width: 480px) {
    .container {
        padding: 1.5rem;
        width: 95%;
    }
    .button-group {
        flex-direction: column;
    }
}
