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

body {
    font-family: 'Cairo', sans-serif;
    background: linear-gradient(135deg, #f0f2f5 0%, #e3e6ea 100%);
    min-height: 100vh;
    padding: 20px;
    display: flex;
    justify-content: center;
    align-items: flex-start;
}

.container {
    max-width: 1400px;
    width: 100%;
    margin: 0 auto;
    padding: 20px;
    background: #ffffff;
    border-radius: 15px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    display: flex;
    gap: 20px;
}

.settings-panel {
    padding: 20px;
    background: #f8fafc;
    border-radius: 12px;
    max-height: calc(100vh - 80px);
    overflow-y: auto;
    box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.05);
}

.preview-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px;
    position: relative;
}

.section-title {
    font-size: 20px;
    font-weight: 600;
    color: #2d3748;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid #e2e8f0;
    position: relative;
}

.section-title::after {
    content: '';
    position: absolute;
    bottom: -2px;
    right: 0;
    width: 50px;
    height: 2px;
    background: #3182ce;
}

.controls {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.control-group {
    background: white;
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
    margin-bottom: 15px;
    border: 1px solid #edf2f7;
}

.settings-row {
    display: flex;
    gap: 15px;
    align-items: flex-start;
}

.settings-item {
    flex: 1;
    min-width: 0;
}

.font-settings {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
    margin: 10px 0;
    padding: 15px;
    background: #f8fafc;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
}

.font-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

.font-row label {
    flex: 0 0 80px;
    font-size: 14px;
    color: #4a5568;
    font-weight: 500;
}

select, input[type="text"], input[type="number"] {
    padding: 8px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.3s ease;
    background: #fff;
}

select:hover, input[type="text"]:hover, input[type="number"]:hover {
    border-color: #cbd5e0;
}

select:focus, input[type="text"]:focus, input[type="number"]:focus {
    border-color: #3182ce;
    box-shadow: 0 0 0 3px rgba(49, 130, 206, 0.1);
    outline: none;
}

.font-group-label {
    font-weight: 600;
    color: #4a5568;
    padding: 8px 12px;
    background: #edf2f7;
    margin-top: 8px;
    border-radius: 4px;
}

select option {
    padding: 8px 12px;
    font-size: 14px;
}

select option:not([disabled]) {
    color: #2d3748;
}

.slider-container {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
}

input[type="range"] {
    flex: 1;
    height: 6px;
    -webkit-appearance: none;
    background: #e2e8f0;
    border-radius: 3px;
    outline: none;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    background: #3182ce;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s ease;
}

input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.1);
}

.slider-value {
    min-width: 60px;
    text-align: center;
    font-size: 14px;
    color: #4a5568;
    background: #edf2f7;
    padding: 4px 8px;
    border-radius: 4px;
}

input[type="color"] {
    -webkit-appearance: none;
    width: 60px;
    height: 60px;
    border-radius: 8px;
    box-sizing: border-box;
    cursor: pointer;
    background: none;
}

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

input[type="color"]::-webkit-color-swatch {
    border: none;
    border-radius: 8px;
}

input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin-right: 8px;
}

.full-width {
    grid-column: 1 / -1;
}

label {
    font-weight: 600;
    color: #2d3748;
    font-size: 14px;
}

input, select {
    padding: 10px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    font-size: 16px;
    background: #f7fafc;
    transition: border-color 0.3s ease;
}

input:focus, select:focus {
    outline: none;
    border-color: #3182ce;
    box-shadow: 0 0 0 3px rgba(49, 130, 206, 0.1);
}

input[type="range"] {
    width: 100%;
    cursor: pointer;
}

input[type="file"] {
    padding: 5px;
}

#previewContainer {
    width: 699px;
    height: 960px;
    position: relative;
    overflow: hidden;
    background: #ffffff;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    border-radius: 8px;
}

#previewContent {
    width: 100%;
    height: 100%;
    position: relative;
    overflow: hidden;
}

.download-container {
    width: 100%;
    max-width: 699px;
    margin-top: 20px;
    display: flex;
    justify-content: center;
    gap: 15px;
}

.download-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 14px 28px;
    background: linear-gradient(135deg, #38a169 0%, #2f855a 100%);
    color: #ffffff;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.download-btn:hover {
    background: linear-gradient(135deg, #2f855a 0%, #276749 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.15);
}

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

.download-btn svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
}

@media (max-width: 1200px) {
    .container {
        flex-direction: column;
    }

    .settings-panel {
        flex: none;
        width: 100%;
        max-height: none;
    }

    .preview-panel {
        width: 100%;
    }

    #previewContainer {
        width: 100%;
        height: calc(100vw * (960 / 699));
        max-width: 699px;
        max-height: 960px;
    }
}

@media (max-width: 768px) {
    body {
        padding: 10px;
    }

    .container {
        padding: 15px;
    }

    .settings-panel {
        padding: 15px;
    }

    .control-group {
        padding: 10px;
    }

    .download-container {
        flex-direction: column;
        align-items: center;
    }

    .download-btn {
        width: 100%;
        max-width: 300px;
        padding: 12px 20px;
        font-size: 14px;
    }

    label {
        font-size: 13px;
    }

    input, select {
        font-size: 14px;
    }
}

.font-preview {
    font-size: 16px;
    margin-right: 10px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
