/* ============================================
   IMAGE TO PDF - BEVAR ORIGINAL ORIENTERING
   ============================================ */

:root {
    --primary: #667eea;
    --primary-dark: #5a67d8;
    --primary-light: #818cf8;
    --secondary: #764ba2;
    --success: #10b981;
    --success-dark: #059669;
    --danger: #ef4444;
    --warning: #f59e0b;
    --info: #3b82f6;
    --bg: #f8fafc;
    --bg-card: #ffffff;
    --bg-hover: #f1f5f9;
    --text: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    --border: #e2e8f0;
    --border-light: #f1f5f9;
    --shadow: 0 4px 20px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 8px 30px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 20px 60px rgba(0, 0, 0, 0.10);
    --shadow-xl: 0 30px 80px rgba(0, 0, 0, 0.15);
    --radius: 16px;
    --radius-lg: 20px;
    --radius-md: 12px;
    --radius-sm: 10px;
    --radius-xs: 6px;
    --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* ============================================
   RESET & BASE
   ============================================ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 24px;
}

/* ============================================
   SCROLLBAR
   ============================================ */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: var(--bg-hover);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* ============================================
   HEADER
   ============================================ */
.header {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    padding: 12px 0;
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(12px);
    background: rgba(255, 255, 255, 0.92);
    transition: var(--transition);
}

.header-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--text);
    text-decoration: none;
}

.logo i {
    font-size: 1.6rem;
    color: #e74c3c;
}

.logo span {
    color: var(--primary);
}

.logo-badge {
    background: linear-gradient(135deg, var(--success), var(--success-dark));
    color: white;
    font-size: 0.5rem;
    font-weight: 700;
    padding: 2px 10px;
    border-radius: 12px;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.header-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.badge {
    background: var(--bg-hover);
    padding: 4px 14px;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 500;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 6px;
    transition: var(--transition);
}

.badge i {
    font-size: 0.65rem;
}

.quality-badge {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
}

/* ============================================
   HERO
   ============================================ */
.hero {
    padding: 32px 0 24px;
    text-align: center;
    background: linear-gradient(180deg, rgba(102, 126, 234, 0.05) 0%, transparent 100%);
}

.hero-content {
    max-width: 700px;
    margin: 0 auto;
}

.hero h1 {
    font-size: 2.2rem;
    font-weight: 800;
    color: var(--text);
    letter-spacing: -0.5px;
    margin-bottom: 6px;
}

.hero p {
    font-size: 1.05rem;
    color: var(--text-secondary);
    margin-bottom: 14px;
}

.hero p strong {
    color: var(--primary);
}

.hero-features {
    display: flex;
    justify-content: center;
    gap: 24px;
    flex-wrap: wrap;
}

.hero-features span {
    font-size: 0.8rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 6px;
    background: var(--bg-card);
    padding: 4px 14px;
    border-radius: 20px;
    border: 1px solid var(--border);
}

.hero-features i {
    color: var(--success);
    font-size: 0.75rem;
}

/* ============================================
   MAIN GRID
   ============================================ */
.main {
    padding: 0 0 30px 0;
}

.main-grid {
    display: grid;
    grid-template-columns: 440px 1fr;
    gap: 24px;
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow-lg);
    min-height: 600px;
    border: 1px solid var(--border-light);
}

/* ============================================
   LEFT PANEL
   ============================================ */
.left-panel {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* Upload Zone */
.upload-zone {
    border: 2px dashed var(--border);
    border-radius: var(--radius-md);
    padding: 28px 20px;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    background: var(--bg);
    position: relative;
}

.upload-zone:hover {
    border-color: var(--primary);
    background: rgba(102, 126, 234, 0.04);
}

.upload-zone.dragover {
    border-color: var(--primary);
    background: rgba(102, 126, 234, 0.08);
    transform: scale(1.01);
}

.upload-zone .upload-icon {
    font-size: 2.8rem;
    color: var(--primary);
    margin-bottom: 6px;
    transition: var(--transition);
}

.upload-zone:hover .upload-icon {
    transform: translateY(-2px);
}

.upload-zone h3 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text);
}

.upload-zone p {
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.upload-zone .browse-link {
    color: var(--primary);
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.upload-zone .browse-link:hover {
    text-decoration: underline;
}

.upload-formats {
    margin-top: 8px;
    font-size: 0.65rem;
    color: var(--text-muted);
    font-weight: 500;
    letter-spacing: 0.3px;
}

/* Image List */
.image-list {
    background: var(--bg);
    border-radius: var(--radius-md);
    overflow: hidden;
    flex: 1;
    min-height: 160px;
    max-height: 220px;
    display: flex;
    flex-direction: column;
    border: 1px solid var(--border-light);
}

.image-list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px;
    border-bottom: 1px solid var(--border);
    font-weight: 600;
    font-size: 0.8rem;
    color: var(--text-secondary);
    background: var(--bg-card);
}

.image-list-header i {
    color: var(--primary);
}

.image-list-actions {
    display: flex;
    gap: 6px;
}

.clear-btn {
    background: none;
    border: none;
    color: var(--danger);
    cursor: pointer;
    font-size: 0.65rem;
    font-weight: 500;
    padding: 4px 10px;
    border-radius: var(--radius-xs);
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 4px;
}

.clear-btn:hover {
    background: rgba(239, 68, 68, 0.1);
}

.image-list-body {
    flex: 1;
    overflow-y: auto;
    padding: 6px 8px;
}

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--text-muted);
    font-size: 0.8rem;
    padding: 16px;
}

.empty-state i {
    font-size: 2rem;
    margin-bottom: 6px;
    opacity: 0.4;
}

.image-list-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 10px;
    border-radius: var(--radius-xs);
    cursor: pointer;
    transition: var(--transition);
}

.image-list-item:hover {
    background: var(--bg-hover);
}

.image-list-item img {
    width: 36px;
    height: 36px;
    object-fit: cover;
    border-radius: 4px;
    border: 1px solid var(--border);
    flex-shrink: 0;
}

.image-list-item-info {
    flex: 1;
    min-width: 0;
}

.image-list-item-name {
    display: block;
    font-size: 0.7rem;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--text);
}

.image-list-item-size {
    font-size: 0.6rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 4px;
}

.image-list-item-remove {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: var(--transition);
    flex-shrink: 0;
}

.image-list-item-remove:hover {
    color: var(--danger);
    background: rgba(239, 68, 68, 0.1);
}

/* Settings Panel */
.settings-panel {
    background: var(--bg);
    border-radius: var(--radius-md);
    padding: 14px 16px;
    border: 1px solid var(--border-light);
}

.settings-panel h4 {
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text);
}

.settings-panel h4 i {
    color: var(--primary);
}

.setting-group {
    margin-bottom: 12px;
}

.setting-group:last-child {
    margin-bottom: 0;
}

.setting-group label {
    display: block;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.setting-group label i {
    margin-right: 4px;
    color: var(--primary);
}

.setting-group select {
    width: 100%;
    padding: 6px 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius-xs);
    font-size: 0.8rem;
    background: white;
    color: var(--text);
    transition: var(--transition);
    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='%236b7280' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    padding-right: 32px;
}

.setting-group select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* ============================================
   ORIENTERING - AUTO MODE
   ============================================ */
.orientation-group {
    background: var(--bg-card);
    border-radius: var(--radius-xs);
    padding: 12px 14px;
    border: 1px solid var(--border);
}

.orientation-mode {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 6px;
}

.orientation-mode-btn {
    padding: 8px 6px;
    border: 2px solid var(--border);
    border-radius: var(--radius-xs);
    background: white;
    cursor: pointer;
    transition: var(--transition);
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

.orientation-mode-btn i {
    font-size: 1rem;
    color: var(--text-muted);
    transition: var(--transition);
}

.orientation-mode-btn span {
    font-weight: 600;
    font-size: 0.75rem;
    color: var(--text-secondary);
    transition: var(--transition);
}

.orientation-mode-btn small {
    font-size: 0.55rem;
    color: var(--text-muted);
}

.orientation-mode-btn:hover {
    border-color: var(--primary);
    background: var(--bg-hover);
    transform: translateY(-1px);
}

.orientation-mode-btn.active {
    border-color: var(--primary);
    background: rgba(102, 126, 234, 0.08);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.orientation-mode-btn.active i {
    color: var(--primary);
}

.orientation-mode-btn.active span {
    color: var(--primary);
}

.orientation-status {
    margin-top: 8px;
    padding: 6px 12px;
    background: var(--bg-hover);
    border-radius: var(--radius-xs);
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.7rem;
    color: var(--text-secondary);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
    flex-shrink: 0;
}

.status-dot.auto {
    background: var(--primary);
    animation: pulse-dot 2s ease-in-out infinite;
}

@keyframes pulse-dot {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.4; transform: scale(0.8); }
}

/* ============================================
   MARGINS
   ============================================ */
.margin-inputs {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr 1fr;
    gap: 6px;
}

.margin-inputs div {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.margin-inputs span {
    font-size: 0.55rem;
    color: var(--text-muted);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.margin-inputs input {
    width: 100%;
    padding: 4px 6px;
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 0.7rem;
    text-align: center;
    transition: var(--transition);
}

.margin-inputs input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* ============================================
   RANGE SLIDER
   ============================================ */
.setting-group input[type="range"] {
    width: calc(100% - 50px);
    height: 4px;
    -webkit-appearance: none;
    background: var(--border);
    border-radius: 2px;
    outline: none;
    transition: var(--transition);
}

.setting-group input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--primary);
    cursor: pointer;
    transition: var(--transition);
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

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

.setting-group input[type="range"]::-moz-range-thumb {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--primary);
    cursor: pointer;
    border: none;
}

.setting-group input[type="range"] + span {
    font-size: 0.7rem;
    color: var(--text-secondary);
    margin-left: 8px;
    font-weight: 500;
}

/* ============================================
   ACTIONS
   ============================================ */
.actions-panel {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.btn-primary {
    padding: 12px 24px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(102, 126, 234, 0.4);
}

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

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

.btn-secondary {
    padding: 8px 16px;
    background: var(--bg-hover);
    color: var(--text-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-secondary:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: rgba(102, 126, 234, 0.04);
}

/* ============================================
   PREVIEW PANEL
   ============================================ */
.preview-panel {
    display: flex;
    flex-direction: column;
}

.preview-container {
    flex: 1;
    background: var(--bg);
    border-radius: var(--radius-md);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    border: 1px solid var(--border-light);
    min-height: 450px;
    max-height: 550px;
}

.preview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 16px;
    border-bottom: 1px solid var(--border);
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-secondary);
    background: var(--bg-card);
    flex-wrap: wrap;
    gap: 6px;
}

.preview-header i {
    color: var(--primary);
}

.orientation-display {
    background: var(--bg-hover);
    padding: 2px 14px;
    border-radius: 12px;
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.preview-grid {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    min-height: 300px;
    max-height: 450px;
    overflow: auto;
    background: var(--bg);
}

.preview-empty {
    text-align: center;
    color: var(--text-muted);
}

.preview-empty i {
    font-size: 4rem;
    display: block;
    margin-bottom: 12px;
    opacity: 0.3;
}

.preview-empty p {
    font-size: 0.9rem;
}

.preview-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    width: 100%;
    max-width: 100%;
    max-height: 100%;
}

.preview-orientation-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--bg-hover);
    padding: 3px 14px;
    border-radius: 20px;
    font-size: 0.65rem;
    font-weight: 600;
    color: var(--text-secondary);
    flex-wrap: wrap;
    justify-content: center;
}

.preview-mode-badge {
    background: var(--bg-card);
    padding: 0 10px;
    border-radius: 10px;
    font-size: 0.55rem;
    color: var(--text-muted);
    border: 1px solid var(--border);
}

.preview-image {
    max-width: 90% !important;
    max-height: 340px !important;
    width: auto !important;
    height: auto !important;
    object-fit: contain !important;
    border-radius: 8px;
    box-shadow: var(--shadow-md);
    background: white;
    padding: 4px;
}

.preview-item-info {
    font-size: 0.65rem;
    color: var(--text-secondary);
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: center;
    padding: 2px 0;
}

.preview-orientation-preview {
    margin-top: 2px;
}

.page-preview {
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--border);
    border-radius: 4px;
    background: white;
    transition: var(--transition);
}

.page-preview.portrait {
    padding: 10px 16px;
    border-color: var(--primary);
    background: rgba(102, 126, 234, 0.04);
}

.page-preview.landscape {
    padding: 14px 10px;
    border-color: #e67e22;
    background: rgba(230, 126, 34, 0.04);
}

.page-preview.square {
    padding: 10px;
    border-color: var(--success);
    background: rgba(16, 185, 129, 0.04);
}

.page-preview-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1px;
    font-size: 0.5rem;
    color: var(--text-muted);
}

.page-preview-inner span:first-child {
    font-size: 1rem;
}

.page-preview-inner small {
    font-size: 0.4rem;
    color: var(--text-muted);
}

/* Preview Footer */
.preview-footer {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 8px 14px;
    border-top: 1px solid var(--border);
    font-size: 0.75rem;
    color: var(--text-secondary);
    background: var(--bg-card);
    flex-wrap: wrap;
}

.preview-nav-btn {
    background: none;
    border: 1px solid var(--border);
    border-radius: 50%;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
    color: var(--text-secondary);
}

.preview-nav-btn:hover:not(:disabled) {
    border-color: var(--primary);
    color: var(--primary);
    background: rgba(102, 126, 234, 0.04);
}

.preview-nav-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.preview-info {
    margin-left: auto;
    font-size: 0.65rem;
    color: var(--text-muted);
}

.preview-orientation-badge-footer {
    display: flex;
    align-items: center;
    gap: 6px;
    background: var(--bg-hover);
    padding: 2px 12px;
    border-radius: 12px;
    font-size: 0.6rem;
    font-weight: 600;
    color: var(--text-secondary);
}

/* ============================================
   LOADING OVERLAY
   ============================================ */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.loading-container {
    background: var(--bg-card);
    padding: 40px 48px;
    border-radius: var(--radius-lg);
    text-align: center;
    max-width: 400px;
    width: 90%;
    box-shadow: var(--shadow-xl);
    animation: scaleIn 0.4s ease;
}

@keyframes scaleIn {
    from { transform: scale(0.9); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

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

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

.loading-container h3 {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 4px;
    color: var(--text);
}

.loading-container p {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.loading-progress {
    margin-top: 16px;
}

.loading-progress-bar {
    height: 6px;
    background: var(--border);
    border-radius: 3px;
    overflow: hidden;
}

.loading-progress-fill {
    height: 100%;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border-radius: 3px;
    transition: width 0.4s ease;
    width: 0%;
}

.loading-progress-text {
    display: block;
    margin-top: 6px;
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.loading-orientation {
    margin-top: 12px;
    font-size: 0.8rem;
    color: var(--text-secondary);
    background: var(--bg-hover);
    padding: 4px 16px;
    border-radius: 20px;
    display: inline-block;
}

.loading-orientation strong {
    color: var(--text);
}

/* ============================================
   TOAST NOTIFICATIONS
   ============================================ */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 99999;
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-width: 380px;
    width: 100%;
}

.toast {
    background: var(--bg-card);
    border-radius: var(--radius-sm);
    padding: 12px 16px;
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: 12px;
    animation: slideInRight 0.4s ease;
    border-left: 4px solid var(--primary);
    transform-origin: top right;
}

.toast.success { border-left-color: var(--success); }
.toast.error { border-left-color: var(--danger); }
.toast.warning { border-left-color: var(--warning); }
.toast.info { border-left-color: var(--info); }

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.toast-icon {
    font-size: 1.2rem;
    flex-shrink: 0;
}

.toast-icon.success { color: var(--success); }
.toast-icon.error { color: var(--danger); }
.toast-icon.warning { color: var(--warning); }
.toast-icon.info { color: var(--info); }

.toast-content {
    flex: 1;
    min-width: 0;
}

.toast-content strong {
    display: block;
    font-size: 0.85rem;
    color: var(--text);
}

.toast-content p {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin: 0;
}

.toast-close {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
    font-size: 1rem;
    transition: var(--transition);
    flex-shrink: 0;
}

.toast-close:hover {
    color: var(--text);
}

/* ============================================
   FOOTER
   ============================================ */
.footer {
    padding: 20px 0;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.8rem;
    border-top: 1px solid var(--border-light);
    margin-top: 8px;
}

.footer p {
    opacity: 0.8;
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 1200px) {
    .main-grid {
        grid-template-columns: 400px 1fr;
    }
}

@media (max-width: 1024px) {
    .main-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    .left-panel {
        max-height: none;
        order: 2;
    }
    .preview-panel {
        order: 1;
        min-height: 400px;
    }
    .image-list {
        max-height: 180px;
    }
    .preview-image {
        max-height: 280px !important;
    }
    .preview-container {
        max-height: 480px;
    }
    .preview-grid {
        max-height: 420px;
    }
}

@media (max-width: 768px) {
    .hero h1 {
        font-size: 1.6rem;
    }
    .hero-features {
        gap: 10px;
    }
    .hero-features span {
        font-size: 0.7rem;
        padding: 3px 10px;
    }
    .container {
        padding: 0 16px;
    }
    .main-grid {
        padding: 16px;
        border-radius: var(--radius-md);
    }
    .header-actions .badge {
        font-size: 0.6rem;
        padding: 2px 10px;
    }
    .margin-inputs {
        grid-template-columns: 1fr 1fr;
    }
    .orientation-mode {
        grid-template-columns: 1fr 1fr 1fr;
    }
    .orientation-mode-btn {
        padding: 6px 4px;
    }
    .orientation-mode-btn span {
        font-size: 0.65rem;
    }
    .orientation-mode-btn small {
        font-size: 0.5rem;
    }
    .upload-zone {
        padding: 20px 16px;
    }
    .upload-zone .upload-icon {
        font-size: 2.2rem;
    }
    .preview-image {
        max-height: 220px !important;
        max-width: 95% !important;
    }
    .preview-container {
        max-height: 400px;
        min-height: 320px;
    }
    .preview-grid {
        max-height: 350px;
        min-height: 250px;
        padding: 12px;
    }
    .preview-orientation-badge {
        font-size: 0.55rem;
        padding: 2px 10px;
        flex-wrap: wrap;
        justify-content: center;
    }
    .page-preview.portrait {
        padding: 8px 14px;
    }
    .page-preview.landscape {
        padding: 12px 8px;
    }
    .page-preview.square {
        padding: 8px;
    }
    .toast-container {
        max-width: 340px;
        right: 12px;
        top: 12px;
    }
    .loading-container {
        padding: 30px 24px;
    }
    .settings-panel {
        padding: 12px 14px;
    }
}

@media (max-width: 480px) {
    .hero h1 {
        font-size: 1.3rem;
    }
    .hero p {
        font-size: 0.85rem;
    }
    .logo {
        font-size: 1rem;
    }
    .logo i {
        font-size: 1.2rem;
    }
    .logo-badge {
        font-size: 0.4rem;
        padding: 1px 6px;
    }
    .header-inner {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }
    .header-actions {
        justify-content: center;
    }
    .main-grid {
        padding: 12px;
        border-radius: var(--radius-sm);
    }
    .preview-grid {
        padding: 10px;
        min-height: 200px;
        max-height: 280px;
    }
    .preview-image {
        max-height: 160px !important;
        max-width: 100% !important;
    }
    .preview-container {
        max-height: 340px;
        min-height: 280px;
    }
    .preview-item {
        gap: 4px;
    }
    .preview-item-info {
        font-size: 0.55rem;
        gap: 6px;
    }
    .preview-orientation-badge {
        font-size: 0.5rem;
        padding: 2px 8px;
    }
    .orientation-mode {
        grid-template-columns: 1fr 1fr 1fr;
        gap: 4px;
    }
    .orientation-mode-btn {
        padding: 4px 2px;
    }
    .orientation-mode-btn i {
        font-size: 0.8rem;
    }
    .orientation-mode-btn span {
        font-size: 0.6rem;
    }
    .margin-inputs {
        grid-template-columns: 1fr 1fr;
        gap: 4px;
    }
    .margin-inputs input {
        font-size: 0.6rem;
        padding: 3px 4px;
    }
    .preview-footer {
        gap: 8px;
        padding: 6px 10px;
        font-size: 0.65rem;
    }
    .preview-nav-btn {
        width: 26px;
        height: 26px;
    }
    .page-preview.portrait {
        padding: 6px 12px;
    }
    .page-preview.landscape {
        padding: 10px 6px;
    }
    .page-preview.square {
        padding: 6px;
    }
    .page-preview-inner span:first-child {
        font-size: 0.8rem;
    }
    .page-preview-inner {
        font-size: 0.45rem;
    }
    .btn-primary {
        font-size: 0.85rem;
        padding: 10px 16px;
    }
    .btn-secondary {
        font-size: 0.7rem;
        padding: 6px 12px;
    }
    .toast-container {
        max-width: 300px;
        right: 8px;
        top: 8px;
    }
    .toast {
        padding: 10px 12px;
        font-size: 0.8rem;
    }
    .loading-container {
        padding: 24px 20px;
    }
    .loading-container h3 {
        font-size: 0.95rem;
    }
    .upload-formats {
        font-size: 0.55rem;
    }
    .image-list-item img {
        width: 30px;
        height: 30px;
    }
    .image-list-item-name {
        font-size: 0.65rem;
    }
    .image-list-item-size {
        font-size: 0.55rem;
    }
}

/* ============================================
   PRINT STYLES
   ============================================ */
@media print {
    .header,
    .hero,
    .footer,
    .actions-panel,
    .upload-zone,
    .image-list,
    .settings-panel,
    .preview-footer {
        display: none !important;
    }
    .main-grid {
        box-shadow: none !important;
        border: none !important;
        padding: 0 !important;
    }
    .preview-panel {
        min-height: auto !important;
    }
    .preview-container {
        border: none !important;
        background: white !important;
        max-height: none !important;
    }
    .preview-image {
        max-height: 100% !important;
    }
}

/* ============================================
   ACCESSIBILITY
   ============================================ */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

/* ============================================
   SELECTION
   ============================================ */
::selection {
    background: var(--primary);
    color: white;
}

/* ============================================
   UTILITY
   ============================================ */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

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

.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }

.mb-1 { margin-bottom: 4px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 12px; }
.mb-4 { margin-bottom: 16px; }

.flex {
    display: flex;
}
.flex-center {
    display: flex;
    align-items: center;
    justify-content: center;
}
.flex-between {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.gap-1 { gap: 4px; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }

.w-full { width: 100%; }
.h-full { height: 100%; }