/* Magicrills Image Resizer - Advanced Styles */
:root {
    /* Light Theme */
    --primary-color: #6366f1;
    --primary-dark: #4f46e5;
    --secondary-color: #f59e0b;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --error-color: #ef4444;
    
    --bg-primary: #ffffff;
    --bg-secondary: #f8fafc;
    --bg-card: #ffffff;
    --bg-hover: #f1f5f9;
    
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    
    --border-color: #e2e8f0;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    
    --gradient-primary: linear-gradient(135deg, #6366f1, #8b5cf6);
    --gradient-success: linear-gradient(135deg, #10b981, #34d399);
}

[data-theme="dark"] {
    --primary-color: #818cf8;
    --primary-dark: #6366f1;
    --secondary-color: #fbbf24;
    --success-color: #34d399;
    --warning-color: #fbbf24;
    --error-color: #f87171;
    
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-card: #1e293b;
    --bg-hover: #334155;
    
    --text-primary: #f1f5f9;
    --text-secondary: #cbd5e1;
    --text-muted: #64748b;
    
    --border-color: #334155;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3), 0 2px 4px -1px rgba(0, 0, 0, 0.2);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.3), 0 4px 6px -2px rgba(0, 0, 0, 0.2);
}

/* Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    transition: all 0.3s ease;
}

.magicrills-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
}

/* Header Styles */
.magicrills-header {
    text-align: center;
    margin-bottom: 40px;
    padding: 40px 20px;
    background: var(--gradient-primary);
    border-radius: 20px;
    color: white;
    position: relative;
    overflow: hidden;
}

.magicrills-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><pattern id="grain" width="100" height="100" patternUnits="userSpaceOnUse"><circle cx="50" cy="50" r="1" fill="white" opacity="0.1"/></pattern></defs><rect width="100" height="100" fill="url(%23grain)"/></svg>');
    opacity: 0.3;
}

.magicrills-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    margin-bottom: 10px;
}

.magicrills-logo-icon {
    font-size: 2.5rem;
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-10px); }
}

.magicrills-logo h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin: 0;
}

.magicrills-tagline {
    font-size: 1.2rem;
    opacity: 0.9;
    margin-bottom: 20px;
}

.theme-toggle {
    position: absolute;
    top: 20px;
    right: 20px;
}

.theme-btn {
    background: rgba(255, 255, 255, 0.2);
    border: 2px solid rgba(255, 255, 255, 0.3);
    color: white;
    padding: 8px 16px;
    border-radius: 25px;
    cursor: pointer;
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
}

.theme-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
}

/* Dashboard Layout */
.magicrills-dashboard {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    margin-bottom: 40px;
}

@media (max-width: 1024px) {
    .magicrills-dashboard {
        grid-template-columns: 1fr;
    }
}

/* Section Headers */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 2px solid var(--border-color);
}

.section-header h2 {
    font-size: 1.5rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
}

.file-counter, .results-stats {
    background: var(--primary-color);
    color: white;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 600;
}

/* Upload Section */
.magicrills-upload-section {
    background: var(--bg-card);
    padding: 30px;
    border-radius: 15px;
    box-shadow: var(--shadow);
    border: 2px solid var(--border-color);
}

.magicrills-drag-area {
    border: 3px dashed var(--primary-color);
    border-radius: 15px;
    padding: 50px 20px;
    text-align: center;
    transition: all 0.3s ease;
    background: var(--bg-secondary);
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.magicrills-drag-area::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(99, 102, 241, 0.1), transparent);
    transition: left 0.5s;
}

.magicrills-drag-area:hover::before {
    left: 100%;
}

.magicrills-drag-area.active {
    border-color: var(--success-color);
    background: rgba(16, 185, 129, 0.05);
}

.upload-icon {
    font-size: 4rem;
    margin-bottom: 15px;
    opacity: 0.7;
}

.drag-content h3 {
    font-size: 1.4rem;
    margin-bottom: 10px;
    color: var(--text-primary);
}

.drag-content p {
    color: var(--text-secondary);
    margin-bottom: 20px;
}

/* File List */
.magicrills-file-list {
    margin-top: 20px;
}

.file-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 15px;
    background: var(--bg-secondary);
    border-radius: 10px;
    margin-bottom: 10px;
    border: 1px solid var(--border-color);
    transition: all 0.3s ease;
}

.file-item:hover {
    transform: translateX(5px);
    box-shadow: var(--shadow);
}

.file-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.file-icon {
    font-size: 1.5rem;
    opacity: 0.7;
}

.file-details h4 {
    font-weight: 600;
    margin-bottom: 2px;
}

.file-details span {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.file-remove {
    background: var(--error-color);
    color: white;
    border: none;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.file-remove:hover {
    transform: scale(1.1);
}

/* Options Section */
.magicrills-options-section {
    background: var(--bg-card);
    padding: 30px;
    border-radius: 15px;
    box-shadow: var(--shadow);
    border: 2px solid var(--border-color);
}

.magicrills-option-group {
    margin-bottom: 25px;
}

.magicrills-label {
    display: block;
    font-weight: 600;
    margin-bottom: 10px;
    color: var(--text-primary);
    font-size: 1rem;
}

/* Radio Buttons */
.magicrills-radio-group {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.magicrills-radio {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 15px;
    background: var(--bg-secondary);
    border: 2px solid var(--border-color);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}

.magicrills-radio:hover {
    border-color: var(--primary-color);
    transform: translateY(-2px);
}

.magicrills-radio input[type="radio"] {
    display: none;
}

.radio-custom {
    width: 18px;
    height: 18px;
    border: 2px solid var(--border-color);
    border-radius: 50%;
    position: relative;
    transition: all 0.3s ease;
}

.magicrills-radio input[type="radio"]:checked + .radio-custom {
    border-color: var(--primary-color);
    background: var(--primary-color);
}

.magicrills-radio input[type="radio"]:checked + .radio-custom::after {
    content: '';
    width: 8px;
    height: 8px;
    background: white;
    border-radius: 50%;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

/* Range Sliders */
.magicrills-range-container {
    position: relative;
}

.magicrills-range {
    width: 100%;
    height: 8px;
    border-radius: 10px;
    background: var(--bg-secondary);
    outline: none;
    -webkit-appearance: none;
}

.magicrills-range::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--primary-color);
    cursor: pointer;
    border: 3px solid white;
    box-shadow: var(--shadow);
    transition: all 0.3s ease;
}

.magicrills-range::-webkit-slider-thumb:hover {
    transform: scale(1.2);
    background: var(--primary-dark);
}

.range-ticks, .range-labels {
    display: flex;
    justify-content: space-between;
    margin-top: 8px;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

/* Input Groups */
.dimensions-inputs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.input-group {
    display: flex;
    flex-direction: column;
}

.input-group label {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 5px;
}

.magicrills-input {
    padding: 12px 15px;
    border: 2px solid var(--border-color);
    border-radius: 10px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 1rem;
    transition: all 0.3s ease;
}

.magicrills-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

/* Checkbox */
.magicrills-checkbox {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    padding: 10px 0;
}

.magicrills-checkbox input[type="checkbox"] {
    display: none;
}

.checkmark {
    width: 20px;
    height: 20px;
    border: 2px solid var(--border-color);
    border-radius: 5px;
    position: relative;
    transition: all 0.3s ease;
}

.magicrills-checkbox input[type="checkbox"]:checked + .checkmark {
    background: var(--primary-color);
    border-color: var(--primary-color);
}

.magicrills-checkbox input[type="checkbox"]:checked + .checkmark::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 12px;
    font-weight: bold;
}

/* Tooltip */
.magicrills-tooltip {
    position: relative;
    display: inline-block;
    margin-left: 5px;
    cursor: help;
}

.tooltip-text {
    visibility: hidden;
    width: 200px;
    background: var(--text-primary);
    color: var(--bg-primary);
    text-align: center;
    border-radius: 6px;
    padding: 8px;
    position: absolute;
    z-index: 1000;
    bottom: 125%;
    left: 50%;
    transform: translateX(-50%);
    opacity: 0;
    transition: opacity 0.3s;
    font-size: 0.8rem;
    font-weight: normal;
}

.magicrills-tooltip:hover .tooltip-text {
    visibility: visible;
    opacity: 1;
}

/* Advanced Options */
.magicrills-advanced-toggle {
    margin: 25px 0;
    text-align: center;
}

.magicrills-advanced-options {
    border-top: 2px solid var(--border-color);
    padding-top: 25px;
    margin-top: 25px;
}

/* Format Grid */
.magicrills-format-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
}

.format-option input[type="radio"] {
    display: none;
}

.format-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 15px 10px;
    background: var(--bg-secondary);
    border: 2px solid var(--border-color);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
}

.format-option input[type="radio"]:checked + .format-card {
    border-color: var(--primary-color);
    background: rgba(99, 102, 241, 0.1);
    transform: translateY(-2px);
}

.format-card:hover {
    border-color: var(--primary-color);
    transform: translateY(-2px);
}

.format-icon {
    font-size: 1.5rem;
}

/* Position Grid */
.position-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 10px;
}

.position-option input[type="radio"] {
    display: none;
}

.position-card {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 15px;
    background: var(--bg-secondary);
    border: 2px solid var(--border-color);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 1.2rem;
}

.position-option input[type="radio"]:checked + .position-card {
    border-color: var(--primary-color);
    background: rgba(99, 102, 241, 0.1);
}

.position-card:hover {
    border-color: var(--primary-color);
}

/* Buttons */
.magicrills-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    position: relative;
    overflow: hidden;
}

.magicrills-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

.magicrills-btn:hover::before {
    left: 100%;
}

.magicrills-btn-primary {
    background: var(--gradient-primary);
    color: white;
}

.magicrills-btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.magicrills-btn-success {
    background: var(--gradient-success);
    color: white;
}

.magicrills-btn-success:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.magicrills-btn-outline {
    background: transparent;
    border: 2px solid var(--primary-color);
    color: var(--primary-color);
}

.magicrills-btn-outline:hover {
    background: var(--primary-color);
    color: white;
    transform: translateY(-2px);
}

.magicrills-btn-ghost {
    background: transparent;
    border: 2px solid transparent;
    color: var(--text-secondary);
}

.magicrills-btn-ghost:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.magicrills-process-btn {
    width: 100%;
    padding: 15px;
    font-size: 1.1rem;
    margin-top: 20px;
}

.btn-icon {
    font-size: 1.2rem;
}

/* Results Section */
.magicrills-results-section {
    background: var(--bg-card);
    padding: 30px;
    border-radius: 15px;
    box-shadow: var(--shadow);
    border: 2px solid var(--border-color);
    margin-top: 30px;
}

/* Progress Bar */
.magicrills-progress-container {
    margin: 25px 0;
}

.progress-bar {
    width: 100%;
    height: 12px;
    background: var(--bg-secondary);
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 10px;
}

.progress-fill {
    height: 100%;
    background: var(--gradient-primary);
    border-radius: 10px;
    transition: width 0.3s ease;
    width: 0%;
}

.progress-text {
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* Preview Grid */
.magicrills-preview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
    margin: 30px 0;
}

.preview-card {
    background: var(--bg-secondary);
    border-radius: 15px;
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: all 0.3s ease;
    border: 2px solid var(--border-color);
}

.preview-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

.preview-image {
    position: relative;
    padding-top: 75%;
    overflow: hidden;
}

.preview-image img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.preview-card:hover .preview-image img {
    transform: scale(1.05);
}

.preview-info {
    padding: 20px;
}

.preview-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 15px;
}

.stat {
    text-align: center;
    padding: 8px;
    background: var(--bg-primary);
    border-radius: 8px;
}

.stat-value {
    font-weight: 700;
    color: var(--primary-color);
    display: block;
    font-size: 1.1rem;
}

.stat-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    display: block;
}

.preview-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

/* Batch Actions */
.magicrills-batch-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-top: 30px;
    flex-wrap: wrap;
}

/* Loading Spinner */
.magicrills-spinner {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: none;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    z-index: 10000;
    backdrop-filter: blur(5px);
}

.magicrills-spinner.active {
    display: flex;
}

.spinner-circle {
    width: 60px;
    height: 60px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top: 4px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.magicrills-spinner p {
    color: white;
    font-size: 1.1rem;
}

/* Responsive Design */
@media (max-width: 768px) {
    .magicrills-container {
        padding: 15px;
    }
    
    .magicrills-logo {
        flex-direction: column;
        text-align: center;
    }
    
    .magicrills-logo h1 {
        font-size: 2rem;
    }
    
    .magicrills-dashboard {
        gap: 20px;
    }
    
    .magicrills-upload-section,
    .magicrills-options-section {
        padding: 20px;
    }
    
    .magicrills-radio-group {
        grid-template-columns: 1fr;
    }
    
    .dimensions-inputs {
        grid-template-columns: 1fr;
    }
    
    .magicrills-format-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .position-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .magicrills-preview-grid {
        grid-template-columns: 1fr;
    }
    
    .magicrills-batch-actions {
        flex-direction: column;
    }
    
    .preview-actions {
        grid-template-columns: 1fr;
    }
}

/* Animation Classes */
.fade-in {
    animation: fadeIn 0.5s ease-in;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.slide-up {
    animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(30px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary-dark);
}