/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
    line-height: 1.6;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

/* Header */
.header {
    text-align: center;
    margin-bottom: 30px;
    color: white;
}

.header h1 {
    font-size: 3rem;
    font-weight: 700;
    margin-bottom: 10px;
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.header p {
    font-size: 1.2rem;
    opacity: 0.9;
    font-weight: 300;
}

/* Main Content */
.main-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-gap: 20px;
    margin-bottom: 30px;
}

/* Panels */
.config-panel,
.status-panel,
.console-panel,
.images-panel {
    background: white;
    border-radius: 12px;
    padding: 25px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.1);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255,255,255,0.2);
}

.config-panel {
    grid-column: 1;
}

.status-panel {
    grid-column: 2;
}

.console-panel,
.images-panel {
    grid-column: 1 / -1;
}

/* Typography */
h2, h3 {
    color: #2d3748;
    margin-bottom: 20px;
    font-weight: 600;
}

h2 {
    font-size: 1.5rem;
    border-bottom: 2px solid #e2e8f0;
    padding-bottom: 10px;
}

h3 {
    font-size: 1.25rem;
}

/* Input Groups */
.input-group {
    margin-bottom: 20px;
}

.input-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #4a5568;
}

.input-group input,
.input-group select {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.3s ease;
    background: white;
}

.input-group input:focus,
.input-group select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.input-group small {
    display: block;
    margin-top: 5px;
    color: #718096;
    font-size: 12px;
}

/* Buttons */
.button-group {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.3);
}

.btn-secondary {
    background: #f7fafc;
    color: #4a5568;
    border: 2px solid #e2e8f0;
}

.btn-secondary:hover {
    background: #edf2f7;
    border-color: #cbd5e0;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
}

/* Status Panel */
.status-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
    margin-bottom: 20px;
}

.status-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    background: #f7fafc;
    border-radius: 6px;
    border-left: 4px solid #667eea;
}

.status-label {
    font-weight: 500;
    color: #4a5568;
}

.status-value {
    font-weight: 700;
    color: #2d3748;
    font-size: 1.1rem;
}

/* Progress Bar */
.progress-bar {
    width: 100%;
    height: 8px;
    background: #e2e8f0;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 15px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #667eea, #764ba2);
    width: 0%;
    transition: width 0.3s ease;
}

.status-message {
    text-align: center;
    color: #4a5568;
    font-weight: 500;
    padding: 10px;
    background: #f7fafc;
    border-radius: 6px;
}

/* Console Panel */
.console-output {
    background: #1a202c;
    color: #e2e8f0;
    padding: 20px;
    border-radius: 8px;
    height: 300px;
    overflow-y: auto;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 13px;
    line-height: 1.4;
    border: 2px solid #2d3748;
}

.console-output::-webkit-scrollbar {
    width: 8px;
}

.console-output::-webkit-scrollbar-track {
    background: #2d3748;
}

.console-output::-webkit-scrollbar-thumb {
    background: #4a5568;
    border-radius: 4px;
}

.log-entry {
    margin-bottom: 8px;
    padding: 4px 0;
}

.log-timestamp {
    color: #68d391;
    font-weight: 500;
}

.log-info {
    color: #63b3ed;
}

.log-success {
    color: #68d391;
}

.log-warning {
    color: #f6e05e;
}

.log-error {
    color: #fc8181;
}

.log-debug {
    color: #a0aec0;
}

/* Images Panel */
.image-controls {
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.image-controls label {
    font-weight: 500;
    color: #4a5568;
}

.image-controls select {
    padding: 8px 12px;
    border: 2px solid #e2e8f0;
    border-radius: 6px;
    background: white;
}

.image-grid {
    display: grid;
    gap: 20px;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
}

.image-grid.small {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
}

.image-grid.large {
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
}

.image-item {
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    transition: transform 0.3s ease;
}

.image-item:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
}

.image-item img {
    width: 100%;
    height: 200px;
    object-fit: cover;
    display: block;
}

.image-grid.small .image-item img {
    height: 120px;
}

.image-grid.large .image-item img {
    height: 280px;
}

.image-info {
    padding: 15px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.image-name {
    font-weight: 600;
    color: #2d3748;
    font-size: 14px;
}

.image-status {
    font-size: 12px;
    padding: 4px 8px;
    border-radius: 4px;
    display: inline-block;
    align-self: flex-start;
}

.image-size {
    font-size: 11px;
    color: #718096;
    font-weight: 500;
}

.download-container {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 8px;
}

.download-link {
    font-size: 11px;
    color: #667eea;
    text-decoration: none;
    font-weight: 500;
    padding: 6px 8px;
    background: #f7fafc;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    transition: all 0.2s ease;
    text-align: center;
    min-width: 0;
    flex-shrink: 0;
}

.download-link:hover {
    background: #edf2f7;
    border-color: #667eea;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(102, 126, 234, 0.1);
}

/* Quality-specific styling */
.download-container .download-link:nth-child(1) {
    border-color: #48bb78;
    color: #2f855a;
}

.download-container .download-link:nth-child(1):hover {
    border-color: #48bb78;
    background: #f0fff4;
}

.download-container .download-link:nth-child(2) {
    border-color: #ed8936;
    color: #c05621;
}

.download-container .download-link:nth-child(2):hover {
    border-color: #ed8936;
    background: #fffaf0;
}

.download-container .download-link:nth-child(3) {
    border-color: #e53e3e;
    color: #c53030;
}

.download-container .download-link:nth-child(3):hover {
    border-color: #e53e3e;
    background: #fff5f5;
}

.status-cached {
    background: #c6f6d5;
    color: #22543d;
}

.status-downloaded {
    background: #bee3f8;
    color: #2a4365;
}

.status-failed {
    background: #fed7d7;
    color: #742a2a;
}

/* Responsive Design */
@media (max-width: 768px) {
    .main-content {
        grid-template-columns: 1fr;
    }
    
    .config-panel,
    .status-panel {
        grid-column: 1;
    }
    
    .button-group {
        flex-direction: column;
    }
    
    .status-grid {
        grid-template-columns: 1fr;
    }
    
    .header h1 {
        font-size: 2rem;
    }
    
    .image-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    }
}

@media (max-width: 480px) {
    .container {
        padding: 15px;
    }
    
    .config-panel,
    .status-panel,
    .console-panel,
    .images-panel {
        padding: 20px;
    }
    
    .image-grid {
        grid-template-columns: 1fr;
    }
}

/* Loading Animation */
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid #ffffff;
    border-radius: 50%;
    border-top-color: transparent;
    animation: spin 1s ease-in-out infinite;
}
