:root {
    --bg-primary: #f8fafc;
    --bg-secondary: #ffffff;
    --bg-tertiary: #f1f5f9;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    --accent: #10b981;
    --accent-hover: #059669;
    --accent-light: #d1fae5;
    --border: #e2e8f0;
    --success: #10b981;
    --error: #ef4444;
    --warning: #f59e0b;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
    --radius: 12px;
    --radius-sm: 8px;
    /* Aliases */
    --bg: var(--bg-primary);
    --text: var(--text-primary);
    --bg-card: var(--bg-secondary);
    --bg-input: var(--bg-tertiary);
    --primary: var(--accent);
    --primary-hover: var(--accent-hover);
}

[data-theme="dark"] {
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-tertiary: #334155;
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --accent: #34d399;
    --accent-hover: #10b981;
    --accent-light: #064e3b;
    --border: #334155;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.4);
    /* Aliases */
    --bg: var(--bg-primary);
    --text: var(--text-primary);
    --bg-card: var(--bg-secondary);
    --bg-input: var(--bg-tertiary);
    --primary: var(--accent);
    --primary-hover: var(--accent-hover);
}

.theme-toggle {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: none;
    background: var(--bg-secondary);
    box-shadow: var(--shadow-lg);
    cursor: pointer;
    font-size: 1.25rem;
    transition: transform 0.2s;
    z-index: 100;
}
.theme-toggle:hover { transform: scale(1.1); }

/* Image Resizer Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    line-height: 1.6;
}

.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 2rem 1rem;
}

header {
    text-align: center;
    margin-bottom: 2rem;
}

h1 {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
    background: linear-gradient(135deg, var(--primary), #ec4899);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.subtitle {
    color: var(--text-muted);
    font-size: 1.1rem;
    margin-bottom: 1rem;
}

.badges {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    flex-wrap: wrap;
}

.badge {
    padding: 0.25rem 0.75rem;
    border-radius: 999px;
    font-size: 0.85rem;
    font-weight: 500;
}

.badge-green { background: rgba(16, 185, 129, 0.2); color: #34d399; }
.badge-blue { background: rgba(59, 130, 246, 0.2); color: #60a5fa; }
.badge-purple { background: rgba(139, 92, 246, 0.2); color: #a78bfa; }

.calculator-card {
    background: var(--bg-card);
    border-radius: 1rem;
    padding: 2rem;
    margin-bottom: 2rem;
    border: 1px solid var(--border);
}

/* Upload Area */
.upload-area {
    border: 3px dashed var(--border);
    border-radius: 1rem;
    padding: 3rem 2rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
}

.upload-area:hover, .upload-area.dragover {
    border-color: var(--primary);
    background: rgba(139, 92, 246, 0.1);
}

.upload-icon {
    font-size: 4rem;
    display: block;
    margin-bottom: 1rem;
}

.upload-text {
    font-size: 1.2rem;
    color: var(--text);
    margin-bottom: 0.5rem;
}

.upload-hint {
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* Editor Section */
.preview-container {
    text-align: center;
    margin-bottom: 1rem;
    background: var(--bg-input);
    border-radius: 0.5rem;
    padding: 1rem;
    max-height: 300px;
    overflow: hidden;
}

.preview-container img {
    max-width: 100%;
    max-height: 250px;
    border-radius: 0.25rem;
}

.image-info {
    display: flex;
    justify-content: center;
    gap: 2rem;
    margin-bottom: 1.5rem;
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* Tabs */
.option-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    background: var(--bg-input);
    padding: 0.25rem;
    border-radius: 0.5rem;
}

.tab-btn {
    flex: 1;
    padding: 0.75rem;
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    border-radius: 0.375rem;
    transition: all 0.2s;
}

.tab-btn.active {
    background: var(--primary);
    color: white;
}

.tab-content {
    display: none;
    padding: 1rem 0;
}

.tab-content.active {
    display: block;
}

/* Dimension Inputs */
.dimension-inputs {
    display: flex;
    align-items: flex-end;
    gap: 1rem;
}

.dimension-inputs .input-field {
    flex: 1;
}

.input-field label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--text);
    font-size: 0.9rem;
}

.input-field input, .input-field select {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid var(--border);
    border-radius: 0.5rem;
    background: var(--bg-input);
    color: var(--text);
    font-size: 1rem;
    outline: none;
}

.input-field input:focus, .input-field select:focus {
    border-color: var(--primary);
}

.lock-ratio {
    padding-bottom: 0.5rem;
}

.lock-ratio button {
    width: 40px;
    height: 40px;
    border: 2px solid var(--border);
    border-radius: 0.5rem;
    background: var(--bg-input);
    font-size: 1.2rem;
    cursor: pointer;
    transition: all 0.2s;
}

.lock-ratio button.locked {
    background: var(--primary);
    border-color: var(--primary);
}

/* Percentage */
.percentage-slider {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin: 1rem 0;
}

.percentage-slider input[type="range"] {
    flex: 1;
    height: 8px;
    border-radius: 4px;
    background: var(--bg-input);
    outline: none;
    -webkit-appearance: none;
}

.percentage-slider input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--primary);
    cursor: pointer;
}

#percentage-value {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--primary);
    min-width: 70px;
}

.preset-buttons {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.preset-btn {
    padding: 0.5rem 1rem;
    border: 2px solid var(--border);
    border-radius: 0.5rem;
    background: var(--bg-input);
    color: var(--text);
    cursor: pointer;
    transition: all 0.2s;
}

.preset-btn:hover {
    border-color: var(--primary);
    background: rgba(139, 92, 246, 0.1);
}

/* File Size */
.filesize-input .input-with-unit {
    display: flex;
    align-items: center;
    background: var(--bg-input);
    border: 2px solid var(--border);
    border-radius: 0.5rem;
    overflow: hidden;
    margin: 1rem 0;
}

.filesize-input input {
    flex: 1;
    padding: 0.75rem;
    border: none;
    background: transparent;
    color: var(--text);
    font-size: 1rem;
    outline: none;
}

.filesize-input .unit {
    padding: 0.75rem 1rem;
    background: var(--border);
    color: var(--text-muted);
    font-weight: 600;
}

.hint {
    color: var(--text-muted);
    font-size: 0.85rem;
}

/* Output Format */
.output-format {
    margin: 1.5rem 0;
}

.output-format label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.output-format select {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid var(--border);
    border-radius: 0.5rem;
    background: var(--bg-input);
    color: var(--text);
    font-size: 1rem;
    outline: none;
    cursor: pointer;
}

/* Buttons */
.action-buttons {
    display: flex;
    gap: 1rem;
    margin-top: 1.5rem;
}

.btn-primary, .btn-secondary {
    flex: 1;
    padding: 1rem;
    font-size: 1rem;
    font-weight: 600;
    border: none;
    border-radius: 0.5rem;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-hover);
}

.btn-secondary {
    background: var(--bg-input);
    color: var(--text);
    border: 2px solid var(--border);
}

.btn-secondary:hover {
    border-color: var(--primary);
}

/* Result */
.result-section {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
    text-align: center;
}

.result-section h4 {
    color: var(--success);
    margin-bottom: 1rem;
}

.result-info {
    display: flex;
    justify-content: center;
    gap: 2rem;
    margin-bottom: 1rem;
    color: var(--text-muted);
}

.btn-download {
    padding: 1rem 2rem;
    font-size: 1.1rem;
    font-weight: 600;
    background: var(--success);
    color: white;
    border: none;
    border-radius: 0.5rem;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-download:hover {
    background: #059669;
    transform: translateY(-2px);
}

/* Features */
.features {
    margin-bottom: 2rem;
}

.features h2 {
    text-align: center;
    margin-bottom: 1.5rem;
    font-size: 1.75rem;
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.5rem;
}

.feature {
    background: var(--bg-card);
    padding: 1.5rem;
    border-radius: 1rem;
    border: 1px solid var(--border);
    text-align: center;
    transition: transform 0.2s;
}

.feature:hover {
    transform: translateY(-4px);
}

.feature-icon {
    font-size: 2.5rem;
    display: block;
    margin-bottom: 0.75rem;
}

.feature h3 {
    margin-bottom: 0.5rem;
    color: var(--text);
}

.feature p {
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* FAQ */
.faq {
    margin-bottom: 2rem;
}

.faq h2 {
    text-align: center;
    margin-bottom: 1.5rem;
    font-size: 1.75rem;
}

.faq-category {
    margin-bottom: 1.5rem;
}

.faq-category-title {
    font-size: 1.1rem;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--primary);
    color: var(--primary);
}

.faq-item {
    background: var(--bg-card);
    padding: 1.25rem;
    border-radius: 0.75rem;
    margin-bottom: 0.75rem;
    border: 1px solid var(--border);
}

.faq-item h4 {
    margin-bottom: 0.5rem;
    color: var(--text);
}

.faq-item p {
    color: var(--text-muted);
    font-size: 0.9rem;
}

footer {
    text-align: center;
    padding: 2rem 0;
    border-top: 1px solid var(--border);
    color: var(--text-muted);
}

footer p:first-child {
    color: var(--text);
    margin-bottom: 0.25rem;
}

@media (max-width: 600px) {
    h1 { font-size: 2rem; }
    .calculator-card { padding: 1.5rem; }
    .dimension-inputs { flex-direction: column; }
    .lock-ratio { display: none; }
    .action-buttons { flex-direction: column; }
}

/* Theme Toggle Button */

/* Dark Mode */

[data-theme="dark"] body {
    background: #0f172a;
    color: #f1f5f9;
}

[data-theme="dark"] .container {
    color: #f1f5f9;
}

[data-theme="dark"] .generator-card,
[data-theme="dark"] .calculator-card,
[data-theme="dark"] .tool-card,
[data-theme="dark"] .card,
[data-theme="dark"] .feature,
[data-theme="dark"] .faq-item {
    background: #1e293b;
}

[data-theme="dark"] input,
[data-theme="dark"] textarea,
[data-theme="dark"] select {
    background: #0f172a;
    color: #f1f5f9;
    border-color: #334155;
}

[data-theme="dark"] .btn-secondary,
[data-theme="dark"] .tab-btn {
    background: #0f172a;
    color: #94a3b8;
    border-color: #334155;
}

[data-theme="dark"]