/* Reset & Base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif;
    background: #f5f5f5;
    color: #333;
    overflow: hidden;
}

.hidden {
    display: none !important;
}

/* Welcome Screen */
#welcome-screen {
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
}

.welcome-content {
    text-align: center;
    color: white;
}

.welcome-content h1 {
    font-size: 4rem;
    margin-bottom: 1rem;
    font-weight: 700;
}

.welcome-content p {
    font-size: 1.5rem;
    margin-bottom: 3rem;
    opacity: 0.95;
}

.welcome-actions {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    align-items: center;
}

#zipcode-input {
    width: 300px;
    padding: 1rem;
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    text-align: center;
}

.btn-large {
    padding: 1rem 2.5rem;
    font-size: 1.1rem;
    font-weight: 600;
    border: none;
    border-radius: 12px;
    background: white;
    color: #059669;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.btn-large:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.25);
}

/* Design Interface */
#design-interface {
    height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Toolbar */
.toolbar {
    height: 60px;
    background: white;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    align-items: center;
    padding: 0 1.5rem;
    justify-content: space-between;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.toolbar-left h2 {
    font-size: 1.5rem;
    color: #059669;
}

.toolbar-center {
    flex: 1;
    display: flex;
    justify-content: center;
}

#zone-badge {
    background: #ecfdf5;
    padding: 0.5rem 1.5rem;
    border-radius: 20px;
    color: #047857;
    font-size: 0.9rem;
}

#zone-badge strong {
    font-weight: 700;
}

.toolbar-right {
    display: flex;
    gap: 0.75rem;
}

.btn-toolbar {
    padding: 0.5rem 1rem;
    border: 1px solid #e5e7eb;
    background: white;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s;
}

.btn-toolbar:hover {
    background: #f9fafb;
    border-color: #d1d5db;
}

.btn-save {
    background: #10b981;
    color: white;
    border-color: #10b981;
}

.btn-save:hover {
    background: #059669;
}

.btn-donate-small {
    background: #f9fafb;
    color: #6b7280;
    border-color: #e5e7eb;
    font-size: 0.75rem;
    padding: 0.4rem 0.75rem;
}

.btn-donate-small:hover {
    background: #ecfdf5;
    color: #059669;
    border-color: #10b981;
}

/* Main Layout */
.main-layout {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* Sidebar */
.items-sidebar {
    width: 280px;
    background: white;
    border-right: 1px solid #e5e7eb;
    display: flex;
    flex-direction: column;
}

.sidebar-tabs {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0;
    background: #f9fafb;
    padding: 0.5rem;
}

.tab-item {
    padding: 0.75rem;
    border: none;
    background: transparent;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    border-radius: 6px;
    transition: background 0.2s;
    color: #6b7280;
}

.tab-item:hover {
    background: #e5e7eb;
}

.tab-item.active {
    background: white;
    color: #059669;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.items-grid {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
    align-content: start;
}

.item-tile {
    aspect-ratio: 1;
    background: #f9fafb;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    cursor: grab;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    position: relative;
}

.item-tile:hover {
    border-color: #10b981;
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(16,185,129,0.2);
}

.item-tile:active {
    cursor: grabbing;
}

.item-tile img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    pointer-events: none;
}

.item-name {
    position: absolute;
    bottom: 0.25rem;
    left: 0;
    right: 0;
    text-align: center;
    font-size: 0.7rem;
    color: #6b7280;
    background: rgba(255,255,255,0.9);
    padding: 0.25rem;
    border-radius: 0 0 6px 6px;
}

/* Canvas Area */
.canvas-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #fafafa;
    position: relative;
}

#canvas-workspace {
    flex: 1;
    position: relative;
    overflow: hidden;
}

#bg-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    user-select: none;
}

#items-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.placed-item {
    position: absolute;
    cursor: move;
    pointer-events: all;
    transition: box-shadow 0.2s;
}

.placed-item.selected {
    box-shadow: 0 0 0 3px #10b981;
}

.placed-item img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    pointer-events: none;
}

/* Controls Panel */
.controls-panel {
    position: absolute;
    bottom: 1.5rem;
    left: 50%;
    transform: translateX(-50%);
    background: white;
    padding: 1rem 1.5rem;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    display: flex;
    align-items: center;
    gap: 1rem;
    z-index: 100;
}

.controls-label {
    font-size: 0.9rem;
    font-weight: 600;
    color: #374151;
}

#size-control,
#rotate-control {
    width: 120px;
}

.btn-control {
    padding: 0.5rem 1rem;
    background: #ef4444;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 500;
    transition: background 0.2s;
}

.btn-control:hover {
    background: #dc2626;
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.7);
    backdrop-filter: blur(4px);
}

.modal-content {
    position: relative;
    background: white;
    padding: 2rem;
    border-radius: 16px;
    max-width: 600px;
    width: 90%;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

.modal-content h3 {
    color: #059669;
    margin-bottom: 1.5rem;
    font-size: 1.5rem;
}

#preview-image {
    max-width: 100%;
    border-radius: 8px;
    margin-bottom: 1.5rem;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

/* Donate Modal */
.donate-modal {
    max-width: 500px;
}

.donate-options {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.donate-option {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.25rem 1.5rem;
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    border-radius: 12px;
    text-decoration: none;
    transition: transform 0.2s, box-shadow 0.2s;
    box-shadow: 0 2px 8px rgba(16,185,129,0.3);
}

.donate-option:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(16,185,129,0.4);
}

.donate-icon {
    font-size: 2rem;
}

.donate-label {
    font-size: 1.1rem;
    font-weight: 600;
}

/* Scrollbar Styling */
.items-grid::-webkit-scrollbar {
    width: 8px;
}

.items-grid::-webkit-scrollbar-track {
    background: #f9fafb;
}

.items-grid::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 4px;
}

.items-grid::-webkit-scrollbar-thumb:hover {
    background: #9ca3af;
}

/* Responsive */
@media (max-width: 768px) {
    .welcome-content h1 {
        font-size: 2.5rem;
    }
    
    .items-sidebar {
        width: 200px;
    }
    
    .sidebar-tabs {
        grid-template-columns: 1fr;
    }
    
    #zipcode-input {
        width: 250px;
    }
}

@media (max-width: 480px) {
    .items-sidebar {
        position: absolute;
        left: -280px;
        z-index: 10;
        transition: left 0.3s;
    }
    
    .items-sidebar.open {
        left: 0;
    }
    
    .controls-panel {
        flex-direction: column;
        gap: 0.5rem;
        padding: 1rem;
    }
}
