/* Shared Styles - imgium (Redesign) */
@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:wght,FILL@100..700,0..1&display=swap');

/* CSS Variables */
:root {
    --bg-color: #FCFBF7;
    --container-bg: #ffffff;
    --text-color: #1a1a2e;
    --text-muted: #9ca3af;
    --border-color: #f3f4f6;
    --primary: #ee5b2b;
    --primary-hover: #dc4a1a;
    --primary-shadow: rgba(238, 91, 43, 0.3);
    --shadow: 0 4px 20px rgba(0, 0, 0, 0.04);
    --shadow-lg: 0 15px 30px -5px rgba(0, 0, 0, 0.05);
    --radius-sm: 0.75rem;
    --radius: 1rem;
    --radius-lg: 1.5rem;
    --radius-xl: 2rem;
    --radius-2xl: 2.5rem;
    --radius-3xl: 3rem;

    /* Tool colors */
    --blue: #3B82F6;
    --blue-light: rgba(59, 130, 246, 0.1);
    --blue-mid: rgba(59, 130, 246, 0.2);
    --orange: #F97316;
    --orange-light: rgba(249, 115, 22, 0.1);
    --orange-mid: rgba(249, 115, 22, 0.2);
    --purple: #8B5CF6;
    --purple-light: rgba(139, 92, 246, 0.1);
    --purple-mid: rgba(139, 92, 246, 0.2);
    --green: #22C55E;
    --green-light: rgba(34, 197, 94, 0.1);
    --green-mid: rgba(34, 197, 94, 0.2);
    --yellow: #EAB308;
    --yellow-light: rgba(234, 179, 8, 0.1);
    --yellow-mid: rgba(234, 179, 8, 0.2);
    --red: #EF4444;
    --red-light: rgba(239, 68, 68, 0.1);
    --red-mid: rgba(239, 68, 68, 0.2);
}

[data-theme="dark"] {
    --bg-color: #0f1117;
    --container-bg: #1a1d27;
    --text-color: #e8eaed;
    --text-muted: #7a7f8e;
    --border-color: rgba(255, 255, 255, 0.06);
    --shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 15px 30px -5px rgba(0, 0, 0, 0.4);

    /* 카드/컨텐츠 색상은 라이트모드와 동일하게 유지 — 생기있는 파스텔 */
    --blue: #3B82F6;
    --blue-light: rgba(59, 130, 246, 0.15);
    --blue-mid: rgba(59, 130, 246, 0.25);

    --orange: #F97316;
    --orange-light: rgba(249, 115, 22, 0.15);
    --orange-mid: rgba(249, 115, 22, 0.25);

    --purple: #8B5CF6;
    --purple-light: rgba(139, 92, 246, 0.15);
    --purple-mid: rgba(139, 92, 246, 0.25);

    --green: #22C55E;
    --green-light: rgba(34, 197, 94, 0.15);
    --green-mid: rgba(34, 197, 94, 0.25);

    --yellow: #EAB308;
    --yellow-light: rgba(234, 179, 8, 0.15);
    --yellow-mid: rgba(234, 179, 8, 0.25);

    --red: #EF4444;
    --red-light: rgba(239, 68, 68, 0.15);
    --red-mid: rgba(239, 68, 68, 0.25);
}


/* Global Reset */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: "Plus Jakarta Sans", -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg-color);
    color: var(--text-color);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: background 0.3s, color 0.3s;
}

/* Material Symbols */
.material-symbols-outlined {
    font-variation-settings: 'FILL' 1, 'wght' 600, 'GRAD' 0, 'opsz' 48;
    font-size: 24px;
    line-height: 1;
}

.icon-lg {
    font-size: 48px;
}

.icon-md {
    font-size: 28px;
}

/* ===================== HEADER / NAV ===================== */
.site-header {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 24px 24px 0;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    flex-shrink: 0;
}

.logo-icon {
    background: var(--primary);
    border-radius: var(--radius-sm);
    padding: 8px;
    box-shadow: 0 4px 12px var(--primary-shadow);
    display: flex;
    align-items: center;
    justify-content: center;
}

.logo-icon svg {
    width: 24px;
    height: 24px;
    color: #fff;
    fill: currentColor;
}

.logo-text {
    font-size: 1.25rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: var(--text-color);
}

/* Navigation pills */
.nav-pills {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px;
    background: rgba(255, 255, 255, 0.5);
    padding: 6px;
    border-radius: var(--radius-xl);
    border: 1px solid rgba(0, 0, 0, 0.04);
    backdrop-filter: blur(8px);
}

[data-theme="dark"] .nav-pills {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.08);
}

.nav-pill {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 18px;
    border-radius: var(--radius-lg);
    font-size: 0.875rem;
    font-weight: 700;
    color: var(--text-muted);
    text-decoration: none;
    border: none;
    background: transparent;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.nav-pill:hover {
    color: var(--text-color);
    background: rgba(0, 0, 0, 0.04);
}

[data-theme="dark"] .nav-pill:hover {
    background: rgba(255, 255, 255, 0.08);
}

.nav-pill .material-symbols-outlined {
    font-size: 20px;
}

/* Active states per tool */
.nav-pill.active-resize {
    background: var(--blue-light);
    color: var(--blue);
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.15);
}

.nav-pill.active-crop {
    background: var(--orange-light);
    color: var(--orange);
    box-shadow: 0 2px 8px rgba(249, 115, 22, 0.15);
}

.nav-pill.active-ico {
    background: var(--red-light);
    color: var(--red);
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.15);
}

.nav-pill.active-favicon {
    background: var(--purple-light);
    color: var(--purple);
    box-shadow: 0 2px 8px rgba(139, 92, 246, 0.15);
}

.nav-pill.active-convert {
    background: var(--green-light);
    color: var(--green);
    box-shadow: 0 2px 8px rgba(34, 197, 94, 0.15);
}

.nav-pill.active-compress {
    background: var(--yellow-light);
    color: var(--yellow);
    box-shadow: 0 2px 8px rgba(234, 179, 8, 0.15);
}

/* Theme toggle in nav */
.theme-toggle-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: var(--radius);
    background: transparent;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
    transition: all 0.2s;
}

.theme-toggle-btn:hover {
    background: rgba(0, 0, 0, 0.05);
    color: var(--text-color);
}

[data-theme="dark"] .theme-toggle-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

.theme-toggle-btn .material-symbols-outlined {
    font-size: 22px;
}

/* ===================== MAIN CONTAINER ===================== */
.main-container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 32px 24px;
    flex-grow: 1;
}

/* ===================== DROP ZONE ===================== */
.drop-zone {
    position: relative;
    width: 100%;
    min-height: 300px;
    background: var(--container-bg);
    border: 4px dashed var(--border-color);
    border-radius: var(--radius-3xl);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    cursor: pointer;
    transition: all 0.3s ease;
    overflow: hidden;
}

.drop-zone:hover,
.drop-zone.dragover {
    border-color: var(--primary);
    background: rgba(238, 91, 43, 0.03);
}

.drop-zone-icon {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s ease;
}

.drop-zone:hover .drop-zone-icon {
    transform: scale(1.1);
}

.drop-zone-title {
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--text-color);
    opacity: 0.5;
}

.drop-zone-subtitle {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-muted);
}

/* Themed drop zone icons */
.drop-zone-icon.blue {
    background: var(--blue-light);
    color: var(--blue);
}

.drop-zone-icon.orange {
    background: var(--orange-light);
    color: var(--orange);
}

.drop-zone-icon.purple {
    background: var(--purple-light);
    color: var(--purple);
}

.drop-zone-icon.green {
    background: var(--green-light);
    color: var(--green);
}

.drop-zone-icon.yellow {
    background: var(--yellow-light);
    color: var(--yellow);
}

.drop-zone-icon.red {
    background: var(--red-light);
    color: var(--red);
}

/* ===================== BUTTONS ===================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 28px;
    border-radius: 9999px;
    font-size: 1rem;
    font-weight: 700;
    border: none;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    text-decoration: none;
    line-height: 1.2;
}

.btn:hover {
    transform: translateY(-2px);
}

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

.btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none !important;
}

.btn .material-symbols-outlined {
    font-size: 20px;
}

/* Primary (orange) */
.btn-primary {
    background: var(--primary);
    color: #fff;
    box-shadow: 0 8px 20px -4px var(--primary-shadow);
}

.btn-primary:hover {
    background: var(--primary-hover);
    box-shadow: 0 12px 24px -4px var(--primary-shadow);
}

/* Blue */
.btn-blue {
    background: var(--blue);
    color: #fff;
    box-shadow: 0 8px 20px -4px rgba(59, 130, 246, 0.35);
}

.btn-blue:hover {
    box-shadow: 0 12px 24px -4px rgba(59, 130, 246, 0.4);
}

/* Green */
.btn-green {
    background: var(--green);
    color: #fff;
    box-shadow: 0 8px 20px -4px rgba(34, 197, 94, 0.35);
}

.btn-green:hover {
    box-shadow: 0 12px 24px -4px rgba(34, 197, 94, 0.4);
}

/* Purple */
.btn-purple {
    background: var(--purple);
    color: #fff;
    box-shadow: 0 8px 20px -4px rgba(139, 92, 246, 0.35);
}

.btn-purple:hover {
    box-shadow: 0 12px 24px -4px rgba(139, 92, 246, 0.4);
}

/* Ghost / outline */
.btn-ghost {
    background: var(--container-bg);
    color: var(--text-muted);
    border: 2px solid var(--border-color);
    box-shadow: var(--shadow);
}

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

/* Chunky large button */
.btn-chunky {
    padding: 20px 40px;
    font-size: 1.25rem;
    font-weight: 800;
    border-radius: var(--radius-xl);
}

/* ===================== CARDS ===================== */
.card {
    background: var(--container-bg);
    border-radius: var(--radius-xl);
    padding: 24px;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.card-flat {
    background: var(--container-bg);
    border-radius: var(--radius-xl);
    padding: 24px;
    border: 1px solid var(--border-color);
}

/* ===================== OPTIONS PANEL ===================== */
.options-panel {
    background: var(--container-bg);
    border-radius: var(--radius-xl);
    padding: 28px;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow);
}

.options-panel h3 {
    font-size: 1.125rem;
    font-weight: 800;
    margin-bottom: 4px;
}

.options-panel .subtitle {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-muted);
}

/* ===================== FORM ELEMENTS ===================== */
.input-field {
    width: 100%;
    padding: 14px 18px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-lg);
    font-family: inherit;
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-color);
    background: var(--container-bg);
    outline: none;
    transition: all 0.2s ease;
}

.input-field:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(238, 91, 43, 0.1);
    transform: translateY(-1px);
}

.input-field::placeholder {
    color: var(--text-muted);
    font-weight: 500;
}

.input-number {
    text-align: center;
    font-size: 1.25rem;
    font-weight: 800;
    padding: 16px;
    border-radius: var(--radius-xl);
    border: none;
    background: var(--container-bg);
    box-shadow: var(--shadow);
}

.input-number:focus {
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.1), var(--shadow);
}

select.input-field {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%239ca3af' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 36px;
}

/* Custom range slider */
input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    background: transparent;
    cursor: pointer;
}

input[type="range"]::-webkit-slider-track {
    width: 100%;
    height: 8px;
    background: var(--border-color);
    border-radius: 999px;
}

[data-theme="dark"] input[type="range"]::-webkit-slider-track {
    background: rgba(255, 255, 255, 0.1);
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    height: 28px;
    width: 28px;
    border-radius: 50%;
    background: var(--primary);
    border: 4px solid #fff;
    box-shadow: 0 4px 12px var(--primary-shadow);
    margin-top: -10px;
    transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

[data-theme="dark"] input[type="range"]::-webkit-slider-thumb {
    border-color: var(--bg-color);
}

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

input[type="range"]::-moz-range-track {
    width: 100%;
    height: 8px;
    background: var(--border-color);
    border-radius: 999px;
    border: none;
}

input[type="range"]::-moz-range-thumb {
    height: 28px;
    width: 28px;
    border-radius: 50%;
    background: var(--primary);
    border: 4px solid #fff;
    box-shadow: 0 4px 12px var(--primary-shadow);
}

/* Color input */
input[type="color"] {
    width: 44px;
    height: 36px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-sm);
    cursor: pointer;
    padding: 2px;
    background: var(--container-bg);
}

/* Checkbox */
input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--primary);
    cursor: pointer;
    border-radius: 4px;
}

/* ===================== LABELS ===================== */
.label-sm {
    font-size: 0.7rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
}

/* ===================== BADGE / PILL ===================== */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 14px;
    border-radius: var(--radius);
    font-size: 0.875rem;
    font-weight: 800;
}

.badge-primary {
    background: rgba(238, 91, 43, 0.1);
    color: var(--primary);
}

.badge-blue {
    background: var(--blue-light);
    color: var(--blue);
}

.badge-green {
    background: var(--green-light);
    color: var(--green);
}

/* ===================== STAT BOX ===================== */
.stat-box {
    background: var(--container-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    padding: 24px;
    text-align: center;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.stat-box:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.stat-box .stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 12px;
}

.stat-box .stat-label {
    font-size: 0.625rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.stat-box .stat-value {
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: -0.02em;
}

.stat-box.green {
    background: var(--green-light);
    border-color: var(--green-mid);
}

.stat-box.green .stat-icon {
    background: var(--green-mid);
    color: var(--green);
}

.stat-box.green .stat-value {
    color: var(--green);
}

/* ===================== TABS ===================== */
.tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 24px;
}

.tab {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    border-radius: var(--radius-xl);
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text-muted);
    background: transparent;
    border: 2px solid var(--border-color);
    cursor: pointer;
    transition: all 0.2s ease;
}

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

.tab.active {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
    box-shadow: 0 4px 12px var(--primary-shadow);
}

/* ===================== PREVIEW SECTION ===================== */
.preview-section {
    background: var(--container-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    padding: 24px;
    text-align: center;
}

.preview-section h3 {
    font-weight: 800;
    margin-bottom: 20px;
}

/* ===================== RESULT SECTION ===================== */
.result-section {
    background: var(--green-light);
    border: 1px solid var(--green-mid);
    border-radius: var(--radius-xl);
    padding: 28px;
    text-align: center;
}

.result-section .result-icon {
    font-size: 48px;
    margin-bottom: 12px;
}

.result-section .result-text {
    font-size: 1rem;
    font-weight: 700;
    color: var(--green);
}

/* ===================== LOADING ===================== */
.loading {
    display: none;
    text-align: center;
    padding: 40px;
}

.loading.show {
    display: block;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--border-color);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 16px;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ===================== PANELS ===================== */
.panel {
    display: none;
}

.panel.active {
    display: block;
}

/* ===================== GRID LAYOUTS ===================== */
.grid-2col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.grid-3col {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}

/* ===================== FOOTER ===================== */
.site-footer {
    width: 100%;
    padding: 32px 24px;
    text-align: center;
    margin-top: auto;
}

.site-footer p {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--text-muted);
    opacity: 0.4;
    transition: opacity 0.2s;
}

.site-footer:hover p {
    opacity: 0.8;
}

.footer-links {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-bottom: 12px;
}

.footer-links a {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
    text-decoration: none;
    opacity: 0.5;
    transition: all 0.2s;
}

.footer-links a:hover {
    color: var(--primary);
    opacity: 1;
}

/* ===================== UTILITY ===================== */
.hidden {
    display: none !important;
}

.flex-center {
    display: flex;
    align-items: center;
    justify-content: center;
}

.text-center {
    text-align: center;
}

.gap-4 {
    gap: 16px;
}

.gap-6 {
    gap: 24px;
}

.mt-4 {
    margin-top: 16px;
}

.mt-6 {
    margin-top: 24px;
}

.mt-8 {
    margin-top: 32px;
}

.mb-4 {
    margin-bottom: 16px;
}

.mb-6 {
    margin-bottom: 24px;
}

/* ===================== RESPONSIVE ===================== */
@media (max-width: 768px) {
    .site-header {
        padding: 16px;
        justify-content: center;
    }

    .nav-pills {
        order: 3;
        width: 100%;
        justify-content: center;
        overflow-x: auto;
        flex-wrap: nowrap;
        -webkit-overflow-scrolling: touch;
    }

    .nav-pills::-webkit-scrollbar {
        display: none;
    }

    .main-container {
        padding: 20px 16px;
    }

    .drop-zone {
        min-height: 220px;
        border-radius: var(--radius-xl);
    }

    .grid-2col {
        grid-template-columns: 1fr;
    }

    .grid-3col {
        grid-template-columns: repeat(2, 1fr);
    }

    .tabs {
        flex-direction: column;
    }
}

@media (max-width: 480px) {
    .grid-3col {
        grid-template-columns: 1fr;
    }
}

/* ===================== PAGE CONTENT AREA ===================== */
.page-content {
    max-width: 800px;
    margin: 0 auto;
}