:root {
    --primary-color: #2563eb;
    --primary-hover: #1d4ed8;
    --secondary-color: #64748b;
    --success-color: #22c55e;
    --danger-color: #ef4444;
    --background-color: #f8fafc;
    --card-background: #ffffff;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --border-color: #e2e8f0;
}

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

body {
    font-family: 'Inter', sans-serif;
    min-height: 100vh;
    background-color: #f8f9fa;
    color: var(--text-primary);
    line-height: 1.6;
    padding: 20px 0;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

.card {
    background: var(--card-background);
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    border: 1px solid var(--border-color);
}

.controls {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.control-group {
    margin-bottom: 1rem;
}

.input-group {
    margin-bottom: 1rem;
}

label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
    font-weight: 500;
}

input, select, textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background-color: white;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 1rem;
    transition: border-color 0.2s ease;
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    font-weight: 500;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    gap: 0.5rem;
}

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

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

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

.canvas-container {
    max-width: 100%;
    overflow: auto;
    background: #fff;
    border: 2px dashed #dee2e6;
    border-radius: 8px;
}

canvas {
    max-width: 100%;
    height: auto !important;
    display: block;
    margin: 0 auto;
}

.text-line {
    position: relative;
}

.text-line .input-group {
    margin-bottom: 10px;
}

.text-lines-container {
    max-height: 400px;
    overflow-y: auto;
}

.text-line {
    margin-bottom: 1rem;
}

.text-line:last-child {
    margin-bottom: 0;
}

.material-icons {
    font-size: 1.25rem;
}

/* Custom button styles */
.btn-icon {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

/* Alerts and notifications */
.alert {
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
}

.alert-success {
    background-color: #dcfce7;
    color: #166534;
    border: 1px solid #86efac;
}

.alert-error {
    background-color: #fee2e2;
    color: #991b1b;
    border: 1px solid #fca5a5;
}

/* Custom shadows */
.shadow-hover:hover {
    box-shadow: 0 .5rem 1rem rgba(0,0,0,.15);
    transition: box-shadow .3s ease-in-out;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .container {
        padding: 1rem;
    }
    
    .controls {
        grid-template-columns: 1fr;
    }
    
    button {
        width: 100%;
    }
    
    .canvas-container {
        padding: 1rem !important;
    }
    
    /* Improve mobile form controls */
    select.form-select,
    input[type="text"],
    input[type="number"] {
        font-size: 16px !important; /* Prevent iOS zoom */
        -webkit-appearance: none;
        appearance: none;
        border-radius: 8px;
        background-color: white;
    }
    
    select.form-select {
        padding-right: 30px;
        background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23343a40' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e");
        background-repeat: no-repeat;
        background-position: right 0.75rem center;
        background-size: 16px 12px;
    }
    
    .input-group {
        width: 100%;
    }
    
    .input-group > * {
        min-height: 44px; /* Better touch targets */
    }
    
    /* Fix z-index for dropdowns */
    .text-line {
        position: relative;
        z-index: auto;
    }
    
    .text-line .input-group {
        position: relative;
        z-index: auto;
    }
    
    /* Ensure dropdowns are above other elements */
    .form-select:focus {
        z-index: 3;
    }
}
