/* ===================================
   Design Tokens & CSS Variables
   =================================== */
:root {
    /* Colors - Light Mode */
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --primary-light: #818cf8;
    --secondary: #8b5cf6;
    --accent: #10b981;
    --accent-dark: #059669;

    --background: #ffffff;
    --surface: #f9fafb;
    --surface-2: #f3f4f6;
    --surface-3: #e5e7eb;

    --text: #111827;
    --text-secondary: #6b7280;
    --text-tertiary: #9ca3af;

    --border: #e5e7eb;
    --border-light: #f3f4f6;

    --success: #10b981;
    --warning: #f59e0b;
    --error: #ef4444;
    --info: #3b82f6;

    /* Spacing */
    --space-xs: 0.25rem;
    --space-sm: 0.5rem;
    --space-md: 1rem;
    --space-lg: 1.5rem;
    --space-xl: 2rem;
    --space-2xl: 3rem;
    --space-3xl: 4rem;

    /* Typography */
    --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    --font-mono: 'Courier New', Consolas, Monaco, monospace;

    --text-xs: 0.75rem;
    --text-sm: 0.875rem;
    --text-base: 1rem;
    --text-lg: 1.125rem;
    --text-xl: 1.25rem;
    --text-2xl: 1.5rem;
    --text-3xl: 1.875rem;
    --text-4xl: 2.25rem;
    --text-5xl: 3rem;

    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 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);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    --shadow-2xl: 0 25px 50px -12px rgba(0, 0, 0, 0.25);

    /* Border Radius */
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
    --radius-2xl: 1.5rem;
    --radius-full: 9999px;

    /* Transitions */
    --transition-fast: 150ms ease;
    --transition-base: 250ms ease;
    --transition-slow: 350ms ease;

    /* Z-index */
    --z-dropdown: 1000;
    --z-sticky: 1020;
    --z-fixed: 1030;
    --z-modal-backdrop: 1040;
    --z-modal: 1050;
    --z-popover: 1060;
    --z-tooltip: 1070;
}

/* Dark Mode */
[data-theme="dark"] {
    --background: #0f172a;
    --surface: #1e293b;
    --surface-2: #334155;
    --surface-3: #475569;

    --text: #f1f5f9;
    --text-secondary: #cbd5e1;
    --text-tertiary: #94a3b8;

    --border: #334155;
    --border-light: #475569;
}

/* ===================================
   Reset & Base Styles
   =================================== */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-sans);
    font-size: var(--text-base);
    line-height: 1.6;
    color: var(--text);
    background: var(--background);
    transition: background-color var(--transition-base), color var(--transition-base);
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

button {
    font-family: inherit;
    cursor: pointer;
}

/* ===================================
   Utility Classes
   =================================== */
.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 var(--space-lg);
}

.hidden {
    display: none !important;
}

.gradient-text {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* ===================================
   Buttons
   =================================== */
.btn {
    display: inline-flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-lg);
    border: none;
    border-radius: var(--radius-md);
    font-size: var(--text-base);
    font-weight: 600;
    text-decoration: none;
    transition: all var(--transition-fast);
    cursor: pointer;
}

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

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn-secondary {
    background: var(--surface-2);
    color: var(--text);
}

.btn-secondary:hover {
    background: var(--surface-3);
}

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

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

.btn-large {
    padding: var(--space-md) var(--space-xl);
    font-size: var(--text-lg);
}

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

/* ===================================
   Header
   =================================== */
.header {
    position: sticky;
    top: 0;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
    z-index: var(--z-sticky);
    transition: all var(--transition-base);
}

[data-theme="dark"] .header {
    background: rgba(15, 23, 42, 0.8);
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-lg) 0;
}

.logo {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    text-decoration: none;
    color: var(--text);
    font-weight: 700;
    font-size: var(--text-xl);
}

.logo-icon {
    font-size: var(--text-3xl);
}

.nav {
    display: flex;
    align-items: center;
    gap: var(--space-lg);
}

.nav-link {
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    transition: color var(--transition-fast);
}

.nav-link:hover {
    color: var(--primary);
}

/* ===================================
   Hero Section
   =================================== */
.hero {
    position: relative;
    padding: var(--space-3xl) 0;
    overflow: hidden;
}

.hero-content {
    position: relative;
    z-index: 2;
    text-align: center;
    max-width: 800px;
    margin: 0 auto;
}

.hero-title {
    font-size: var(--text-5xl);
    font-weight: 800;
    line-height: 1.2;
    margin-bottom: var(--space-lg);
}

.hero-subtitle {
    font-size: var(--text-xl);
    color: var(--text-secondary);
    margin-bottom: var(--space-2xl);
}

.hero-cta {
    display: flex;
    gap: var(--space-md);
    justify-content: center;
    margin-bottom: var(--space-xl);
}

.hero-badges {
    display: flex;
    gap: var(--space-md);
    justify-content: center;
    flex-wrap: wrap;
}

.badge {
    padding: var(--space-sm) var(--space-md);
    background: var(--surface);
    border-radius: var(--radius-full);
    font-size: var(--text-sm);
    color: var(--text-secondary);
}

/* Hero Background Animation */
.hero-bg {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1;
    overflow: hidden;
}

.hero-shape {
    position: absolute;
    border-radius: 50%;
    opacity: 0.1;
    animation: float 20s infinite ease-in-out;
}

.hero-shape-1 {
    width: 300px;
    height: 300px;
    background: var(--primary);
    top: 10%;
    left: 10%;
    animation-delay: 0s;
}

.hero-shape-2 {
    width: 200px;
    height: 200px;
    background: var(--secondary);
    top: 60%;
    right: 10%;
    animation-delay: 5s;
}

.hero-shape-3 {
    width: 150px;
    height: 150px;
    background: var(--accent);
    bottom: 20%;
    left: 50%;
    animation-delay: 10s;
}

@keyframes float {

    0%,
    100% {
        transform: translate(0, 0) scale(1);
    }

    33% {
        transform: translate(30px, -30px) scale(1.1);
    }

    66% {
        transform: translate(-20px, 20px) scale(0.9);
    }
}

/* ===================================
   Features Section
   =================================== */
.features {
    padding: var(--space-3xl) 0;
    background: var(--surface);
}

.section-header {
    text-align: center;
    margin-bottom: var(--space-2xl);
}

.section-title {
    font-size: var(--text-4xl);
    font-weight: 700;
    margin-bottom: var(--space-md);
}

.section-subtitle {
    font-size: var(--text-lg);
    color: var(--text-secondary);
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: var(--space-xl);
}

.feature-card {
    padding: var(--space-xl);
    background: var(--background);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-md);
    transition: all var(--transition-base);
}

.feature-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-xl);
}

.feature-icon {
    font-size: var(--text-4xl);
    margin-bottom: var(--space-md);
}

.feature-title {
    font-size: var(--text-xl);
    font-weight: 600;
    margin-bottom: var(--space-sm);
}

.feature-description {
    color: var(--text-secondary);
    line-height: 1.7;
}

/* ===================================
   How It Works Section
   =================================== */
.how-it-works {
    padding: var(--space-3xl) 0;
}

.steps {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-xl);
    margin-bottom: var(--space-2xl);
    flex-wrap: wrap;
}

.step {
    flex: 1;
    min-width: 250px;
    max-width: 300px;
    text-align: center;
}

.step-number {
    width: 60px;
    height: 60px;
    margin: 0 auto var(--space-md);
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--text-2xl);
    font-weight: 700;
}

.step-title {
    font-size: var(--text-xl);
    font-weight: 600;
    margin-bottom: var(--space-sm);
}

.step-description {
    color: var(--text-secondary);
}

.step-arrow {
    font-size: var(--text-3xl);
    color: var(--primary);
}

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

/* ===================================
   FAQ Section
   =================================== */
.faq {
    padding: var(--space-3xl) 0;
    background: var(--surface);
}

.faq-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: var(--space-xl);
}

.faq-item {
    padding: var(--space-lg);
    background: var(--background);
    border-radius: var(--radius-lg);
}

.faq-question {
    font-size: var(--text-lg);
    font-weight: 600;
    margin-bottom: var(--space-sm);
}

.faq-answer {
    color: var(--text-secondary);
    line-height: 1.7;
}

/* ===================================
   Footer
   =================================== */
.footer {
    padding: var(--space-3xl) 0 var(--space-xl);
    background: var(--surface-2);
}

.footer-content {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    gap: var(--space-2xl);
    margin-bottom: var(--space-xl);
}

.footer-description {
    color: var(--text-secondary);
    margin-top: var(--space-md);
}

.footer-heading {
    font-weight: 600;
    margin-bottom: var(--space-md);
}

.footer-column {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.footer-link {
    color: var(--text-secondary);
    text-decoration: none;
    transition: color var(--transition-fast);
}

.footer-link:hover {
    color: var(--primary);
}

.footer-bottom {
    text-align: center;
    padding-top: var(--space-xl);
    border-top: 1px solid var(--border);
    color: var(--text-secondary);
    font-size: var(--text-sm);
}

/* ===================================
   App Page Styles
   =================================== */
.app-page {
    background: var(--surface);
    min-height: 100vh;
}

.app-header {
    background: var(--background);
    border-bottom: 1px solid var(--border);
    padding: var(--space-md) 0;
}

.theme-toggle {
    padding: var(--space-sm);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    font-size: var(--text-xl);
    transition: all var(--transition-fast);
}

.theme-toggle:hover {
    background: var(--surface-2);
    transform: scale(1.1);
}

.app-main {
    padding: var(--space-2xl) 0;
}

.section {
    display: none;
}

.section.active {
    display: block;
}

.section-content {
    max-width: 900px;
    margin: 0 auto;
}

.section-nav {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    margin-bottom: var(--space-xl);
}

/* ===================================
   Drop Zone
   =================================== */
.drop-zone {
    border: 3px dashed var(--border);
    border-radius: var(--radius-xl);
    padding: var(--space-3xl);
    text-align: center;
    transition: all var(--transition-base);
    background: var(--background);
}

.drop-zone:hover,
.drop-zone.drag-over {
    border-color: var(--primary);
    background: var(--surface);
    transform: scale(1.02);
}

.drop-zone-icon {
    font-size: 4rem;
    margin-bottom: var(--space-md);
}

.drop-zone-title {
    font-size: var(--text-2xl);
    font-weight: 600;
    margin-bottom: var(--space-sm);
}

.drop-zone-text {
    color: var(--text-secondary);
    margin-bottom: var(--space-lg);
}

.drop-zone-hint {
    margin-top: var(--space-lg);
    font-size: var(--text-sm);
    color: var(--text-tertiary);
}

/* ===================================
   Image Preview
   =================================== */
.image-preview-container {
    margin-top: var(--space-2xl);
}

.preview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-lg);
}

.preview-title {
    font-size: var(--text-xl);
    font-weight: 600;
}

.image-preview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: var(--space-md);
    margin-bottom: var(--space-xl);
}

.preview-item {
    position: relative;
    aspect-ratio: 1;
    border-radius: var(--radius-md);
    overflow: hidden;
    background: var(--surface-2);
}

.preview-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.preview-remove {
    position: absolute;
    top: var(--space-xs);
    right: var(--space-xs);
    width: 28px;
    height: 28px;
    background: rgba(239, 68, 68, 0.9);
    color: white;
    border: none;
    border-radius: 50%;
    font-size: var(--text-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity var(--transition-fast);
}

.preview-item:hover .preview-remove {
    opacity: 1;
}

/* ===================================
   Dimension Selection
   =================================== */
.dimension-tabs {
    display: flex;
    gap: var(--space-sm);
    margin-bottom: var(--space-xl);
    border-bottom: 2px solid var(--border);
}

.tab-btn {
    padding: var(--space-md) var(--space-lg);
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    font-weight: 600;
    color: var(--text-secondary);
    transition: all var(--transition-fast);
    margin-bottom: -2px;
}

.tab-btn.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.tab-content {
    display: none;
}

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

.dimension-input-group {
    display: flex;
    align-items: flex-end;
    gap: var(--space-md);
    padding: var(--space-xl);
    background: var(--background);
    border-radius: var(--radius-lg);
}

.input-group {
    flex: 1;
}

.input-group label {
    display: block;
    margin-bottom: var(--space-xs);
    font-weight: 500;
    font-size: var(--text-sm);
}

.input-group input {
    width: 100%;
    padding: var(--space-sm) var(--space-md);
    border: 2px solid var(--border);
    border-radius: var(--radius-md);
    font-size: var(--text-base);
    background: var(--background);
    color: var(--text);
    transition: border-color var(--transition-fast);
}

.input-group input:focus {
    outline: none;
    border-color: var(--primary);
}

.input-separator {
    font-size: var(--text-2xl);
    font-weight: 600;
    color: var(--text-tertiary);
    padding-bottom: var(--space-sm);
}

.preset-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: var(--space-md);
}

.preset-card {
    padding: var(--space-lg);
    background: var(--background);
    border: 2px solid var(--border);
    border-radius: var(--radius-lg);
    text-align: center;
    transition: all var(--transition-fast);
}

.preset-card:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.preset-card.selected {
    border-color: var(--primary);
    background: var(--primary-light);
    color: white;
}

.preset-icon {
    font-size: var(--text-3xl);
    margin-bottom: var(--space-sm);
}

.preset-name {
    font-weight: 600;
    margin-bottom: var(--space-xs);
}

.preset-size {
    font-size: var(--text-sm);
    color: var(--text-tertiary);
}

.preset-card.selected .preset-size {
    color: rgba(255, 255, 255, 0.9);
}

.platform-section {
    margin-bottom: var(--space-2xl);
}

.platform-name {
    font-size: var(--text-xl);
    font-weight: 600;
    margin-bottom: var(--space-md);
}

.selected-dimensions-container {
    margin-top: var(--space-2xl);
    padding: var(--space-xl);
    background: var(--background);
    border-radius: var(--radius-lg);
}

.selected-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-md);
}

.selected-dimensions {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-sm);
    margin-bottom: var(--space-xl);
}

.dimension-tag {
    display: inline-flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-md);
    background: var(--primary);
    color: white;
    border-radius: var(--radius-full);
    font-size: var(--text-sm);
}

.dimension-tag-remove {
    background: transparent;
    border: none;
    color: white;
    font-size: var(--text-lg);
    padding: 0;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background var(--transition-fast);
}

.dimension-tag-remove:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* ===================================
   Processing
   =================================== */
.processing-container {
    text-align: center;
    padding: var(--space-3xl);
    background: var(--background);
    border-radius: var(--radius-xl);
}

.processing-animation {
    margin-bottom: var(--space-2xl);
}

.spinner {
    width: 80px;
    height: 80px;
    margin: 0 auto;
    border: 6px solid var(--surface-2);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.processing-stats {
    display: flex;
    justify-content: center;
    gap: var(--space-2xl);
    margin-bottom: var(--space-2xl);
}

.stat {
    text-align: center;
}

.stat-value {
    font-size: var(--text-3xl);
    font-weight: 700;
    color: var(--primary);
}

.stat-label {
    font-size: var(--text-sm);
    color: var(--text-secondary);
}

.progress-bar-container {
    max-width: 500px;
    margin: 0 auto;
}

.progress-bar {
    width: 100%;
    height: 12px;
    background: var(--surface-2);
    border-radius: var(--radius-full);
    overflow: hidden;
    margin-bottom: var(--space-sm);
}

.progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--secondary));
    transition: width var(--transition-base);
    width: 0%;
}

.progress-text {
    display: flex;
    justify-content: space-between;
    font-size: var(--text-sm);
    color: var(--text-secondary);
}

/* ===================================
   Results
   =================================== */
.results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-2xl);
}

.results-actions {
    display: flex;
    gap: var(--space-md);
}

.results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: var(--space-lg);
}

.result-item {
    background: var(--background);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-md);
    transition: all var(--transition-base);
}

.result-item:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-xl);
}

.result-image {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
}

.result-info {
    padding: var(--space-md);
}

.result-name {
    font-weight: 600;
    font-size: var(--text-sm);
    margin-bottom: var(--space-xs);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.result-size {
    font-size: var(--text-xs);
    color: var(--text-tertiary);
    margin-bottom: var(--space-sm);
}

.result-download {
    width: 100%;
    padding: var(--space-sm);
    background: var(--primary);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-size: var(--text-sm);
    font-weight: 600;
    transition: background var(--transition-fast);
}

.result-download:hover {
    background: var(--primary-dark);
}

/* ===================================
   Toast Notification
   =================================== */
.toast {
    position: fixed;
    bottom: var(--space-xl);
    right: var(--space-xl);
    padding: var(--space-md) var(--space-lg);
    background: var(--surface-2);
    color: var(--text);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    z-index: var(--z-tooltip);
    animation: slideIn 0.3s ease;
}

.toast.success {
    background: var(--success);
    color: white;
}

.toast.error {
    background: var(--error);
    color: white;
}

@keyframes slideIn {
    from {
        transform: translateX(400px);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* ===================================
   Responsive Design
   =================================== */
@media (max-width: 768px) {
    .hero-title {
        font-size: var(--text-3xl);
    }

    .hero-cta {
        flex-direction: column;
    }

    .features-grid {
        grid-template-columns: 1fr;
    }

    .steps {
        flex-direction: column;
    }

    .step-arrow {
        transform: rotate(90deg);
    }

    .footer-content {
        grid-template-columns: 1fr;
    }

    .nav {
        gap: var(--space-sm);
    }

    .nav-link {
        display: none;
    }

    .dimension-input-group {
        flex-direction: column;
        align-items: stretch;
    }

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

    .results-header {
        flex-direction: column;
        gap: var(--space-md);
    }

    .results-actions {
        width: 100%;
        flex-direction: column;
    }

    .processing-stats {
        flex-direction: column;
        gap: var(--space-md);
    }

    .crop-preview-content {
        width: 95%;
        max-width: none;
    }

    .modal-footer {
        flex-direction: column;
        gap: var(--space-md);
    }

    .modal-footer-actions {
        width: 100%;
        flex-direction: column;
    }
}

/* ===================================
   Crop Preview Modal
   =================================== */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-lg);
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    z-index: 1;
}

.modal-content {
    position: relative;
    background: var(--background);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-2xl);
    max-width: 900px;
    width: 100%;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 2;
}

.crop-preview-content {
    max-width: 1000px;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-lg) var(--space-xl);
    border-bottom: 1px solid var(--border);
}

.modal-title {
    font-size: var(--text-xl);
    font-weight: 600;
}

.modal-close {
    width: 36px;
    height: 36px;
    border: none;
    background: var(--surface);
    border-radius: 50%;
    font-size: var(--text-2xl);
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
}

.modal-close:hover {
    background: var(--surface-2);
    color: var(--text);
    transform: rotate(90deg);
}

.modal-body {
    padding: var(--space-xl);
    overflow-y: auto;
    flex: 1;
}

.crop-preview-info {
    display: flex;
    gap: var(--space-xl);
    margin-bottom: var(--space-lg);
    padding: var(--space-md);
    background: var(--surface);
    border-radius: var(--radius-md);
}

.crop-info-item {
    display: flex;
    gap: var(--space-sm);
}

.crop-info-label {
    font-weight: 600;
    color: var(--text-secondary);
}

.crop-info-value {
    color: var(--primary);
    font-weight: 600;
}

.crop-canvas-container {
    position: relative;
    width: 100%;
    max-width: 800px;
    margin: 0 auto var(--space-lg);
    background: var(--surface-2);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.crop-preview-canvas {
    display: block;
    margin: 0 auto;
    max-width: 100%;
    max-height: 500px;
}

.crop-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    /* Clip the infinite shadow */
    pointer-events: none;
}

.crop-frame {
    position: absolute;
    /* Subtle white border for visibility */
    border: 1px solid rgba(255, 255, 255, 0.5);
    /* Dark overlay to clearly show photo area vs background */
    box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.75);
    pointer-events: all;
    cursor: move;
}

.crop-handle {
    position: absolute;
    width: 50px;
    height: 50px;
    background: var(--primary);
    border: 3px solid white;
    border-radius: 50%;
    pointer-events: all;
    cursor: grab;
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

.crop-handle:active {
    cursor: grabbing;
}

.crop-handle-center {
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.crop-handle-center::before {
    content: '✥';
    color: white;
    font-size: var(--text-2xl);
    font-weight: bold;
}

.crop-handle-nw,
.crop-handle-ne,
.crop-handle-sw,
.crop-handle-se {
    width: 20px;
    height: 20px;
    border-width: 2px;
}

.crop-handle-nw {
    top: -10px;
    left: -10px;
    cursor: nwse-resize;
}

.crop-handle-ne {
    top: -10px;
    right: -10px;
    cursor: nesw-resize;
}

.crop-handle-sw {
    bottom: -10px;
    left: -10px;
    cursor: nesw-resize;
}

.crop-handle-se {
    bottom: -10px;
    right: -10px;
    cursor: nwse-resize;
}

.crop-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-md);
    background: var(--surface);
    border-radius: var(--radius-md);
}

.crop-tools-wrapper {
    display: flex;
    align-items: center;
    gap: var(--space-xl);
}

.tool-group {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.tool-label {
    font-size: var(--text-sm);
    color: var(--text-muted);
}

.btn-group {
    display: flex;
    background: var(--background);
    border-radius: var(--radius-md);
    padding: 2px;
    border: 1px solid var(--border);
}

.btn-tool {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--text-lg);
    transition: all 0.2s;
}

.btn-tool:hover {
    background: var(--surface-hover);
    color: var(--text-primary);
}

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

.zoom-controls {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    background: var(--background);
    padding: 4px 8px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
}

.btn-tool.small {
    width: 24px;
    height: 24px;
    font-size: var(--text-md);
}

#zoom-slider {
    width: 100px;
    height: 4px;
    background: var(--border);
    border-radius: 2px;
    outline: none;
    -webkit-appearance: none;
}

#zoom-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    background: var(--primary);
    border-radius: 50%;
    cursor: pointer;
    transition: transform 0.1s;
}

#zoom-slider::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

#zoom-value {
    min-width: 45px;
    text-align: right;
    font-size: var(--text-sm);
    font-variant-numeric: tabular-nums;
    color: var(--text-primary);
}

.crop-mode-toggle label {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    cursor: pointer;
    user-select: none;
}

.crop-mode-toggle input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--primary);
}

.modal-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-lg) var(--space-xl);
    border-top: 1px solid var(--border);
    background: var(--surface);
}

.modal-footer-actions {
    display: flex;
    gap: var(--space-sm);
} 
 