:root {
    --primary-color: #4F46E5;
    /* Indigo 600 */
    --primary-hover: #4338CA;
    /* Indigo 700 */
    --secondary-color: #64748B;
    /* Slate 500 */
    --bg-color: #F8FAFC;
    /* Slate 50 */
    --card-bg: #FFFFFF;
    --text-main: #1E293B;
    /* Slate 800 */
    --text-muted: #64748B;
    /* Slate 500 */
    --border-color: #E2E8F0;
    /* Slate 200 */
    --danger-color: #EF4444;
    /* Red 500 */
    --success-color: #22C55E;
    /* Green 500 */
    --border-radius: 12px;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-main);
    line-height: 1.6;
}

.app-container {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Header */
.header {
    background: var(--card-bg);
    border-bottom: 1px solid var(--border-color);
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 50;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 700;
    font-size: 1.25rem;
    color: var(--primary-color);
}

.header nav a {
    color: var(--text-main);
    text-decoration: none;
    margin-left: 2rem;
    font-weight: 500;
    transition: color 0.2s;
}

.header nav a:hover {
    color: var(--primary-color);
}

/* Main Content */
.main-content {
    flex: 1;
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
    padding: 3rem 1.5rem;
}

.hero-section {
    text-align: center;
    margin-bottom: 4rem;
}

.hero-section h1 {
    font-size: 3rem;
    font-weight: 800;
    margin-bottom: 1rem;
    background: linear-gradient(to right, var(--primary-color), #818CF8);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hero-section p {
    font-size: 1.25rem;
    color: var(--text-muted);
    margin-bottom: 3rem;
}

/* Mode Tabs */
.mode-tabs {
    display: inline-flex;
    background: #E2E8F0;
    padding: 0.25rem;
    border-radius: 12px;
    margin-bottom: 2rem;
    gap: 0.25rem;
}

.mode-tab {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 10px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    background: transparent;
    color: var(--text-muted);
}

.mode-tab:hover {
    color: var(--text-main);
}

.mode-tab.active {
    background: white;
    color: var(--primary-color);
    box-shadow: var(--shadow-sm);
}

/* Tool Workspace */
.tool-workspace {
    background: var(--card-bg);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    padding: 2rem;
    min-height: 480px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border-color);
    width: 100%;
}

/* Drop Zone */
.drop-zone {
    width: 100%;
    max-width: 600px;
    height: 300px;
    border: 2px dashed var(--border-color);
    border-radius: var(--border-radius);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    background-color: #F8FAFC;
}

.drop-zone:hover,
.drop-zone.dragover {
    border-color: var(--primary-color);
    background-color: #EEF2FF;
    /* Indigo 50 */
}

.drop-zone-content {
    text-align: center;
    pointer-events: none;
    /* Let clicks pass through to container */
}

.drop-zone-content button,
.drop-zone-content input {
    pointer-events: auto;
}

.drop-zone-content h2 {
    font-size: 1.5rem;
    margin: 1rem 0 0.5rem;
}

.upload-icon {
    color: var(--primary-color);
}

/* Helper Classes */
.hidden {
    display: none !important;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
    font-family: inherit;
    font-size: 1rem;
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background-color: var(--primary-hover);
    transform: translateY(-1px);
}

.btn-secondary {
    background-color: white;
    color: var(--text-main);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background-color: var(--bg-color);
}

.btn-danger {
    background-color: #FEF2F2;
    color: var(--danger-color);
}

.btn-danger:hover {
    background-color: #FEE2E2;
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

.btn-lg {
    padding: 1rem 2rem;
    font-size: 1.125rem;
    min-width: 200px;
}

/* Preview Area */
.image-preview-area {
    width: 100%;
}

.toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    gap: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.toolbar-right {
    display: flex;
    gap: 1.5rem;
    align-items: center;
}

.setting-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.setting-group select {
    padding: 0.5rem;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    background-color: white;
    font-family: inherit;
    color: var(--text-main);
}

.image-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
    width: 100%;
}

.image-card {
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    position: relative;
    aspect-ratio: 2/3;
    /* Preview ratio */
    cursor: move;
    /* Fallback */
    cursor: grab;
    transition: transform 0.2s, box-shadow 0.2s;
}

.image-card:active {
    cursor: grabbing;
}

.image-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.image-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.image-card .remove-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 28px;
    height: 28px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--danger-color);
    cursor: pointer;
    border: 1px solid var(--border-color);
    transition: background 0.2s;
}

.image-card .remove-btn:hover {
    background: white;
    transform: scale(1.1);
}

.page-number {
    position: absolute;
    bottom: 8px;
    left: 8px;
    padding: 2px 8px;
    background: rgba(0, 0, 0, 0.6);
    color: white;
    font-size: 0.75rem;
    border-radius: 12px;
    font-weight: 500;
}

.action-area {
    text-align: center;
    margin-top: 2rem;
}

/* Features Section */
.features-section {
    padding: 4rem 0;
}

.features-section h2 {
    text-align: center;
    font-size: 2rem;
    margin-bottom: 3rem;
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
}

.feature-card {
    background: white;
    padding: 2rem;
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
}

.feature-card h3 {
    margin-bottom: 1rem;
    color: var(--primary-color);
}

/* Description Section */
.description-section {
    max-width: 800px;
    margin: 4rem auto;
}

.description-section h2 {
    margin-bottom: 1.5rem;
}

.description-section p {
    margin-bottom: 1rem;
    color: var(--text-muted);
}

.description-section ol {
    margin-left: 1.5rem;
    color: var(--text-muted);
}

.description-section li {
    margin-bottom: 0.5rem;
}

/* Footer */
.footer {
    text-align: center;
    padding: 2rem;
    background: white;
    border-top: 1px solid var(--border-color);
    color: var(--text-muted);
}

/* Responsive */
@media (max-width: 768px) {
    .header {
        padding: 1rem;
    }

    .header nav {
        display: none;
        /* Simple hiding for mobile for now */
    }

    .hero-section h1 {
        font-size: 2rem;
    }

    .tool-workspace {
        padding: 1rem;
    }

    .toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .toolbar-right {
        flex-direction: column;
        align-items: stretch;
    }

    .setting-group {
        flex-direction: column;
        align-items: flex-start;
    }

    .setting-group select {
        width: 100%;
    }
}

/* Alert Banner */
.alert-banner {
    background: linear-gradient(135deg, #FEE2E2 0%, #FECACA 100%);
    border: 2px solid #DC2626;
    border-radius: 8px;
    padding: 1rem 1.5rem;
    margin-bottom: 2rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    box-shadow: 0 2px 8px rgba(220, 38, 38, 0.15);
}

.alert-banner-icon {
    flex-shrink: 0;
    color: #DC2626;
    font-size: 1.5rem;
    font-weight: bold;
}

.alert-banner-content {
    flex: 1;
}

.alert-banner-content h3 {
    color: #991B1B;
    font-size: 1rem;
    font-weight: 700;
    margin: 0 0 0.25rem 0;
}

.alert-banner-content p {
    color: #7F1D1D;
    font-size: 0.875rem;
    margin: 0;
    line-height: 1.5;
}

.alert-banner-content strong {
    color: #991B1B;
}