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

:root {
    --primary-gradient: linear-gradient(135deg, #2d7a2e 0%, #1a5f1b 100%);
    --secondary-gradient: linear-gradient(135deg, #d4af37 0%, #c5a028 100%);
    --success-gradient: linear-gradient(135deg, #4caf50 0%, #45a049 100%);
    --dark-bg: #0a1f0b;
    --card-bg: rgba(45, 122, 46, 0.08);
    --card-border: rgba(212, 175, 55, 0.2);
    --text-primary: #ffffff;
    --text-secondary: rgba(255, 255, 255, 0.7);
    --shadow-lg: 0 20px 60px rgba(0, 0, 0, 0.4);
    --shadow-xl: 0 30px 80px rgba(0, 0, 0, 0.5);
    --accent-green: #2d7a2e;
    --accent-gold: #d4af37;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--dark-bg);
    color: var(--text-primary);
    min-height: 100vh;
    background-image:
        radial-gradient(at 20% 30%, rgba(45, 122, 46, 0.15) 0px, transparent 50%),
        radial-gradient(at 80% 70%, rgba(212, 175, 55, 0.15) 0px, transparent 50%);
    background-attachment: fixed;
}

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

.header {
    text-align: center;
    margin-bottom: 3rem;
    animation: fadeInDown 0.6s ease-out;
    transition: all 0.3s ease;
}

.header.hidden-mobile {
    display: none;
}

.title {
    font-size: 3.5rem;
    font-weight: 700;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 0.5rem;
    letter-spacing: -0.02em;
}

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

.main-content {
    animation: fadeInUp 0.6s ease-out;
}

/* Upload Section */
.upload-section {
    margin-bottom: 3rem;
}

.upload-area {
    background: var(--card-bg);
    backdrop-filter: blur(10px);
    border: 2px dashed var(--card-border);
    border-radius: 24px;
    padding: 4rem 2rem;
    text-align: center;
    transition: all 0.3s ease;
    cursor: pointer;
}

.upload-area:hover {
    border-color: var(--accent-green);
    background: rgba(45, 122, 46, 0.1);
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.upload-area.dragover {
    border-color: var(--accent-gold);
    background: rgba(212, 175, 55, 0.15);
    transform: scale(1.02);
}

.upload-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 1.5rem;
    color: var(--accent-gold);
    opacity: 0.8;
}

.upload-title {
    font-size: 1.75rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.upload-text {
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
    font-size: 1.1rem;
}

/* Buttons */
.btn {
    padding: 0.875rem 2rem;
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-family: inherit;
}

.btn-primary {
    background: var(--primary-gradient);
    color: white;
    box-shadow: 0 4px 15px rgba(45, 122, 46, 0.4);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(45, 122, 46, 0.6);
}

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

.btn-secondary {
    background: var(--card-bg);
    color: var(--text-primary);
    border: 2px solid var(--card-border);
    backdrop-filter: blur(10px);
}

.btn-secondary:hover {
    background: rgba(212, 175, 55, 0.1);
    border-color: var(--accent-gold);
    transform: translateY(-2px);
}

.btn-icon {
    width: 20px;
    height: 20px;
}

/* Editor Section */
.editor-section {
    margin-bottom: 3rem;
}

.editor-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.editor-header .section-title {
    margin: 0;
    font-size: 2rem;
}

.editor-controls {
    display: flex;
    gap: 1rem;
}

.editor-layout {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 2rem;
    align-items: start;
}

.canvas-container {
    background: var(--card-bg);
    backdrop-filter: blur(10px);
    border: 2px solid var(--card-border);
    border-radius: 24px;
    padding: 2rem;
    position: relative;
}

#editorCanvas {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 12px;
    cursor: move;
    box-shadow: var(--shadow-lg);
}

.canvas-instructions {
    margin-top: 1rem;
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.editor-sidebar {
    background: var(--card-bg);
    backdrop-filter: blur(10px);
    border: 2px solid var(--card-border);
    border-radius: 24px;
    padding: 1.5rem;
}

.sidebar-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 1rem;
}

.size-control {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 2px solid var(--card-border);
}

.control-label {
    display: block;
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
}

.size-slider {
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: rgba(255, 255, 255, 0.1);
    outline: none;
    -webkit-appearance: none;
    appearance: none;
    margin-bottom: 0.5rem;
}

.size-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--secondary-gradient);
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(212, 175, 55, 0.4);
}

.size-slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--secondary-gradient);
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 8px rgba(212, 175, 55, 0.4);
}

.size-value {
    display: block;
    text-align: center;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--accent-gold);
}

.btn-small {
    padding: 0.625rem 1.25rem;
    font-size: 0.875rem;
}

.banner-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 0.75rem;
    max-height: 600px;
    overflow-y: auto;
    padding-right: 0.5rem;
}

.banner-grid::-webkit-scrollbar {
    width: 8px;
}

.banner-grid::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
}

.banner-grid::-webkit-scrollbar-thumb {
    background: rgba(45, 122, 46, 0.5);
    border-radius: 4px;
}

.banner-grid::-webkit-scrollbar-thumb:hover {
    background: rgba(45, 122, 46, 0.7);
}

.banner-option {
    background: var(--card-bg);
    backdrop-filter: blur(10px);
    border: 2px solid var(--card-border);
    border-radius: 12px;
    padding: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
}

.banner-option:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: var(--accent-gold);
}

.banner-option.selected {
    border-color: var(--accent-gold);
    background: rgba(212, 175, 55, 0.15);
    box-shadow: 0 0 30px rgba(212, 175, 55, 0.3);
}

.banner-preview {
    width: 100%;
    height: 120px;
    border-radius: 8px;
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.1) 0%, rgba(255, 255, 255, 0.05) 100%);
}

.banner-name {
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.banner-description {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

/* Preview Section */
.preview-section {
    margin-bottom: 3rem;
}

.preview-container {
    background: var(--card-bg);
    backdrop-filter: blur(10px);
    border: 2px solid var(--card-border);
    border-radius: 24px;
    padding: 2rem;
    margin-bottom: 2rem;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 400px;
}

#previewCanvas {
    max-width: 100%;
    height: auto;
    border-radius: 12px;
    box-shadow: var(--shadow-xl);
}

.action-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

/* Utility Classes */
.hidden {
    display: none !important;
}

/* Animations */
@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

/* Mobile Size Control - Hidden on Desktop */
.mobile-size-control {
    display: none;
}

.desktop-instructions {
    display: block;
}

.mobile-instructions {
    display: none;
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 1rem;
    }

    .title {
        font-size: 2.5rem;
    }

    .subtitle {
        font-size: 1rem;
    }

    .upload-area {
        padding: 3rem 1.5rem;
    }

    .editor-layout {
        grid-template-columns: 1fr;
    }

    .editor-header {
        flex-direction: column;
        align-items: stretch;
    }

    .editor-header .section-title {
        text-align: center;
        font-size: 1.5rem;
    }

    .editor-controls {
        flex-direction: column;
    }

    /* Mobile Size Control - Show on Mobile */
    .mobile-size-control {
        display: block;
        background: rgba(45, 122, 46, 0.15);
        backdrop-filter: blur(10px);
        border: 2px solid var(--accent-gold);
        border-radius: 16px;
        padding: 1.25rem;
        margin-bottom: 1.5rem;
    }

    .mobile-size-control .control-label {
        font-size: 1rem;
        font-weight: 600;
        margin-bottom: 0.75rem;
        display: block;
        text-align: center;
        color: var(--accent-gold);
    }

    .size-control-wrapper {
        display: flex;
        flex-direction: column;
        gap: 0.5rem;
    }

    .mobile-size-control .size-slider {
        height: 8px;
    }

    .mobile-size-control .size-slider::-webkit-slider-thumb {
        width: 28px;
        height: 28px;
    }

    .mobile-size-control .size-slider::-moz-range-thumb {
        width: 28px;
        height: 28px;
    }

    .mobile-size-control .size-value {
        font-size: 1.25rem;
        font-weight: 700;
    }

    /* Hide desktop size control on mobile */
    .editor-sidebar .size-control {
        display: none;
    }

    /* Instructions */
    .desktop-instructions {
        display: none;
    }

    .mobile-instructions {
        display: block;
    }

    /* Horizontal Banner Grid Scrolling */
    .banner-grid {
        display: flex;
        flex-direction: row;
        gap: 0.75rem;
        max-height: none;
        overflow-x: auto;
        overflow-y: hidden;
        padding: 0.75rem 0.25rem;
        margin: 0 -0.5rem;
        scroll-snap-type: x mandatory;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: thin;
    }

    .banner-grid::-webkit-scrollbar {
        height: 6px;
    }

    .banner-grid::-webkit-scrollbar-track {
        background: rgba(255, 255, 255, 0.05);
        border-radius: 3px;
    }

    .banner-grid::-webkit-scrollbar-thumb {
        background: rgba(45, 122, 46, 0.5);
        border-radius: 3px;
    }

    .banner-option {
        flex: 0 0 130px;
        min-width: 130px;
        padding: 0.75rem;
        scroll-snap-align: start;
    }

    .banner-preview {
        height: 90px;
        width: 100%;
    }

    .banner-name {
        font-size: 0.8rem;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .banner-description {
        font-size: 0.7rem;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    /* Canvas adjustments */
    .canvas-container {
        padding: 1.25rem;
    }

    .canvas-instructions {
        font-size: 0.85rem;
    }

    /* Touch-friendly buttons */
    .btn {
        width: 100%;
        justify-content: center;
        padding: 1rem 2rem;
        font-size: 1.05rem;
        min-height: 48px;
    }

    .btn-small {
        padding: 0.875rem 1.5rem;
        font-size: 0.95rem;
    }

    /* Sidebar adjustments */
    .editor-sidebar {
        padding: 1.25rem;
        margin-top: 1.5rem;
    }

    .sidebar-title {
        font-size: 1.1rem;
        text-align: center;
    }
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease-out;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--card-bg);
    backdrop-filter: blur(20px);
    border: 2px solid var(--card-border);
    border-radius: 24px;
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    animation: slideUp 0.3s ease-out;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 2rem;
    border-bottom: 2px solid var(--card-border);
}

.modal-title {
    font-size: 1.5rem;
    font-weight: 600;
    margin: 0;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 2rem;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.modal-close:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: rotate(90deg);
}

.modal-body {
    padding: 2rem;
}

.modal-description {
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
    text-align: center;
}

.form-group {
    margin-bottom: 1.25rem;
}

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

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 0.875rem 1rem;
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid var(--card-border);
    border-radius: 12px;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 1rem;
    transition: all 0.3s ease;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--accent-gold);
    background: rgba(255, 255, 255, 0.08);
}

.form-group textarea {
    resize: vertical;
    min-height: 80px;
}

.modal-actions {
    display: flex;
    gap: 1rem;
    margin-top: 2rem;
}

.modal-actions .btn {
    flex: 1;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Loading State */
.loading {
    pointer-events: none;
    opacity: 0.6;
    animation: pulse 1.5s ease-in-out infinite;
}