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

:root {
    --primary-color: #6366f1;
    --primary-hover: #4f46e5;
    --secondary-color: #f43f5e;
    --secondary-hover: #e11d48;
    --tertiary-color: #0ea5e9;
    --tertiary-hover: #0284c7;
    --background: #f8fafc;
    --card-bg: #ffffff;
    --text-color: #334155;
    --border-color: #e2e8f0;
    --shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --tooltip-bg: #1e293b;
    --tooltip-text: #ffffff;
}

body {
    font-family: 'Poppins', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--background);
    padding: 20px;
    color: var(--text-color);
    line-height: 1.6;
}

.container {
    max-width: 1000px;
    margin: 0 auto;
    background-color: var(--card-bg);
    padding: 20px;
    border-radius: 16px;
    box-shadow: var(--shadow);
}

h1 {
    text-align: center;
    margin-bottom: 20px;
    color: var(--primary-color);
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: -0.5px;
}

h2 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-color);
    margin-bottom: 10px;
    text-align: center;
}

.editor {
    display: grid;
    grid-template-columns: 1fr 3fr;
    grid-template-rows: auto auto auto;
    gap: 15px;
    grid-template-areas:
        "tools grid"
        "colors grid"
        "actions grid";
}

.tools-section {
    grid-area: tools;
    background-color: #f8fafc;
    border-radius: 12px;
    padding: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.color-section {
    grid-area: colors;
    background-color: #f8fafc;
    border-radius: 12px;
    padding: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.actions-section {
    grid-area: actions;
    background-color: #f8fafc;
    border-radius: 12px;
    padding: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.grid-container {
    grid-area: grid;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
}

.tools {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
}

.tool {
    padding: 8px 16px;
    background-color: #f1f5f9;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    color: #1e293b; /* Texto mais escuro para melhor contraste */
}

.tool:before {
    content: '';
    display: inline-block;
    width: 18px;
    height: 18px;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
}

#pencil:before {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%236366f1'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M15.232 5.232l3.536 3.536m-2.036-5.036a2.5 2.5 0 113.536 3.536L6.5 21.036H3v-3.572L16.732 3.732z'%3E%3C/path%3E%3C/svg%3E");
}

#bucket:before {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%236366f1'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M7 21a4 4 0 01-4-4V5a2 2 0 012-2h4a2 2 0 012 2v12a4 4 0 01-4 4zm0 0h12a2 2 0 002-2v-4a2 2 0 00-2-2h-2.343M11 7.343l1.657-1.657a2 2 0 012.828 0l2.829 2.829a2 2 0 010 2.828l-8.486 8.485M7 17h.01'%3E%3C/path%3E%3C/svg%3E");
}

#eraser:before {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%236366f1'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16'%3E%3C/path%3E%3C/svg%3E");
}

.tool:hover {
    background-color: #e2e8f0;
    transform: translateY(-2px);
}

/* Estilo para o botão ativo */
.tool.active {
    background-color: var(--primary-color);
    color: white;
    transform: translateY(-2px);
    font-weight: 600; /* Texto mais visível quando ativo */
}

#pencil.active:before {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='white'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M15.232 5.232l3.536 3.536m-2.036-5.036a2.5 2.5 0 113.536 3.536L6.5 21.036H3v-3.572L16.732 3.732z'%3E%3C/path%3E%3C/svg%3E");
}

#bucket.active:before {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='white'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M7 21a4 4 0 01-4-4V5a2 2 0 012-2h4a2 2 0 012 2v12a4 4 0 01-4 4zm0 0h12a2 2 0 002-2v-4a2 2 0 00-2-2h-2.343M11 7.343l1.657-1.657a2 2 0 012.828 0l2.829 2.829a2 2 0 010 2.828l-8.486 8.485M7 17h.01'%3E%3C/path%3E%3C/svg%3E");
}

#eraser.active:before {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='white'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16'%3E%3C/path%3E%3C/svg%3E");
}

#pixel-grid {
    display: grid;
    grid-template-columns: repeat(16, 1fr);
    grid-template-rows: repeat(16, 1fr);
    gap: 1px;
    background-color: var(--border-color);
    border: 2px solid var(--border-color);
    border-radius: 8px;
    width: 450px;
    height: 450px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    overflow: hidden;
}

.grid-info {
    margin-top: 10px;
    font-size: 0.9rem;
    color: #64748b;
    font-weight: 500;
}

.pixel {
    background-color: white;
    cursor: pointer;
    transition: transform 0.1s;
}

.pixel:hover {
    transform: scale(1.1);
    z-index: 2;
}

.color-palette {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    padding: 10px;
    background-color: #f1f5f9;
    border-radius: 12px;
}

.color {
    width: 100%;
    height: 30px;
    border-radius: 6px;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all 0.2s;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.color:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.color.selected {
    border-color: var(--text-color);
    transform: scale(1.1);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.2);
}

.actions {
    display: flex;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
}

button {
    padding: 8px 16px;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    font-weight: 500;
    font-size: 0.9rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    gap: 8px;
}

button:before {
    content: '';
    display: inline-block;
    width: 16px;
    height: 16px;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
}

button:hover {
    background-color: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

#clear {
    background-color: var(--secondary-color);
}

#clear:hover {
    background-color: var(--secondary-hover);
}

#clear:before {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='white'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16'%3E%3C/path%3E%3C/svg%3E");
}

#export-png, #export-json {
    background-color: var(--tertiary-color);
}

#export-png:hover, #export-json:hover {
    background-color: var(--tertiary-hover);
}

#export-png:before {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='white'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M4 16l4.586-4.586a2 2 0 012.828 0L16 16m-2-2l1.586-1.586a2 2 0 012.828 0L20 14m-6-6h.01M6 20h12a2 2 0 002-2V6a2 2 0 00-2-2H6a2 2 0 00-2 2v12a2 2 0 002 2z'%3E%3C/path%3E%3C/svg%3E");
}

#export-json:before {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='white'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M4 16v1a3 3 0 003 3h10a3 3 0 003-3v-1m-4-4l-4 4m0 0l-4-4m4 4V4'%3E%3C/path%3E%3C/svg%3E");
}

footer {
    margin-top: 20px;
    text-align: center;
    font-size: 0.9rem;
    color: #64748b;
    padding-top: 15px;
    border-top: 1px solid var(--border-color);
}

footer a {
    color: var(--primary-color);
    text-decoration: none;
    transition: color 0.2s;
    position: relative;
    z-index: 10;
    padding: 2px 5px;
    font-weight: 500;
    cursor: pointer;
    display: inline-block;
}

footer a:hover {
    color: var(--primary-hover);
    text-decoration: underline;
}

.tooltip {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background-color: var(--tooltip-bg);
    color: var(--tooltip-text);
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: 500;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
    z-index: 1000;
    transition: opacity 0.3s;
    font-size: 1rem;
    letter-spacing: 0.5px;
    text-align: center;
    border: 1px solid rgba(255, 255, 255, 0.1);
    max-width: 90%;
    white-space: nowrap;
}

@media (max-width: 900px) {
    .editor {
        grid-template-columns: 1fr;
        grid-template-areas:
            "grid"
            "tools"
            "colors"
            "actions";
    }
    
    #pixel-grid {
        width: 350px;
        height: 350px;
    }
    
    .color-palette {
        grid-template-columns: repeat(8, 1fr);
    }
}

@media (max-width: 500px) {
    .container {
        padding: 15px;
    }
    
    #pixel-grid {
        width: 300px;
        height: 300px;
    }
    
    .tools, .actions {
        flex-direction: column;
        align-items: center;
    }
    
    .tool, button {
        width: 100%;
        justify-content: center;
    }
    
    .color-palette {
        grid-template-columns: repeat(4, 1fr);
    }
} 