:root {
    --primary-color: #0052cc;
    --primary-hover: #0065ff;
    --secondary-color: #42526e;
    --background: #f4f5f7;
    --surface: #ffffff;
    --text-primary: #172b4d;
    --text-secondary: #6b778c;
    --border: #dfe1e6;
    --success: #00875a;
    --error: #de350b;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    --shadow-hover: 0 4px 16px rgba(0, 0, 0, 0.12);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
    background-color: var(--background);
    color: var(--text-primary);
    line-height: 1.6;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

header {
    text-align: center;
    margin-bottom: 40px;
}

.title {
    font-size: 2.5rem;
    font-weight: 600;
    margin-bottom: 10px;
}

.subtitle {
    font-size: 1.125rem;
    color: var(--text-secondary);
}

main {
    flex: 1;
}

.upload-section {
    margin-bottom: 30px;
}

.upload-area {
    background: var(--surface);
    border: 2px dashed var(--border);
    border-radius: 8px;
    padding: 60px 40px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.upload-area:hover {
    border-color: var(--primary-color);
    box-shadow: var(--shadow);
}

.upload-area.drag-over {
    background-color: #f0f8ff;
    border-color: var(--primary-color);
}

.upload-area svg {
    color: var(--text-secondary);
    margin-bottom: 16px;
}

.upload-area p {
    color: var(--text-secondary);
    font-size: 1rem;
}

.browse-text {
    color: var(--primary-color);
    font-weight: 500;
}

.settings-panel {
    background: var(--surface);
    border-radius: 8px;
    padding: 30px;
    box-shadow: var(--shadow);
    margin-bottom: 30px;
}

.tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 30px;
    border-bottom: 2px solid var(--border);
}

.tab {
    background: none;
    border: none;
    padding: 12px 24px;
    font-size: 1rem;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    position: relative;
    transition: color 0.3s ease;
}

.tab:hover {
    color: var(--text-primary);
}

.tab.active {
    color: var(--primary-color);
}

.tab.active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    right: 0;
    height: 2px;
    background-color: var(--primary-color);
}

.tab-content {
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-weight: 500;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.form-group input[type="text"],
.form-group input[type="file"] {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 1rem;
    transition: border-color 0.3s ease;
}

.form-group input[type="text"]:focus {
    outline: none;
    border-color: var(--primary-color);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

input[type="range"] {
    width: calc(100% - 60px);
    margin-right: 10px;
    vertical-align: middle;
}

.range-value {
    display: inline-block;
    min-width: 50px;
    text-align: right;
    color: var(--text-secondary);
}

input[type="color"] {
    width: 50px;
    height: 40px;
    border: 1px solid var(--border);
    border-radius: 4px;
    cursor: pointer;
}

.position-grid {
    display: grid;
    grid-template-columns: repeat(3, 60px);
    gap: 10px;
    margin-top: 10px;
}

.position-btn {
    padding: 12px;
    border: 1px solid var(--border);
    background: var(--surface);
    border-radius: 4px;
    cursor: pointer;
    font-size: 1.2rem;
    transition: all 0.3s ease;
}

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

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

.common-settings {
    margin-top: 30px;
    padding-top: 30px;
    border-top: 1px solid var(--border);
}

.apply-btn,
.download-btn {
    width: 100%;
    padding: 14px 24px;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.3s ease;
    margin-top: 20px;
}

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

.apply-btn:disabled,
.download-btn:disabled {
    background-color: var(--border);
    cursor: not-allowed;
}

.preview-section {
    background: var(--surface);
    border-radius: 8px;
    padding: 30px;
    box-shadow: var(--shadow);
}

.preview-section h2 {
    margin-bottom: 20px;
    font-size: 1.5rem;
    font-weight: 500;
}

.preview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.preview-item {
    position: relative;
    background: var(--background);
    border-radius: 4px;
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: box-shadow 0.3s ease;
}

.preview-item:hover {
    box-shadow: var(--shadow-hover);
}

.preview-item img {
    width: 100%;
    height: auto;
    display: block;
}

.preview-item-name {
    padding: 10px;
    font-size: 0.875rem;
    color: var(--text-secondary);
    text-overflow: ellipsis;
    white-space: nowrap;
    overflow: hidden;
}

.download-individual {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(255, 255, 255, 0.9);
    border: none;
    border-radius: 4px;
    padding: 6px 12px;
    font-size: 0.875rem;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.preview-item:hover .download-individual {
    opacity: 1;
}

footer {
    margin-top: 60px;
    padding-top: 30px;
    border-top: 1px solid var(--border);
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.875rem;
}

@media (max-width: 768px) {
    .title {
        font-size: 2rem;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .preview-grid {
        grid-template-columns: 1fr;
    }
    
    .upload-area {
        padding: 40px 20px;
    }
    
    .settings-panel {
        padding: 20px;
    }
}