/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: #333;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* Header */
header {
    text-align: center;
    margin-bottom: 40px;
    color: white;
}

header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

header p {
    font-size: 1.1rem;
    opacity: 0.9;
}

/* Upload section */
.upload-section {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 20px;
    margin: 20px 0;
    text-align: center;
}

.upload-section h2 {
    margin-top: 0;
    color: #495057;
    margin-bottom: 15px;
}

.upload-controls {
    display: flex;
    gap: 10px;
    align-items: center;
    justify-content: center;
    margin-bottom: 15px;
    flex-wrap: wrap;
}

.upload-controls input[type="file"] {
    flex: 1;
    max-width: 300px;
    padding: 8px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    background: white;
}

.upload-info {
    color: #6c757d;
    font-size: 0.9rem;
    line-height: 1.4;
}

/* Main content */
main {
    background: white;
    border-radius: 15px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.1);
    overflow: hidden;
}

/* Input section */
.input-section {
    padding: 30px;
    border-bottom: 1px solid #eee;
}

.input-section h2 {
    margin-bottom: 20px;
    color: #2c3e50;
    font-size: 1.5rem;
}

/* Format tabs */
.format-tabs {
    display: flex;
    margin-bottom: 25px;
    background: #f8f9fa;
    border-radius: 10px;
    padding: 5px;
}

.tab-btn {
    flex: 1;
    padding: 12px 20px;
    border: none;
    background: transparent;
    cursor: pointer;
    border-radius: 8px;
    font-weight: 500;
    transition: all 0.3s ease;
    color: #6c757d;
}

.tab-btn.active {
    background: #667eea;
    color: white;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.tab-btn:hover:not(.active) {
    background: #e9ecef;
}

/* Input areas */
.input-container {
    margin-bottom: 25px;
}

.input-area {
    display: none;
}

.input-area.active {
    display: block;
}

.input-area label {
    display: block;
    margin-bottom: 10px;
    font-weight: 600;
    color: #495057;
}

.input-area textarea {
    width: 100%;
    min-height: 120px;
    padding: 15px;
    border: 2px solid #e9ecef;
    border-radius: 10px;
    font-family: 'Courier New', monospace;
    font-size: 14px;
    resize: vertical;
    transition: border-color 0.3s ease;
}

.input-area textarea:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* Palette preview */
.palette-preview {
    margin-top: 15px;
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 8px;
    max-width: 400px;
}

.color-swatch {
    width: 100%;
    aspect-ratio: 1;
    border-radius: 6px;
    border: 2px solid #fff;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    cursor: pointer;
    transition: transform 0.2s ease;
}

.color-swatch:hover {
    transform: scale(1.1);
}

/* Convert button */
.convert-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 15px 30px;
    font-size: 1.1rem;
    font-weight: 600;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
    margin-bottom: 20px;
}

/* Help text */
.help-text {
    background: #f8f9fa;
    border-radius: 10px;
    padding: 20px;
    margin-top: 20px;
    border-left: 4px solid #667eea;
}

.help-text p {
    margin-bottom: 15px;
    color: #495057;
    font-weight: 600;
}

.help-text ul {
    margin-left: 20px;
    color: #6c757d;
}

.help-text li {
    margin-bottom: 8px;
    line-height: 1.4;
}

.warning-note {
    background: #fff3cd;
    border: 1px solid #ffeaa7;
    color: #856404;
    padding: 10px;
    border-radius: 5px;
    margin-top: 10px;
    font-size: 0.9rem;
    line-height: 1.4;
}

.info-note {
    background: #d1ecf1;
    border: 1px solid #bee5eb;
    color: #0c5460;
    padding: 10px;
    border-radius: 5px;
    margin-top: 10px;
    font-size: 0.9rem;
    line-height: 1.4;
}

.conversion-message {
    padding: 10px;
    border-radius: 5px;
    margin-top: 10px;
    font-weight: 500;
    text-align: center;
}

.conversion-message.success {
    background: #d4edda;
    border: 1px solid #c3e6cb;
    color: #155724;
}

.conversion-message.error {
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    color: #721c24;
}

.conversion-message.info {
    background: #d1ecf1;
    border: 1px solid #bee5eb;
    color: #0c5460;
}

.convert-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

/* Secondary conversion buttons */
.convert-btn.secondary {
    background: linear-gradient(135deg, #6c757d 0%, #495057 100%);
    box-shadow: 0 4px 15px rgba(108, 117, 125, 0.3);
    font-size: 0.9rem;
    padding: 10px 20px;
    margin-top: 10px;
}

.convert-btn.secondary:hover {
    background: linear-gradient(135deg, #5a6268 0%, #343a40 100%);
    box-shadow: 0 6px 20px rgba(108, 117, 125, 0.4);
}

.conversion-controls {
    margin-top: 15px;
    text-align: center;
}

/* Conversion messages */
.conversion-message {
    margin-top: 15px;
    padding: 10px 15px;
    border-radius: 5px;
    text-align: center;
    font-weight: 500;
    animation: slideIn 0.3s ease-out;
}

.conversion-message.success {
    background: #d4edda;
    border: 1px solid #c3e6cb;
    color: #155724;
}

.conversion-message.info {
    background: #d1ecf1;
    border: 1px solid #bee5eb;
    color: #0c5460;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.convert-btn:active {
    transform: translateY(0);
}

/* Output section */
.output-section {
    padding: 30px;
}

.output-section h2 {
    margin-bottom: 20px;
    color: #2c3e50;
    font-size: 1.5rem;
}

/* TLP preview */
.tlp-preview {
    background: #f8f9fa;
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 25px;
}

.tlp-preview h3 {
    margin-bottom: 15px;
    color: #495057;
}

.format-note {
    background: #fff3cd;
    border: 1px solid #ffeaa7;
    color: #856404;
    padding: 10px;
    border-radius: 5px;
    margin-bottom: 15px;
    font-size: 0.9rem;
}

.tlp-preview pre {
    background: #2d3748;
    color: #e2e8f0;
    padding: 20px;
    border-radius: 8px;
    overflow-x: auto;
    font-family: 'Courier New', monospace;
    font-size: 13px;
    line-height: 1.4;
}

/* Download section */
.download-section {
    text-align: center;
    margin-bottom: 30px;
    padding: 20px;
    background: #e8f5e8;
    border-radius: 10px;
    border: 2px solid #4caf50;
}

.download-btn {
    background: #4caf50;
    color: white;
    border: none;
    padding: 15px 30px;
    font-size: 1.1rem;
    font-weight: 600;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-bottom: 15px;
}

.download-btn:hover {
    background: #45a049;
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(76, 175, 80, 0.3);
}

.filename-info {
    display: block;
    color: #2e7d32;
    font-size: 0.9rem;
}

.filename-info code {
    background: #c8e6c9;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: monospace;
}

/* Palette comparison */
.palette-comparison {
    margin-top: 30px;
}

.palette-comparison h3 {
    margin-bottom: 20px;
    color: #495057;
    text-align: center;
}

.comparison-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
}

.original-palette,
.converted-palette {
    text-align: center;
}

.original-palette h4,
.converted-palette h4 {
    margin-bottom: 15px;
    color: #6c757d;
    font-size: 1.1rem;
}

.comparison-colors {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    max-width: 200px;
    margin: 0 auto;
}

.comparison-swatch {
    width: 100%;
    aspect-ratio: 1;
    border-radius: 6px;
    border: 2px solid #fff;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* Footer */
footer {
    text-align: center;
    margin-top: 40px;
    color: white;
    opacity: 0.8;
}

/* Responsive design */
@media (max-width: 768px) {
    .container {
        padding: 15px;
    }
    
    header h1 {
        font-size: 2rem;
    }
    
    .input-section,
    .output-section {
        padding: 20px;
    }
    
    .format-tabs {
        flex-direction: column;
    }
    
    .tab-btn {
        margin-bottom: 5px;
    }
    
    .comparison-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .palette-preview {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media (max-width: 480px) {
    .palette-preview {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .comparison-colors {
        grid-template-columns: repeat(2, 1fr);
    }
}
