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

:root {
    --primary-color: #2563eb;
    --secondary-color: #64748b;
    --success-color: #10b981;
    --danger-color: #ef4444;
    --warning-color: #f59e0b;
    --bg-color: #f8fafc;
    --card-bg: #ffffff;
    --text-color: #1e293b;
    --text-muted: #64748b;
    --border-color: #e2e8f0;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.1);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
}

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

header {
    text-align: center;
    margin-bottom: 40px;
    padding: 30px 0;
}

header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    color: var(--primary-color);
}

.subtitle {
    color: var(--text-muted);
    font-size: 1.1rem;
}

/* Upload Section */
.upload-section {
    margin-bottom: 30px;
}

.upload-area {
    background: var(--card-bg);
    border: 3px dashed var(--border-color);
    border-radius: 12px;
    padding: 60px 40px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    touch-action: manipulation; /* Tablet/mobil için touch optimize */
    -webkit-tap-highlight-color: transparent; /* Tap highlight kaldır */
}

.upload-area:hover {
    border-color: var(--primary-color);
    background: #f0f7ff;
}

.upload-area.drag-over {
    border-color: var(--primary-color);
    background: #e0f2fe;
    transform: scale(1.02);
}

.upload-area svg {
    color: var(--primary-color);
    margin-bottom: 20px;
}

.upload-area h3 {
    margin-bottom: 10px;
    font-size: 1.5rem;
}

.upload-area p {
    color: var(--text-muted);
    margin-bottom: 20px;
}

/* Choice Container */
.choice-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
    max-width: 800px;
    margin: 0 auto;
}

.choice-card {
    background: var(--card-bg);
    border: 2px solid var(--border-color);
    border-radius: 16px;
    padding: 40px 30px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}

.choice-card:hover {
    border-color: var(--primary-color);
    transform: translateY(-5px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.12);
}

.choice-card svg {
    color: var(--primary-color);
    margin-bottom: 20px;
    transition: transform 0.3s ease;
}

.choice-card:hover svg {
    transform: scale(1.1);
}

.choice-card h2 {
    font-size: 1.5rem;
    margin-bottom: 12px;
    color: var(--text-primary);
}

.choice-card p {
    color: var(--text-muted);
    margin-bottom: 24px;
    font-size: 0.95rem;
}

.choice-card .btn {
    width: 100%;
    max-width: 200px;
}

/* Buttons */
.btn {
    padding: 10px 24px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    touch-action: manipulation; /* Touch optimize */
    -webkit-tap-highlight-color: transparent; /* Tap highlight kaldır */
    user-select: none; /* Text seçimini engelle */
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

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

.btn-primary:hover:not(:disabled) {
    background: #1d4ed8;
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

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

.btn-secondary:hover:not(:disabled) {
    background: #475569;
}

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

.btn-success:hover:not(:disabled) {
    background: #059669;
}

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

.btn-danger:hover:not(:disabled) {
    background: #dc2626;
}

.btn-icon {
    padding: 8px;
    background: white;
    border: 1px solid var(--border-color);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-icon:hover:not(:disabled) {
    background: var(--bg-color);
}

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

.mode-divider {
    width: 2px;
    height: 30px;
    background: var(--border-color);
    margin: 0 5px;
}

.btn-sm {
    padding: 6px 16px;
    font-size: 0.9rem;
}

.divider {
    width: 1px;
    height: 24px;
    background: var(--border-color);
    margin: 0 5px;
}

.btn-lg {
    padding: 16px 32px;
    font-size: 1.1rem;
}

/* Viewer Section */
.viewer-section {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 30px;
    box-shadow: var(--shadow);
}

.viewer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 15px;
}

.viewer-footer {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-top: 20px;
    padding-top: 15px;
    border-top: 2px solid var(--border-color);
}

.viewer-controls,
.page-controls {
    display: flex;
    gap: 10px;
    align-items: center;
}

.zoom-level,
.page-info {
    font-weight: 600;
    color: var(--text-color);
    min-width: 80px;
    text-align: center;
}

.canvas-container {
    position: relative;
    overflow: auto;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    background: #f1f5f9;
    min-height: 500px;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 20px;
    width: 100%;
    scroll-behavior: smooth; /* Yumuşak kaydırma */
}

.canvas-wrapper {
    position: relative;
    display: inline-block;
}

#pdfCanvas {
    position: relative;
    cursor: crosshair;
    box-shadow: var(--shadow-lg);
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
    max-width: 100%;
    height: auto;
    display: block;
}

#selectionCanvas {
    position: absolute;
    top: 0;
    left: 0;
    pointer-events: none;
    width: 100%;
    height: 100%;
}

.selection-info {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(37, 99, 235, 0.9);
    color: white;
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: 600;
    z-index: 10;
}

.selection-actions {
    position: absolute;
    background: white;
    padding: 10px;
    border-radius: 8px;
    box-shadow: var(--shadow-lg);
    display: flex;
    gap: 10px;
    z-index: 10;
    pointer-events: auto;
}

/* Fixed Queue Control Bar */
.fixed-queue-bar {
    position: sticky;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 15px 20px;
    border-radius: 12px 12px 0 0;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.15);
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 50;
    margin-top: 15px;
    animation: slideUp 0.3s ease-out;
}

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

.fixed-queue-bar .queue-info {
    display: flex;
    align-items: center;
    gap: 8px;
}

.fixed-queue-bar .queue-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    color: white;
    font-size: 1rem;
    font-weight: 500;
    background: rgba(255, 255, 255, 0.15);
    padding: 8px 16px;
    border-radius: 8px;
    backdrop-filter: blur(10px);
}

.fixed-queue-bar .queue-badge svg {
    color: white;
}

.fixed-queue-bar .queue-badge strong {
    font-size: 1.2rem;
    font-weight: 700;
}

.fixed-queue-bar .queue-controls {
    display: flex;
    gap: 10px;
}

.queue-actions {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: white;
    padding: 15px 25px;
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    display: flex;
    gap: 15px;
    align-items: center;
    z-index: 100;
    border: 3px solid var(--warning-color);
}

.queue-info {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.1rem;
    color: var(--text-color);
}

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

.btn-warning:hover:not(:disabled) {
    background: #d97706;
}

/* Gallery Section */
.gallery-section {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 20px;
    box-shadow: var(--shadow);
    margin-bottom: 30px;
}

.gallery-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 15px;
}

.gallery-header h2 {
    color: var(--text-color);
}

.gallery-controls {
    display: flex;
    gap: 10px;
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.image-card {
    background: white;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    padding: 10px;
    cursor: move;
    transition: all 0.2s ease;
    position: relative;
}

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

.image-card.selected {
    border-color: var(--primary-color);
    background: #eff6ff;
}

.image-card.merged {
    border-color: var(--success-color);
    background: #f0fdf4;
}

.image-card .card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    gap: 8px;
}

.page-number-badge {
    background: linear-gradient(135deg, var(--primary-color), #1e40af);
    color: white;
    padding: 4px 10px;
    border-radius: 6px;
    font-weight: 700;
    font-size: 0.85rem;
    box-shadow: 0 2px 6px rgba(37, 99, 235, 0.3);
}

.image-card .card-number {
    font-weight: 600;
    color: var(--text-muted);
    font-size: 0.85rem;
    flex: 1;
}

.image-card .card-actions {
    display: flex;
    gap: 5px;
}

.icon-btn {
    background: none;
    border: none;
    padding: 4px;
    cursor: pointer;
    font-size: 1.2rem;
    transition: transform 0.2s ease;
}

.icon-btn:hover {
    transform: scale(1.2);
}

.image-card .image-preview {
    width: 100%;
    height: 150px;
    object-fit: contain;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background: #f8fafc;
}

.image-card .image-info {
    margin-top: 8px;
    font-size: 0.85rem;
    color: var(--text-muted);
    text-align: center;
}

.image-card .merge-badge {
    position: absolute;
    top: 5px;
    left: 5px;
    background: var(--success-color);
    color: white;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
}

/* Action Bar */
.action-bar {
    display: flex;
    gap: 15px;
    justify-content: center;
    padding-top: 20px;
    border-top: 2px solid var(--border-color);
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.spinner {
    width: 60px;
    height: 60px;
    border: 6px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.loading-overlay p {
    color: white;
    margin-top: 20px;
    font-size: 1.2rem;
    font-weight: 600;
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    background: white;
    padding: 16px 24px;
    border-radius: 8px;
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 300px;
    animation: slideIn 0.3s ease;
}

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

.toast.success {
    border-left: 4px solid var(--success-color);
}

.toast.error {
    border-left: 4px solid var(--danger-color);
}

.toast.info {
    border-left: 4px solid var(--primary-color);
}

.toast.warning {
    border-left: 4px solid var(--warning-color);
}

.toast-icon {
    font-size: 1.5rem;
}

.toast-message {
    flex: 1;
    font-weight: 500;
}

.toast-close {
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    opacity: 0.5;
}

.toast-close:hover {
    opacity: 1;
}

/* Download Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(4px);
    animation: fadeIn 0.2s ease-out;
}

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

.modal-content {
    background: var(--card-bg);
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 500px;
    width: 90%;
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-header {
    padding: 24px 24px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 2px solid var(--border-color);
}

.modal-header h3 {
    margin: 0;
    font-size: 1.5rem;
    color: var(--primary-color);
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-muted);
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: all 0.2s;
}

.modal-close:hover {
    background: var(--bg-color);
    color: var(--danger-color);
}

.modal-body {
    padding: 24px;
}

.form-group {
    margin-bottom: 24px;
}

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

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--text-color);
    font-size: 0.95rem;
}

.required {
    color: var(--danger-color);
}

.form-input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.2s;
    font-family: inherit;
}

.form-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-input:invalid {
    border-color: var(--danger-color);
}

.input-hint {
    display: block;
    margin-top: 6px;
    font-size: 0.85rem;
    color: var(--text-muted);
    font-style: italic;
}

.format-options {
    display: flex;
    gap: 12px;
}

.format-option {
    flex: 1;
    position: relative;
    cursor: pointer;
}

.format-option input[type="radio"] {
    position: absolute;
    opacity: 0;
}

.format-label {
    display: block;
    padding: 12px 16px;
    background: var(--bg-color);
    border: 2px solid var(--border-color);
    border-radius: 8px;
    text-align: center;
    font-weight: 600;
    transition: all 0.2s;
}

.format-option input[type="radio"]:checked + .format-label {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.format-option:hover .format-label {
    border-color: var(--primary-color);
    background: rgba(37, 99, 235, 0.05);
}

.format-option input[type="radio"]:checked + .format-label:hover {
    background: var(--primary-color);
}

.modal-footer {
    padding: 16px 24px 24px;
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

.modal-footer .btn {
    min-width: 100px;
}

/* Preview Modal */
.preview-modal-content {
    max-width: 95vw;
    max-height: 95vh;
    position: relative;
    background: transparent;
    border-radius: 0;
    box-shadow: none;
    display: flex;
    align-items: center;
    justify-content: center;
}

.preview-close {
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    border: none;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    font-size: 1.8rem;
    cursor: pointer;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    backdrop-filter: blur(10px);
}

.preview-close:hover {
    background: rgba(239, 68, 68, 0.9);
    transform: scale(1.1);
}

#previewImage {
    max-width: 90vw;
    max-height: 90vh;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 25px 100px rgba(0, 0, 0, 0.5);
}

.zoom-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white !important;
    border: none;
    transition: all 0.2s;
}

.zoom-btn:hover {
    transform: scale(1.15);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

/* Responsive Design */
@media (max-width: 768px) {
    header h1 {
        font-size: 1.8rem;
    }

    .container {
        padding: 10px;
    }

    .viewer-header {
        flex-direction: column;
        gap: 10px;
    }

    .viewer-controls {
        flex-wrap: wrap;
        justify-content: center;
        gap: 8px;
    }

    .page-controls {
        width: 100%;
        justify-content: center;
    }

    .canvas-container {
        padding: 10px;
        min-height: 300px;
        height: 60vh; /* Mobilde sabit yükseklik */
        max-height: 60vh;
        overflow-x: hidden;
        overflow-y: auto; /* Dikey scroll için */
        margin: 0 3%; /* Sağ ve sol kenarlarda %3 boşluk */
    }

    #pdfCanvas {
        max-width: 90%; /* PDF daha fazla genişlik kullanabilir */
        max-height: 100%; /* Canvas container içinde kal */
        height: auto;
        width: auto;
        object-fit: contain; /* Oran korunarak sığdır */
        cursor: pointer; /* Better touch indication */
        margin: 0 auto; /* Ortala */
    }

    .gallery-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 15px;
    }

    .action-bar {
        flex-direction: column;
        gap: 10px;
    }

    .btn {
        padding: 12px 20px; /* Larger touch targets */
        font-size: 1rem;
    }

    .btn-icon {
        padding: 12px; /* Larger touch targets for icon buttons */
        min-width: 44px;
        min-height: 44px;
    }

    .btn-lg {
        width: 100%;
        padding: 14px 24px;
    }

    .toast {
        min-width: auto;
        max-width: calc(100vw - 40px);
    }

    .zoom-controls {
        justify-content: center;
        margin: 10px 0;
    }

    .selection-actions {
        flex-direction: column;
        gap: 8px;
        padding: 12px;
        max-width: 90%;
    }

    .selection-actions .btn {
        width: 100%;
        padding: 12px 20px;
    }

    .page-info {
        font-size: 0.95rem;
        padding: 0 10px;
    }

    .modal-content {
        width: 95%;
        max-width: 95%;
    }

    .modal-header h3 {
        font-size: 1.25rem;
    }

    .modal-body {
        padding: 16px;
    }

    .form-group label {
        font-size: 0.95rem;
    }

    .upload-area {
        padding: 40px 20px;
    }

    .upload-area h3 {
        font-size: 1.25rem;
    }

    .image-card {
        touch-action: manipulation; /* Optimize for touch */
    }

    .image-card .card-actions button {
        padding: 8px;
        min-width: 36px;
        min-height: 36px;
    }

    .image-card .card-header {
        padding: 8px;
    }

    .image-card .image-info {
        font-size: 0.85rem;
        padding: 8px;
    }
}

/* Tablet ekranlar için */
/* Tablet Responsive */
@media (max-width: 1024px) and (min-width: 769px) {
    .canvas-container {
        padding: 15px;
        height: 65vh; /* Tablette sabit yükseklik */
        max-height: 65vh;
        overflow-y: auto;
        margin: 0 5%; /* Sağ ve sol kenarlarda %5 boşluk */
    }

    #pdfCanvas {
        max-width: 85%; /* PDF daha fazla genişlik kullanabilir */
        max-height: 100%; /* Canvas container içinde kal */
        height: auto;
        width: auto;
        object-fit: contain; /* Oran korunarak sığdır */
        margin: 0 auto; /* Ortala */
    }
}

/* Tablet Landscape (Yatay) Modu - Özel Ayarlar */
@media (max-width: 1024px) and (min-width: 769px) and (orientation: landscape) {
    .canvas-container {
        height: 70vh; /* Yatayda biraz daha fazla yükseklik */
        max-height: 70vh;
        margin: 0 10%; /* Yatayda sağ ve sol kenarlarda %10 boşluk */
    }
    
    #pdfCanvas {
        max-width: 75%; /* Yatayda PDF daha fazla genişlik, ama scroll için boşluk var */
    }
}

/* Mobil Landscape (Yatay) Modu */
@media (max-width: 768px) and (orientation: landscape) {
    .canvas-container {
        height: 75vh; /* Mobil yatayda daha fazla yükseklik */
        max-height: 75vh;
    }
    
    #pdfCanvas {
        max-width: 90%;
    }
}

/* Scrollbar Stilleri - Tablet ve Mobil için */
@media (max-width: 1024px) {
    .canvas-container {
        scrollbar-width: thin; /* Firefox için ince scrollbar */
        scrollbar-color: #cbd5e1 #f1f5f9; /* Thumb ve track renkleri */
    }
    
    /* Webkit scrollbar (Chrome, Safari, Edge) */
    .canvas-container::-webkit-scrollbar {
        width: 8px;
        height: 8px;
    }
    
    .canvas-container::-webkit-scrollbar-track {
        background: #f1f5f9;
        border-radius: 4px;
    }
    
    .canvas-container::-webkit-scrollbar-thumb {
        background: #cbd5e1;
        border-radius: 4px;
    }
    
    .canvas-container::-webkit-scrollbar-thumb:hover {
        background: #94a3b8;
    }
}

/* Sortable.js Ghost Classes */
.sortable-ghost {
    opacity: 0.4;
    background: #dbeafe;
}

.sortable-chosen {
    cursor: grabbing;
}

/* Exam Builder Section */
.exam-section {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 30px;
    margin-top: 40px;
    box-shadow: var(--shadow);
}

.exam-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    padding-bottom: 20px;
    border-bottom: 2px solid var(--border-color);
}

.exam-header h2 {
    font-size: 1.75rem;
    color: var(--text-color);
    display: flex;
    align-items: center;
    gap: 10px;
}

.exam-controls {
    display: flex;
    gap: 10px;
    align-items: center;
}

/* Exam Configuration Panel */
.exam-config-panel {
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.exam-config-panel h3 {
    margin: 0 0 20px 0;
    font-size: 1.1rem;
    color: var(--text-color);
    font-weight: 600;
}

/* Compact Config Layout */
.config-compact {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.config-row {
    display: grid;
    grid-template-columns: 180px 1fr;
    align-items: center;
    gap: 12px;
}

.config-row label {
    font-size: 0.9rem;
    color: var(--text-color);
    font-weight: 500;
}

.form-input-sm {
    padding: 6px 10px;
    font-size: 0.9rem;
}

.radio-group-inline {
    display: flex;
    gap: 12px;
}

.radio-group-inline .radio-option {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border: 1.5px solid var(--border-color);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    background: white;
}

.radio-group-inline .radio-option:hover {
    border-color: var(--primary-color);
    background: #f0f7ff;
}

.radio-group-inline .radio-option input:checked + span {
    color: var(--primary-color);
    font-weight: 600;
}

.config-checks {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    padding: 12px 0;
    border-top: 1px solid #e5e7eb;
    border-bottom: 1px solid #e5e7eb;
}

.checkbox-label-inline {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    font-size: 0.9rem;
}

.checkbox-label-inline input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
}

.checkbox-label-inline span {
    color: var(--text-color);
}

/* Old config styles - remove preview */
.preview-columns {
    display: flex;
    gap: 10px;
    height: 100%;
}

.preview-column {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.preview-column-divider {
    width: 1px;
    background: repeating-linear-gradient(
        to bottom,
        #ccc 0px,
        #ccc 5px,
        transparent 5px,
        transparent 10px
    );
}

.preview-question {
    background: #f0f0f0;
    padding: 8px;
    border-radius: 4px;
    font-size: 11px;
    color: #666;
    text-align: center;
}

.config-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.config-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.config-group label {
    font-weight: 500;
    font-size: 0.9rem;
    color: var(--text-color);
}

.form-input {
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 1rem;
    transition: all 0.3s ease;
}

.form-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.radio-group {
    display: flex;
    gap: 15px;
}

.radio-option {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.radio-option input[type="radio"] {
    cursor: pointer;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
    cursor: pointer;
    width: 18px;
    height: 18px;
}

.config-actions {
    display: flex;
    justify-content: flex-end;
}

/* Exam Builder Workspace */
.exam-builder-workspace {
    display: flex;
    gap: 30px;
    margin-top: 20px;
    min-height: 500px;
}

.exam-questions-panel,
.exam-pages-panel {
    flex: 1;
    background: white;
    border-radius: 8px;
    padding: 20px;
    box-shadow: var(--shadow);
}

.exam-questions-panel {
    max-width: 350px;
}

.exam-questions-panel h3,
.exam-pages-panel h3 {
    margin-bottom: 15px;
    color: var(--text-color);
    font-size: 1.1rem;
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 10px;
}

/* Questions List */
.exam-questions-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 600px;
    overflow-y: auto;
}

.question-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    background: #f8fafc;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    cursor: move;
    transition: all 0.3s ease;
    position: relative;
}

.question-card:hover {
    border-color: var(--primary-color);
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.2);
    transform: translateY(-2px);
}

.question-card-number {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--primary-color);
    min-width: 50px;
}

.question-card-preview {
    width: 60px;
    height: 40px;
    border-radius: 4px;
    overflow: hidden;
    border: 1px solid var(--border-color);
}

.question-card-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.question-card-info {
    flex: 1;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.question-card-actions {
    display: flex;
    gap: 4px;
    align-items: center;
}

.question-card-remove {
    padding: 4px 8px;
    background: transparent;
    border: none;
    color: var(--danger-color);
    cursor: pointer;
    border-radius: 4px;
    font-size: 1.2rem;
    line-height: 1;
}

.question-card-remove:hover {
    background: #fee;
}

/* Width badges */
.width-badge,
.width-badge-sm {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 600;
    background: #e0e7ff;
    color: #4f46e5;
}

.width-badge.wide,
.width-badge-sm.wide {
    background: #fef3c7;
    color: #d97706;
}

.width-badge-sm {
    padding: 1px 6px;
    font-size: 0.65rem;
}

/* Small icon buttons */
.btn-icon-sm,
.btn-icon-xs {
    padding: 4px 8px;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s ease;
}

.btn-icon-xs {
    padding: 2px 6px;
    font-size: 0.8rem;
}

.btn-icon-sm:hover,
.btn-icon-xs:hover {
    background: #f0f7ff;
    border-color: var(--primary-color);
}

.empty-questions {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-muted);
}

.empty-questions .hint {
    font-size: 0.9rem;
    margin-top: 10px;
}

/* Exam Pages */
.exam-pages-container {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.exam-page-preview {
    background: white;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    padding: 15px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.exam-page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--primary-color);
    font-weight: 600;
    color: var(--primary-color);
}

.exam-page-dropzone {
    min-height: 600px; /* A4 ratio approximation */
    aspect-ratio: 1 / 1.414; /* A4 ratio */
    border: 2px dashed var(--border-color);
    border-radius: 8px;
    padding: 15px;
    background: #f8fafc;
    display: flex;
    flex-direction: column;
    gap: 15px;
    transition: all 0.3s ease;
    position: relative;
}

/* Two column layout for dropzone */
.exam-page-dropzone.two-columns {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    padding: 15px;
}

.exam-page-dropzone.two-columns::before {
    content: '';
    position: absolute;
    left: 50%;
    top: 15px;
    bottom: 15px;
    width: 1px;
    background: var(--border-color);
    transform: translateX(-50%);
}

.exam-page-dropzone:hover {
    border-color: var(--primary-color);
    background: #f0f7ff;
}

.exam-page-dropzone.sortable-ghost {
    background: #dbeafe;
    border-color: var(--primary-color);
}

.drop-hint {
    text-align: center;
    color: var(--text-muted);
    padding: 60px 20px;
    font-style: italic;
}

.exam-page-question {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px;
    background: white;
    border: 2px solid var(--border-color);
    border-radius: 6px;
    position: relative;
    transition: all 0.3s ease;
}

/* Wide questions span 2 columns */
.exam-page-question.wide {
    grid-column: span 2;
}

.exam-page-question:hover {
    border-color: var(--primary-color);
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.15);
}

.exam-page-question .question-number {
    font-weight: bold;
    font-size: 1rem;
    color: var(--primary-color);
    min-width: fit-content;
    display: flex;
    align-items: center;
    gap: 6px;
}

.exam-page-question .question-actions {
    position: absolute;
    top: 8px;
    right: 8px;
    display: flex;
    gap: 4px;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.exam-page-question:hover .question-actions {
    opacity: 1;
}

.exam-page-question img {
    max-width: 150px;
    max-height: 100px;
    border-radius: 4px;
    border: 1px solid var(--border-color);
}

.exam-page-question .remove-from-page {
    position: absolute;
    top: 5px;
    right: 5px;
    padding: 4px 8px;
    background: white;
    border: 1px solid var(--danger-color);
    color: var(--danger-color);
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
    line-height: 1;
}

.exam-page-question .remove-from-page:hover {
    background: var(--danger-color);
    color: white;
}

/* Responsive */
@media (max-width: 1024px) {
    .exam-builder-workspace {
        flex-direction: column;
    }
    
    .exam-questions-panel {
        max-width: 100%;
    }
}

/* Exam Items Container (Old - Keep for backward compatibility) */
.exam-items-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-height: 200px;
}

.exam-items-container:empty {
    display: none;
}

.exam-item {
    display: flex;
    align-items: center;
    gap: 15px;
    background: white;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    padding: 12px;
    transition: all 0.3s ease;
}

.exam-item:hover {
    border-color: var(--primary-color);
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.1);
}

.exam-item-handle {
    cursor: grab;
    color: var(--text-muted);
    padding: 5px;
    display: flex;
    align-items: center;
}

.exam-item-handle:active {
    cursor: grabbing;
}

.exam-item-number {
    font-weight: 600;
    font-size: 1.1rem;
    color: var(--primary-color);
    min-width: 70px;
}

.exam-item-preview {
    flex-shrink: 0;
    width: 100px;
    height: 60px;
    border-radius: 6px;
    overflow: hidden;
    border: 1px solid var(--border-color);
}

.exam-item-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.exam-item-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.exam-item-source {
    font-size: 0.9rem;
    color: var(--text-muted);
}

.exam-item-delete {
    padding: 8px;
    background: transparent;
    border: none;
    color: var(--danger-color);
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.exam-item-delete:hover {
    background: #fee;
}

/* Exam Empty State */
.exam-empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.exam-empty-state svg {
    margin-bottom: 20px;
    color: var(--border-color);
}

.exam-empty-state h3 {
    font-size: 1.5rem;
    margin-bottom: 10px;
    color: var(--text-color);
}

.exam-empty-state p {
    max-width: 500px;
    margin: 0 auto;
}

/* Warning Button Style */
.btn-warning {
    background-color: var(--warning-color);
    color: white;
}

.btn-warning:hover {
    background-color: #d97706;
}

.btn-warning:disabled {
    background-color: #fcd34d;
    cursor: not-allowed;
}

/* Fixed Mode Toggle - Sabit Konum (Sadece Mobil/Tablet) */
.fixed-mode-toggle {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: white;
    padding: 12px 20px;
    border-radius: 50px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15), 0 2px 10px rgba(0, 0, 0, 0.1);
    display: none; /* Masaüstünde gizli */
    gap: 10px;
    align-items: center;
    z-index: 1000;
    border: 2px solid var(--border-color);
}

/* Masaüstünde fixed toggle asla gösterme */
@media (min-width: 1025px) {
    .fixed-mode-toggle {
        display: none !important;
    }
}

/* Tablet ve mobilde göster */
@media (max-width: 1024px) {
    .fixed-mode-toggle.active {
        display: flex;
    }
}

.fixed-mode-toggle .btn-icon {
    width: 45px;
    height: 45px;
}

.fixed-mode-toggle .mode-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    margin: 0 5px;
}

/* Responsive Exam Builder */
@media (max-width: 768px) {
    .exam-header {
        flex-direction: column;
        gap: 15px;
        align-items: stretch;
    }

    .exam-controls {
        flex-direction: column;
    }

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

    .exam-item {
        flex-wrap: wrap;
    }

    .exam-item-preview {
        width: 80px;
        height: 50px;
    }
    
    /* Mobilde fixed toggle daha büyük */
    .fixed-mode-toggle {
        padding: 14px 24px;
        bottom: 15px;
    }
    
    .fixed-mode-toggle .btn-icon {
        width: 50px;
        height: 50px;
    }
}
