/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-50: #eff6ff;
    --primary-100: #dbeafe;
    --primary-200: #bfdbfe;
    --primary-500: #3b82f6;
    --primary-600: #2563eb;
    --primary-700: #1d4ed8;
    --secondary-800: #1e293b;
    --secondary-900: #0f172a;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-500: #6b7280;
    --gray-700: #374151;
    --danger-50: #fef2f2;
    --danger-500: #ef4444;
    --danger-600: #dc2626;
    --amber-500: #f59e0b;
    --amber-600: #d97706;
    --emerald-600: #059669;
    --emerald-700: #047857;
    --blue-50: #eff6ff;
    --blue-200: #bfdbfe;
    --blue-700: #1d4ed8;
    --white: #ffffff;
    --black: #000000;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-medium: 0 6px 20px rgba(2, 6, 23, 0.08);
    --radius-sm: 0.25rem;
    --radius-md: 0.375rem;
    --radius-lg: 0.5rem;
    --radius-xl: 0.75rem;
    --radius-2xl: 1rem;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.5;
    color: var(--secondary-800);
    background-color: var(--gray-50);
    padding-top: 60px;
}

.hidden {
    display: none !important;
}

/* Layout */
.page-container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.top-banner {
    width: 100%;
    max-width: 1200px;
    margin: 1rem auto;
    padding: 0 1rem;
}

.main-content {
    flex: 1;
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 1.5rem 1rem;
}

.content-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
}

@media (min-width: 1024px) {
    .content-grid {
        grid-template-columns: 3fr 1fr;
    }
}

/* Main Column */
.main-column {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

/* Page Header */
.page-header {
    border-radius: var(--radius-2xl);
    padding: 1.5rem;
}

.page-title {
    font-size: 1.875rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: var(--secondary-800);
}

.page-description {
    color: var(--secondary-800);
    opacity: 0.8;
    font-size: 1rem;
}

/* Tool Section */
.tool-section {
    background: var(--white);
    border-radius: var(--radius-2xl);
    padding: 1.5rem;
    box-shadow: var(--shadow-medium);
}

/* Upload Section */
.upload-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.upload-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--secondary-800);
}

.file-meta {
    font-size: 0.875rem;
    color: var(--gray-500);
}

.upload-area {
    margin-bottom: 0.5rem;
}

.upload-dropzone {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 8rem;
    border: 2px dashed var(--primary-200);
    border-radius: var(--radius-2xl);
    background: var(--primary-50);
    cursor: pointer;
    transition: background-color 0.15s ease;
}

.upload-dropzone:hover {
    background: var(--primary-100);
}

.upload-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding-top: 1.25rem;
    padding-bottom: 1.5rem;
}

.upload-icon {
    width: 2.5rem;
    height: 2.5rem;
    margin-bottom: 0.75rem;
    color: var(--primary-500);
    stroke: currentColor;
    stroke-width: 2;
}

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

.upload-highlight {
    font-weight: 600;
}

.upload-subtext {
    font-size: 0.75rem;
    color: var(--gray-500);
}

.file-input {
    display: none;
}

.upload-note {
    font-size: 0.75rem;
    color: var(--gray-500);
    margin-top: 0.75rem;
}

/* Preview Section */
.preview-section {
    margin-top: 1.5rem;
}

.preview-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

@media (min-width: 1280px) {
    .preview-grid {
        grid-template-columns: 2fr 1fr;
    }
}

/* Preview Panel */
.preview-panel {
    display: flex;
    flex-direction: column;
}

.preview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.preview-title {
    font-size: 1.125rem;
    font-weight: 500;
    color: var(--secondary-800);
}

.zoom-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.zoom-label {
    font-size: 0.875rem;
    color: var(--gray-500);
}

.zoom-slider {
    width: 6rem;
    height: 0.5rem;
    -webkit-appearance: none;
    appearance: none;
    background: var(--gray-200);
    border-radius: 0.25rem;
    outline: none;
}

.zoom-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 1rem;
    height: 1rem;
    border-radius: 50%;
    background: var(--primary-600);
    cursor: pointer;
}

.zoom-slider::-moz-range-thumb {
    width: 1rem;
    height: 1rem;
    border-radius: 50%;
    background: var(--primary-600);
    cursor: pointer;
    border: none;
}

.zoom-value {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--primary-600);
    width: 3rem;
}

.preview-container {
    background: var(--gray-100);
    border-radius: var(--radius-xl);
    padding: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 400px;
    position: relative;
}

.loading-spinner {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.spinner {
    width: 3rem;
    height: 3rem;
    border: 4px solid var(--primary-500);
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.loading-text {
    color: var(--gray-700);
    margin-top: 0.5rem;
}

.main-canvas {
    max-width: 100%;
    height: auto;
    border-radius: var(--radius-lg);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.preview-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 1rem;
}

.page-info {
    font-size: 0.875rem;
    color: var(--gray-500);
}

.current-page {
    font-weight: 500;
}

.total-pages {
    font-weight: 500;
}

.image-download-btn {
    padding: 0.5rem 0.75rem;
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-lg);
    font-size: 0.875rem;
    color: var(--gray-700);
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: var(--shadow-sm);
}

.image-download-btn:hover {
    background: var(--gray-50);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* Controls Panel */
.controls-panel {
    background: var(--gray-50);
    border-radius: var(--radius-xl);
    padding: 1.25rem;
}

.controls-title {
    font-size: 1.125rem;
    font-weight: 500;
    color: var(--secondary-800);
    margin-bottom: 1rem;
}

.controls-grid {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.button-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
}

.control-btn {
    padding: 0.75rem;
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-lg);
    font-size: 0.875rem;
    color: var(--gray-700);
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    box-shadow: var(--shadow-sm);
}

.control-btn:hover {
    background: var(--gray-50);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.full-width {
    grid-column: 1 / -1;
}

.range-section {
    padding-top: 0.75rem;
    border-top: 1px solid var(--gray-200);
}

.range-label {
    font-size: 0.875rem;
    color: var(--gray-500);
    margin-bottom: 0.5rem;
}

.range-input-group {
    display: flex;
    gap: 0.5rem;
}

.range-input {
    flex: 1;
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--gray-300);
    font-size: 0.875rem;
}

.range-apply-btn {
    padding: 0.5rem 0.75rem;
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-lg);
    font-size: 0.875rem;
    color: var(--gray-700);
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    box-shadow: var(--shadow-sm);
}

.range-apply-btn:hover {
    background: var(--gray-50);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* Action Buttons */
.action-buttons {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    padding-top: 1rem;
    border-top: 1px solid var(--gray-200);
}

.action-btn {
    padding: 0.75rem;
    border-radius: var(--radius-lg);
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    box-shadow: var(--shadow-sm);
}

.keep-btn {
    background: var(--amber-500);
    color: var(--white);
}

.keep-btn:hover {
    background: var(--amber-600);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.delete-btn {
    background: var(--white);
    color: var(--danger-500);
    border: 1px solid var(--danger-500) !important;
}

.delete-btn:hover {
    background: var(--danger-50);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.export-btn {
    background: var(--emerald-600);
    color: var(--white);
}

.export-btn:hover {
    background: var(--emerald-700);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.export-icon {
    width: 1.25rem;
    height: 1.25rem;
    margin-right: 0.5rem;
    stroke: currentColor;
    stroke-width: 2;
}

/* Shortcuts */
.shortcuts {
    margin-top: 1rem;
    font-size: 0.75rem;
    color: var(--gray-500);
}

.shortcuts-title {
    font-weight: 500;
    margin-bottom: 0.25rem;
}

/* Selection Info */
.selection-info {
    margin-top: 1rem;
    padding: 0.75rem;
    background: var(--blue-50);
    border-radius: var(--radius-lg);
    border: 1px solid var(--blue-200);
    font-size: 0.75rem;
    color: var(--blue-700);
}

.info-label {
    font-weight: 500;
}

.count {
    font-weight: 600;
}

/* Thumbnails Section */
.thumbnails-section {
    background: var(--gray-50);
    border-radius: var(--radius-xl);
    padding: 1.25rem;
}

.thumbnails-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.thumbnails-title {
    font-size: 1.125rem;
    font-weight: 500;
    color: var(--secondary-800);
}

.thumbnails-subtitle {
    font-size: 0.875rem;
    color: var(--gray-500);
}

.thumbnails-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
}

@media (min-width: 640px) {
    .thumbnails-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (min-width: 768px) {
    .thumbnails-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media (min-width: 1024px) {
    .thumbnails-grid {
        grid-template-columns: repeat(5, 1fr);
    }
}

@media (min-width: 1280px) {
    .thumbnails-grid {
        grid-template-columns: repeat(6, 1fr);
    }
}

/* Thumbnail Item */
.thumbnail-item {
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
}

.thumbnail-item:hover {
    transform: scale(1.03);
}

.thumbnail-item.active .thumbnail-inner {
    border-color: var(--primary-500);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

.thumbnail-inner {
    position: relative;
    overflow: hidden;
    border-radius: var(--radius-lg);
    border: 1px solid var(--gray-200);
    background: var(--white);
}

.thumbnail-canvas {
    width: 100%;
    height: auto;
    display: block;
}

.thumbnail-page-number {
    position: absolute;
    bottom: 0.5rem;
    left: 0.5rem;
    background: rgba(0, 0, 0, 0.7);
    color: var(--white);
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
    border-radius: 9999px;
}

.checkmark {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    width: 1.5rem;
    height: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--white);
    border: 1px solid var(--gray-300);
    border-radius: 0.25rem;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.75rem;
}

.checkmark:hover {
    background: var(--danger-50);
    border-color: var(--danger-500);
}

.checkmark.selected {
    background: var(--danger-500);
    border-color: var(--danger-600);
    color: var(--white);
}

/* Ad Section */
.ad-section {
    text-align: center;
}

/* SEO Content */
.seo-content {
    background: var(--white);
    border-radius: var(--radius-2xl);
    padding: 1.5rem;
    box-shadow: var(--shadow-medium);
}

.seo-content h2 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--secondary-800);
    margin-bottom: 1rem;
}

.seo-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

@media (min-width: 768px) {
    .seo-grid {
        grid-template-columns: 1fr 1fr;
    }
}

.seo-column h3 {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--secondary-800);
    margin-bottom: 0.75rem;
}

.guide-list {
    list-style-type: decimal;
    list-style-position: inside;
    color: var(--gray-700);
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.step-highlight {
    font-weight: 500;
}

.benefits-list {
    list-style-type: disc;
    list-style-position: inside;
    color: var(--gray-700);
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.benefit-highlight {
    font-weight: 500;
}

/* FAQ Section */
.faq-section {
    padding-top: 1rem;
    border-top: 1px solid var(--gray-200);
    margin-bottom: 1.5rem;
}

.faq-section h3 {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--secondary-800);
    margin-bottom: 0.75rem;
}

.faq-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.faq-item h4 {
    font-weight: 500;
    color: var(--secondary-800);
    margin-bottom: 0.25rem;
}

.faq-item p {
    font-size: 0.875rem;
    color: var(--gray-700);
}

/* Use Cases */
.use-cases {
    padding-top: 1.5rem;
    border-top: 1px solid var(--gray-200);
    margin-bottom: 1.5rem;
}

.use-cases h3 {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--secondary-800);
    margin-bottom: 0.75rem;
}

.use-cases-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
}

@media (min-width: 768px) {
    .use-cases-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

.use-case {
    background: var(--gray-50);
    padding: 1rem;
    border-radius: var(--radius-lg);
}

.use-case h4 {
    font-weight: 500;
    color: var(--secondary-800);
    margin-bottom: 0.5rem;
}

.use-case p {
    font-size: 0.875rem;
    color: var(--gray-700);
}

/* Browser Compatibility */
.browser-compatibility {
    padding-top: 1.5rem;
    border-top: 1px solid var(--gray-200);
}

.browser-compatibility h3 {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--secondary-800);
    margin-bottom: 0.75rem;
}

.browser-compatibility > p {
    font-size: 0.875rem;
    color: var(--gray-700);
    margin-bottom: 1rem;
}

.browser-list {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
}

.browser-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--gray-700);
}

.browser-icon {
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: var(--white);
}

.browser-icon.chrome {
    background: var(--primary-100);
    color: var(--primary-600);
}

.browser-icon.firefox {
    background: #fed7aa;
    color: #ea580c;
}

.browser-icon.edge {
    background: var(--primary-50);
    color: var(--primary-700);
}

.browser-icon.safari {
    background: var(--gray-100);
    color: var(--secondary-800);
}

/* Sidebar */
.sidebar-column {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.sidebar-sticky {
    position: sticky;
    top: 1.5rem;
}

/* Info Box */
.info-box {
    background: var(--primary-50);
    border-radius: var(--radius-2xl);
    padding: 1.25rem;
    border: 1px solid var(--primary-100);
    margin-top: 1.5rem;
}

.info-box h3 {
    font-weight: 600;
    color: var(--secondary-800);
    margin-bottom: 0.75rem;
}

.info-box > p {
    font-size: 0.875rem;
    color: var(--secondary-800);
    margin-bottom: 1rem;
}

.info-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    font-size: 0.75rem;
    color: var(--secondary-800);
}

.info-list li {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
}

.check-icon {
    width: 1rem;
    height: 1rem;
    color: var(--primary-600);
    stroke: currentColor;
    stroke-width: 2;
    flex-shrink: 0;
    margin-top: 0.125rem;
}

/* Related Tools */
.related-tools {
    background: var(--white);
    border-radius: var(--radius-2xl);
    padding: 1.25rem;
    border: 1px solid var(--gray-200);
    margin-top: 1.5rem;
}

.related-tools h3 {
    font-weight: 600;
    color: var(--secondary-800);
    margin-bottom: 0.75rem;
}

.tools-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: var(--secondary-800);
}

.tools-list li {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: color 0.15s ease;
}

.tools-list li:hover {
    color: var(--primary-600);
}

.tools-list a {
    color: inherit;
    text-decoration: none;
}

.tools-list a:hover {
    text-decoration: underline;
}

.tool-icon {
    width: 1rem;
    height: 1rem;
    color: var(--gray-500);
    stroke: currentColor;
    stroke-width: 2;
}
/* Rotation-specific styles */
.rotate-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.rotate-icon {
    width: 1.25rem;
    height: 1.25rem;
    stroke: currentColor;
    stroke-width: 2;
}