/* WebGIF Editor - Retro 90s Styling */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: "MS Sans Serif", Arial, sans-serif;
    font-size: 12px;
    background-color: #c0c0c0;
    color: #000;
    overflow-x: auto;
}

.header {
    background: linear-gradient(to bottom, #000080, #000060);
    color: #fff;
    padding: 8px 16px;
    border-bottom: 2px solid #808080;
}

.title {
    font-size: 18px;
    font-weight: bold;
    margin: 0;
}

.subtitle {
    font-style: italic;
    font-size: 11px;
    margin: 2px 0 0 0;
    opacity: 0.9;
}

.main-container {
    display: flex;
    min-height: calc(100vh - 60px);
    background-color: #c0c0c0;
}

/* Retro Button Styling */
.btn, .tool-btn {
    background: linear-gradient(to bottom, #f0f0f0 0%, #e0e0e0 50%, #d0d0d0 100%);
    border: 1px outset #c0c0c0;
    border-width: 2px;
    padding: 4px 8px;
    font-family: inherit;
    font-size: 11px;
    cursor: pointer;
    color: #000;
}

.btn:hover, .tool-btn:hover {
    background: linear-gradient(to bottom, #f8f8f8 0%, #e8e8e8 50%, #d8d8d8 100%);
}

.btn:active, .tool-btn:active, .tool-btn.active {
    border: 1px inset #c0c0c0;
    border-width: 2px;
    background: linear-gradient(to bottom, #d0d0d0 0%, #e0e0e0 50%, #f0f0f0 100%);
}

/* Toolbar */
.toolbar {
    width: 100px;
    background-color: #c0c0c0;
    border-right: 2px solid #808080;
    padding: 8px;
}

.tool-group {
    margin-bottom: 8px;
    border: 1px inset #c0c0c0;
    border-width: 2px;
    padding: 4px;
}

.tool-btn {
    width: 32px;
    height: 32px;
    margin: 2px;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.tool-btn img {
    width: 20px;
    height: 20px;
    object-fit: contain;
}

.tool-settings {
    margin-top: 16px;
    padding: 4px;
    border: 1px inset #c0c0c0;
    border-width: 2px;
}

.tool-settings label {
    display: block;
    margin-bottom: 4px;
    font-weight: bold;
}

.tool-settings input[type="range"] {
    width: 100%;
    margin-bottom: 4px;
}

#brushSizeValue {
    font-weight: bold;
    color: #000080;
}

/* Canvas Area */
.canvas-area {
    flex: 1;
    padding: 16px;
    background-color: #f0f0f0;
}

.canvas-controls {
    margin-bottom: 16px;
    padding: 8px;
    background-color: #e0e0e0;
    border: 1px inset #c0c0c0;
    border-width: 2px;
}

.canvas-controls label {
    margin-right: 8px;
    font-weight: bold;
}

.canvas-controls select, .canvas-controls .btn {
    margin-right: 12px;
}

.canvas-container {
    position: relative;
    display: inline-block;
    border: 2px inset #808080;
    background: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAYAAACNMs+9AAAAKklEQVQoU2NhYGAwPnz4MCOyABbFinEhY1QhTgAXCDMAAP//Y2BgYAACABANAU3k9nIoAAAAAElFTkSuQmCC') repeat;
}

#canvas, #gridCanvas {
    display: block;
    background-color: #fff;
}

#gridCanvas {
    position: absolute;
    top: 0;
    left: 0;
    pointer-events: none;
}

/* Right Panel */
.right-panel {
    width: 280px;
    background-color: #c0c0c0;
    border-left: 2px solid #808080;
    overflow-y: auto;
}

.panel {
    margin: 8px;
    border: 1px outset #c0c0c0;
    border-width: 2px;
    background-color: #f0f0f0;
}

.panel h3 {
    background: linear-gradient(to bottom, #000080, #000060);
    color: #fff;
    padding: 4px 8px;
    margin: 0;
    font-size: 12px;
    font-weight: bold;
}

.panel > div {
    padding: 8px;
}

/* Color Panel */
.current-colors {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}

.color-swatch {
    width: 40px;
    height: 40px;
    border: 2px inset #c0c0c0;
    cursor: pointer;
}

.foreground {
    background-color: #000;
    z-index: 2;
}

.background {
    background-color: #fff;
    z-index: 1;
}

.web-safe-palette {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 2px;
    margin: 8px 0;
    max-height: 150px;
    overflow-y: auto;
    border: 1px inset #c0c0c0;
    padding: 4px;
}

.color-cell {
    width: 16px;
    height: 16px;
    border: 1px solid #000;
    cursor: pointer;
}

.color-cell:hover {
    border: 2px solid #fff;
    margin: -1px;
}

/* Animation Panel */
.frame-controls {
    display: flex;
    gap: 4px;
    margin-bottom: 8px;
}

.frame-controls .btn {
    flex: 1;
    padding: 6px 4px;
}

.timeline {
    display: flex;
    gap: 4px;
    margin-bottom: 12px;
    padding: 8px;
    background-color: #fff;
    border: 1px inset #c0c0c0;
    border-width: 2px;
    overflow-x: auto;
}

.frame-thumb {
    text-align: center;
    cursor: pointer;
    padding: 4px;
    border: 2px solid transparent;
    min-width: 48px;
}

.frame-thumb.active {
    border: 2px solid #000080;
    background-color: #e0e0ff;
}

.frame-thumb canvas {
    display: block;
    border: 1px solid #808080;
    margin-bottom: 2px;
}

.frame-thumb span {
    font-size: 10px;
    font-weight: bold;
}

.animation-settings label {
    display: block;
    margin: 8px 0 4px 0;
    font-weight: bold;
}

.animation-settings input, .animation-settings select {
    width: 100%;
    margin-bottom: 8px;
    padding: 2px;
}

.playback-controls {
    display: flex;
    gap: 4px;
}

.playback-controls .btn {
    flex: 1;
    padding: 8px 4px;
    font-weight: bold;
}

/* Export Panel */
.export-panel .btn {
    width: 100%;
    margin-bottom: 8px;
    padding: 8px;
    font-weight: bold;
}

.file-info {
    font-size: 11px;
    color: #606060;
    font-style: italic;
}

/* Status Bar */
.status-bar {
    background-color: #c0c0c0;
    border-top: 1px solid #808080;
    padding: 4px 8px;
    display: flex;
    justify-content: space-between;
    font-size: 11px;
}

.status-bar span {
    padding: 2px 8px;
    border: 1px inset #c0c0c0;
    background-color: #f0f0f0;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .main-container {
        flex-direction: column;
    }
    
    .toolbar {
        width: 100%;
        display: flex;
        padding: 4px;
    }
    
    .tool-group {
        display: flex;
        margin-right: 8px;
    }
    
    .right-panel {
        width: 100%;
    }
    
    .status-bar {
        flex-wrap: wrap;
        gap: 4px;
    }
}

@media (max-width: 768px) {
    .canvas-controls {
        flex-wrap: wrap;
    }
    
    .canvas-controls .btn, .canvas-controls select {
        margin-bottom: 8px;
    }
    
    .tool-btn {
        width: 28px;
        height: 28px;
    }
    
    .frame-controls .btn {
        font-size: 10px;
        padding: 4px 2px;
    }
}

/* Classic tooltip styling */
[title]:hover::after {
    content: attr(title);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background-color: #ffffe1;
    border: 1px solid #000;
    padding: 2px 6px;
    font-size: 11px;
    white-space: nowrap;
    z-index: 1000;
    pointer-events: none;
}

/* Input styling */
input[type="color"] {
    width: 100%;
    height: 32px;
    border: 2px inset #c0c0c0;
    background-color: #fff;
    cursor: pointer;
}

input[type="number"], input[type="range"], select {
    border: 1px inset #c0c0c0;
    border-width: 2px;
    padding: 2px 4px;
    background-color: #fff;
    font-family: inherit;
    font-size: 11px;
}

select {
    cursor: pointer;
}

/* Scrollbar styling for webkit browsers */
::-webkit-scrollbar {
    width: 16px;
    height: 16px;
}

::-webkit-scrollbar-track {
    background-color: #c0c0c0;
    border: 1px inset #c0c0c0;
}

::-webkit-scrollbar-thumb {
    background-color: #e0e0e0;
    border: 1px outset #c0c0c0;
}

::-webkit-scrollbar-thumb:hover {
    background-color: #f0f0f0;
}

::-webkit-scrollbar-corner {
    background-color: #c0c0c0;
}