/* css/style.css - Main stylesheet */

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

body {
    font-family: 'Arial', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
    overflow-x: hidden;
    touch-action: pan-x pan-y;
}

.container {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
    padding: 30px;
    max-width: 1400px;
    margin: 0 auto;
    animation: fadeIn 0.5s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

h1 {
    text-align: center;
    color: #333;
    margin-bottom: 5px;
    font-size: 3.5em;
    font-family: 'Pixelify Sans', cursive;
    background: linear-gradient(45deg, #667eea, #764ba2);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    font-weight: 700;
}

.subtitle {
    text-align: center;
    color: #666;
    font-size: 1em;
    margin-bottom: 25px;
    font-weight: normal;
}

h3 {
    margin-bottom: 15px;
    color: #667eea;
    font-size: 1.2em;
}

/* Layout */
.main-layout {
    display: flex;
    gap: 30px;
    flex-wrap: wrap;
    justify-content: center;
    align-items: flex-start;
}

.left-panel {
    flex: 1;
    min-width: 300px;
    max-width: 400px;
}

.center-panel {
    flex: 2;
    min-width: 300px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.right-panel {
    flex: 0.7;
    min-width: 280px;
    max-width: 350px;
}

/* Control panel */
.controls {
    background: #f7f7f7;
    padding: 20px;
    border-radius: 15px;
    margin-bottom: 20px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.control-group {
    margin-bottom: 15px;
}

label {
    display: block;
    font-weight: bold;
    color: #555;
    font-size: 0.9em;
    margin-bottom: 5px;
}

/* Form elements */
input[type="file"] {
    display: none;
}

.file-label {
    background: linear-gradient(45deg, #667eea, #764ba2);
    color: white;
    padding: 12px 24px;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-block;
    font-weight: bold;
    text-align: center;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
    width: 100%;
}

.file-label:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.6);
}

input[type="range"] {
    width: 100%;
    -webkit-appearance: none;
    height: 8px;
    border-radius: 5px;
    background: #ddd;
    outline: none;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #667eea;
    cursor: pointer;
    transition: all 0.3s ease;
}

input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.2);
    background: #764ba2;
}

.value-display {
    text-align: center;
    font-weight: bold;
    color: #667eea;
    font-size: 0.9em;
    margin-top: 5px;
}

select {
    width: 100%;
    padding: 8px 15px;
    border-radius: 25px;
    border: 2px solid #ddd;
    background: white;
    cursor: pointer;
    font-size: 0.9em;
    transition: all 0.3s ease;
}

select:hover {
    border-color: #667eea;
}

input[type="color"] {
    width: 50px;
    height: 50px;
    border: none;
    border-radius: 10px;
    cursor: pointer;
}

/* Buttons */
button {
    background: linear-gradient(45deg, #4facfe, #00f2fe);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 50px;
    cursor: pointer;
    font-weight: bold;
    font-size: 0.9em;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(79, 172, 254, 0.4);
    width: 100%;
    margin: 5px 0;
    -webkit-user-select: none;
    user-select: none;
}

button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(79, 172, 254, 0.6);
}

button:active {
    transform: translateY(0);
}

.process-button {
    background: linear-gradient(45deg, #fa709a, #fee140);
    box-shadow: 0 4px 15px rgba(250, 112, 154, 0.4);
}

.process-button:hover {
    box-shadow: 0 6px 20px rgba(250, 112, 154, 0.6);
}

/* Toolbar */
.toolbar {
    background: #f0f4ff;
    padding: 20px;
    border-radius: 15px;
    margin-bottom: 20px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    width: 100%;
}

.tool-buttons {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-bottom: 15px;
}

.tool-button {
    background: white;
    color: #667eea;
    border: 2px solid #667eea;
    padding: 12px;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 1em;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    -webkit-user-select: none;
    user-select: none;
}

.tool-button:hover {
    background: #667eea;
    color: white;
}

.tool-button.active {
    background: #667eea;
    color: white;
    transform: scale(1.05);
}

.tool-button i {
    font-size: 1.2em;
}

.color-picker-wrapper {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Canvas */
.canvas-container {
    position: relative;
    background: white;
    padding: 10px;
    border-radius: 10px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1);
    display: inline-block;
    margin-bottom: 20px;
    overflow: hidden;
    width: auto;
    max-width: 100%;
    touch-action: none;
}

.canvas-wrapper {
    position: relative;
    cursor: crosshair;
    overflow: auto;
    max-height: 600px;
    min-height: 200px;
    display: flex;
    background: #f5f5f5;
    border-radius: 5px;
    touch-action: none;
    -webkit-overflow-scrolling: touch;
}

.canvas-inner {
    position: relative;
    display: block;
    flex-shrink: 0;
}

canvas {
    border: 2px solid #eee;
    border-radius: 5px;
    image-rendering: pixelated;
    image-rendering: -moz-crisp-edges;
    image-rendering: crisp-edges;
    display: block;
    max-width: none;
    height: auto;
    touch-action: none;
}

/* Zoom controls */
.zoom-controls {
    background: #f0f4ff;
    padding: 15px;
    border-radius: 15px;
    margin-bottom: 20px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
}

.zoom-button {
    width: 40px;
    height: 40px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2em;
}

.zoom-display {
    font-weight: bold;
    color: #667eea;
    min-width: 60px;
    text-align: center;
}

/* Layer panel */
.layers-panel {
    background: #f7f7f7;
    padding: 20px;
    border-radius: 15px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.layer-item {
    background: white;
    padding: 10px;
    border-radius: 10px;
    margin-bottom: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.layer-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    width: 100%;
}

.layer-item.editable {
    background: #e8f4ff;
    border: 2px solid #667eea;
}

.layer-item.editable:hover {
    background: #d0e8ff;
}

.layer-item.editable.active {
    background: #667eea;
    color: white;
}

.layer-item.tool-highlight {
    background: #ffe4b5;
    border: 2px solid #ff8c00;
}

.layer-item.tool-highlight:hover {
    background: #ffd4a0;
}

.layer-name {
    flex: 1;
    font-size: 0.9em;
}

.layer-controls {
    display: flex;
    align-items: center;
    gap: 5px;
}

.layer-visibility {
    width: 30px;
    height: 30px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1em;
    display: flex;
    align-items: center;
    justify-content: center;
}

.layer-opacity {
    width: 70px;
}

/* History buttons */
.history-buttons {
    display: flex;
    gap: 10px;
    margin-top: 15px;
}

.history-button {
    flex: 1;
    background: #e0e0e0;
    color: #666;
    box-shadow: none;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
}

.history-button:hover:not(:disabled) {
    background: #667eea;
    color: white;
}

.history-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Other UI elements */
.loading {
    display: none;
    text-align: center;
    margin: 20px 0;
}

.spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid #667eea;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
    margin: 0 auto;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.instructions {
    background: #f0f4ff;
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 20px;
    border-left: 4px solid #667eea;
}

.instructions h4 {
    color: #667eea;
    margin-bottom: 10px;
}

.instructions ul {
    list-style: none;
    padding-left: 0;
}

.instructions li {
    margin: 8px 0;
    color: #555;
    font-size: 0.9em;
}

.instructions li:before {
    content: "▸ ";
    color: #667eea;
    font-weight: bold;
}

.brush-size-preview {
    width: 40px;
    height: 40px;
    border: 2px solid #667eea;
    border-radius: 5px;
    margin: 10px auto 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: white;
}

.brush-preview-dot {
    background: #667eea;
    border-radius: 2px;
}

/* Touch gesture indicator */
.touch-indicator {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(102, 126, 234, 0.8);
    color: white;
    padding: 10px 20px;
    border-radius: 20px;
    font-size: 14px;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 10000;
}

.touch-indicator.show {
    opacity: 1;
}

/* Footer */
.footer {
    text-align: center;
    padding: 20px;
    margin-top: 40px;
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.9em;
}

.footer p {
    color: rgba(255, 255, 255, 0.9);
}

/* Footer link styles */
.footer a {
    color: rgba(255, 255, 255, 0.9); /* Match normal color with footer text */
    transition: color 0.3s ease;      /* Smooth color change on hover */
}

.footer a:hover {
    color: rgba(255, 255, 255, 0.7); /* Slightly grayed on hover */
}

/* Help button */
.help-button {
    position: fixed;
    top: 30px;
    right: 30px;
    width: 50px;
    height: 50px;
    background: linear-gradient(45deg, #4facfe, #00f2fe);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    text-decoration: none;
    font-size: 1.5em;
    box-shadow: 0 4px 15px rgba(79, 172, 254, 0.4);
    transition: all 0.3s ease;
    z-index: 1000;
    animation: float 3s ease-in-out infinite;
}

.help-button:hover {
    transform: translateY(-5px) scale(1.1);
    box-shadow: 0 8px 25px rgba(79, 172, 254, 0.6);
}

@keyframes float {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-10px); }
}

/* Touch device support */
@media (hover: none) {
    .tool-button:active {
        background: #667eea;
        color: white;
    }

    button:active {
        transform: translateY(0);
    }
}