 :root {
    --bg-dark: #121212;
    --panel-bg: #1e1e24;
    --accent: #00e676; 
    --text: #ffffff;
    --text-dim: #aaaaaa;
    --border: #333333;
    --danger: #ff4b4b;
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; outline: none; }

body { 
    font-family: 'Montserrat', sans-serif; 
    background: var(--bg-dark); 
    color: var(--text); 
    height: 100vh; 
    height: 100svh;
    display: flex; 
    flex-direction: column; 
    overflow: hidden; 
}

/* --- TOP BAR --- */
.top-bar {
    height: 60px;
    background: var(--panel-bg);
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 20px;
    z-index: 10;
}
.logo { font-family: 'Pacifico', cursive; color: var(--accent); font-size: 20px; }
.history-controls { display: flex; gap: 10px; }
.top-btn {
    background: #333; border: none; color: white; width: 40px; height: 40px;
    border-radius: 50%; cursor: pointer; font-size: 16px; display: flex; align-items: center; justify-content: center;
}
.top-btn:disabled { opacity: 0.3; }
.btn-finish {
    background: var(--accent); color: #000; padding: 8px 16px; border-radius: 20px;
    font-weight: bold; border: none; cursor: pointer; display: flex; align-items: center; gap: 8px;
}

/* --- MAIN LAYOUT --- */
.app-container { display: flex; width: 100%; height: calc(100% - 60px); }

/* --- SIDEBAR LEFT --- */
.sidebar-left { 
    width: 70px; background: var(--panel-bg); display: flex; flex-direction: column; 
    align-items: center; padding-top: 20px; border-right: 1px solid var(--border); z-index: 5;
}
.tool-btn {
    width: 45px; height: 45px; border-radius: 10px; border: none; background: transparent; 
    color: var(--text-dim); font-size: 20px; margin-bottom: 5px; cursor: pointer; position: relative;
}
.tool-btn:hover { color: var(--text); background: rgba(255,255,255,0.05); }
.tool-btn.active { color: var(--accent); background: rgba(0, 230, 118, 0.1); }
.tool-label { font-size: 9px; margin-bottom: 15px; color: var(--text-dim); text-align: center;}

/* --- WORKSPACE --- */
.workspace { 
    flex-grow: 1; display: flex; justify-content: center; align-items: center; 
    background-color: #0b0b0d; position: relative; overflow: hidden;
    background-image: radial-gradient(#222 1px, transparent 1px); background-size: 20px 20px;
}
.canvas-shadow { box-shadow: 0 0 50px rgba(0,0,0,0.8); border: 1px dashed #444; }

/* --- SIDEBAR RIGHT (PROPERTIES) --- */
.sidebar-right { 
    width: 300px; background: var(--panel-bg); border-left: 1px solid var(--border); 
    padding: 20px; display: flex; flex-direction: column; overflow-y: auto;
}
h3 { font-size: 12px; text-transform: uppercase; color: var(--accent); margin-bottom: 15px; border-bottom: 1px solid #333; padding-bottom: 5px; }
.prop-section { display: none; }
.prop-section.active { display: block; animation: fadeIn 0.3s; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: translateY(0); } }

label { font-size: 11px; color: #888; display: block; margin-bottom: 5px; margin-top: 10px; }
input[type="range"] { width: 100%; accent-color: var(--accent); margin-bottom: 5px; }
select, input[type="text"] { width: 100%; padding: 10px; background: #111; border: 1px solid #333; color: white; border-radius: 6px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.btn-mini { background: #333; border: none; color: white; padding: 10px; border-radius: 6px; cursor: pointer; font-size: 12px; }
.btn-delete { background: var(--danger); color: white; width: 100%; padding: 12px; border: none; border-radius: 8px; margin-top: 20px; font-weight: bold; cursor: pointer; }
.btn-download-wa { background: #25D366; color: white; width: 100%; padding: 15px; border: none; border-radius: 8px; margin-top: 10px; font-weight: bold; cursor: pointer; font-size: 14px; display: flex; align-items: center; justify-content: center; gap: 10px; }
.color-wrapper { display: flex; align-items: center; gap: 10px; background: #111; padding: 5px; border-radius: 6px; border: 1px solid #333; }
input[type="color"] { border: none; background: none; width: 30px; height: 30px; cursor: pointer; }

/* --- ASSET MODAL (EMOJI & SHAPES) --- */
.asset-modal {
    position: fixed; bottom: -100%; left: 0; width: 100%; height: 50vh; 
    background: #1a1a1e; border-top-left-radius: 20px; border-top-right-radius: 20px;
    box-shadow: 0 -5px 20px rgba(0,0,0,0.5); z-index: 100; transition: 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    display: flex; flex-direction: column;
}
.asset-modal.open { bottom: 0; }
.modal-header { padding: 15px; border-bottom: 1px solid #333; display: flex; gap: 10px; overflow-x: auto; }
.tab-btn { 
    background: #333; border: none; color: #fff; padding: 8px 15px; border-radius: 20px; 
    font-size: 12px; cursor: pointer; white-space: nowrap; 
}
.tab-btn.active { background: var(--accent); color: #000; font-weight: bold; }
.modal-content { flex: 1; overflow-y: auto; padding: 15px; }

/* Grid Assets */
.asset-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; }
.asset-item { 
    font-size: 30px; background: #222; border-radius: 8px; border: none;
    aspect-ratio: 1; cursor: pointer; display: flex; align-items: center; justify-content: center;
}
.asset-item:active { transform: scale(0.9); background: #333; }
.shape-preview { width: 30px; height: 30px; background: white; }

/* --- MOBILE --- */
@media (max-width: 768px) {
    .app-container { flex-direction: column; height: calc(100% - 50px); }
    .top-bar { height: 50px; padding: 0 10px; } .logo { display: none; }
    .workspace { height: 45vh; order: 1; }
    .sidebar-right { width: 100%; height: auto; flex: 1; order: 2; padding-bottom: 80px; border-left: none; border-top: 1px solid var(--border); }
    .sidebar-left { position: fixed; bottom: 0; width: 100%; height: 65px; flex-direction: row; justify-content: space-around; padding: 5px; background: #16161c; order: 3; border-top: 1px solid #333; }
    .tool-label { display: none; } .tool-btn { margin-bottom: 0; width: 100%; border-radius: 0; }
}