/* Document Card */
.document-card {
    background: var(--bg-darker);
    /* smoky background */
    border-radius: var(--radius-md);
    overflow: hidden;
    /* inner thin frame */
    border: none;
    box-shadow: inset 0 0 0 1px var(--border-color);
    transition: all var(--transition-fast);
    cursor: pointer;
    max-width: 200px;
    position: relative;
    padding: 8px;
    /* space inside smoky frame */
}

.document-card:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow-md);
}

.document-preview {
    aspect-ratio: 210/297;
    /* A4 dikey oranı */
    background: #f8f9fa;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    border-radius: 6px 6px 0 0;
    /* Soften corners to match card */
    border-bottom: 1px solid var(--border-color);

}

.document-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.document-preview .pdf-icon {
    font-size: 2.5rem;
    color: var(--danger);
    opacity: 0.7;
}

/* Thumbnail Canvas */
.thumbnail-canvas {
    width: 100%;
    height: 100%;
    object-fit: cover;
    /* Fill the area, effectively cropping outer whitespace */
    display: none;
    border-radius: 2px;
}

.thumbnail-fallback {
    display: none;
}

.thumbnail-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: var(--primary);
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 0.5;
    }

    50% {
        opacity: 1;
    }
}

.document-preview:hover .thumbnail-canvas {
    opacity: 0.8;
}

/* Page Count Badge - Corner Triangle */
.page-count-badge {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 0 0 50px 50px;
    border-color: transparent transparent var(--primary) transparent;
    z-index: 5;
}

.page-count-badge i {
    display: none;
}

.page-count-badge .page-count {
    position: absolute;
    bottom: -44px;
    right: 10px;
    color: white;
    font-size: 0.75rem;
    font-weight: 600;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.document-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    flex-wrap: wrap;
    padding: 8px;
    opacity: 0;
    transition: opacity var(--transition-fast);
}

.document-overlay .btn {
    padding: 6px 10px;
    font-size: 0.75rem;
}

.document-overlay .btn-sm {
    min-width: auto;
}

.document-card:hover .document-overlay {
    opacity: 1;
}

.document-info {
    padding: 12px 12px 12px 5px;
    /* Sola 2mm (~7px) kaydırıldı */
}

.document-name {
    font-weight: 500;
    font-size: 0.85rem;
    margin-bottom: 6px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.document-meta {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    /* Sola yasla */
    gap: 4px;
    /* Boşluğu azalt (6px -> 4px) */
    font-size: 0.65rem;
}

.document-size,
.document-date {
    display: flex;
    align-items: center;
    gap: 4px;
    background: var(--bg-card-hover);
    padding: 3px 8px;
    border-radius: 4px;
    /* Köşeleri daha az yuvarlak yap */
    color: var(--text-secondary);
    font-weight: 500;
}

.document-size i,
.document-date i {
    font-size: 0.55rem;
    opacity: 0.7;
}

.document-list-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 14px;
    background: var(--bg-card);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    transition: all var(--transition-fast);
    cursor: pointer;
}

.document-list-item:hover {
    background: var(--bg-card-hover);
    border-color: var(--primary);
}

.document-list-item .pdf-icon {
    font-size: 1.5rem;
    color: var(--danger);
    width: 36px;
    text-align: center;
}

.document-list-item .document-info {
    flex: 1;
    padding: 0;
}

.document-list-item .document-actions {
    display: flex;
    gap: 8px;
}

/* Forms */
.form-input,
.form-select {
    width: 100%;
    padding: 10px 14px;
    background: var(--bg-darker);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.9rem;
    font-family: inherit;
    transition: all var(--transition-fast);
}

.form-input:focus,
.form-select:focus {
    outline: none;
    border-color: var(--primary);
}

.form-input::placeholder {
    color: var(--text-muted);
}

.form-select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%2394a3b8'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 16px;
    padding-right: 40px;
}

.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 9px 16px;
    font-size: 0.875rem;
    font-weight: 500;
    font-family: inherit;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition-fast);
    text-decoration: none;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background: var(--primary-dark);
}

.btn-secondary {
    background: var(--bg-card-hover);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover:not(:disabled) {
    background: var(--bg-card);
    border-color: var(--border-light);
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-danger:hover:not(:disabled) {
    background: #dc2626;
}

.btn-success {
    background: var(--success);
    color: white;
}

.btn-lg {
    padding: 12px 24px;
    font-size: 0.95rem;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.8rem;
}

.btn-icon {
    padding: 8px;
    width: 34px;
    height: 34px;
}

.btn-nav {
    padding: 8px 16px;
    background: var(--bg-card);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-nav:hover:not(:disabled) {
    background: var(--bg-card-hover);
}

/* Search Box */
.search-box {
    position: relative;
    width: 220px;
}

.search-box i {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 0.85rem;
}

.search-box input {
    width: 100%;
    padding: 8px 12px 8px 36px;
    background: var(--bg-darker);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.85rem;
}

.search-box input:focus {
    outline: none;
    border-color: var(--primary);
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 48px 20px;
    color: var(--text-muted);
}

.empty-state i {
    font-size: 3rem;
    color: var(--text-muted);
    opacity: 0.5;
    margin-bottom: 12px;
}

.empty-state h3 {
    font-size: 1rem;
    margin-bottom: 6px;
    color: var(--text-secondary);
    font-weight: 500;
}

/* Modals */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal.active {
    display: flex;
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(2px);
}

.modal-content {
    position: relative;
    background: var(--bg-card);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    max-width: 420px;
    width: 100%;
    max-height: 90vh;
    overflow: hidden;
    animation: modalSlideIn 0.2s ease;
}

.modal-sm {
    max-width: 360px;
}

.preview-modal-content {
    max-width: 90vw;
    max-height: 95vh;
    width: auto;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(20px);
    }

    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
}

.modal-header h2 {
    font-size: 1rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.modal-header h2 i {
    color: var(--primary);
}

.modal-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.modal-body {
    padding: 20px;
    overflow-y: auto;
    max-height: calc(90vh - 120px);
}

.modal-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    padding: 14px 20px;
    border-top: 1px solid var(--border-color);
    background: var(--bg-darker);
}

.file-to-delete {
    font-weight: 600;
    color: var(--danger);
    margin-top: 8px;
}

/* PDF Viewer - Fullscreen Design */

/* Fullscreen Preview Modal */
.preview-fullscreen {
    padding: 0 !important;
}

.preview-fullscreen.active {
    display: block;
}

.preview-fullscreen .modal-overlay {
    background: rgba(0, 0, 0, 0.95);
}

/* Top Toolbar */
.preview-toolbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: linear-gradient(180deg, rgba(15, 23, 42, 0.98) 0%, rgba(15, 23, 42, 0.95) 100%);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    z-index: 1010;
}

.toolbar-left {
    display: flex;
    align-items: center;
    gap: 24px;
}

.toolbar-left h2 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0;
}

.toolbar-left h2 i {
    color: #ef4444;
}

.toolbar-left .page-info {
    font-size: 0.9rem;
    color: var(--text-secondary);
    padding: 6px 14px;
    background: var(--bg-card);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
}

.toolbar-actions {
    display: flex;
    align-items: center;
    gap: 6px;
}

.toolbar-divider {
    width: 1px;
    height: 24px;
    background: var(--border-color);
    margin: 0 8px;
}

.btn-tool {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: transparent;
    color: var(--text-secondary);
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
    font-size: 1rem;
}

.btn-tool:hover {
    background: var(--bg-card-hover);
    color: var(--text-primary);
}

.btn-tool:active {
    transform: scale(0.95);
}

.btn-close-preview {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}

.btn-close-preview:hover {
    background: #ef4444;
    color: white;
}

.zoom-level {
    font-size: 0.85rem;
    color: var(--text-secondary);
    min-width: 50px;
    text-align: center;
    padding: 4px 8px;
    background: var(--bg-card);
    border-radius: var(--radius-sm);
}

/* Side Navigation Buttons */
.nav-btn {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    width: 60px;
    height: 100px;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.9) 0%, rgba(139, 92, 246, 0.9) 100%);
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    z-index: 1010;
    transition: all var(--transition-fast);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.nav-btn:disabled {
    background: rgba(100, 116, 139, 0.5);
    cursor: not-allowed;
    opacity: 0.5;
}

.nav-btn:not(:disabled):hover {
    width: 70px;
    background: linear-gradient(135deg, rgba(99, 102, 241, 1) 0%, rgba(139, 92, 246, 1) 100%);
    box-shadow: var(--shadow-glow);
}

.nav-prev {
    left: 0;
    border-radius: 0 var(--radius-lg) var(--radius-lg) 0;
}

.nav-next {
    right: 0;
    border-radius: var(--radius-lg) 0 0 var(--radius-lg);
}

/* Preview Container */
.preview-container {
    position: fixed;
    top: 70px;
    left: 100px;
    right: 100px;
    bottom: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: auto;
    z-index: 1005;
    padding: 10px 20px;
}

.pdf-viewer-fullscreen {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    padding: 20px;
    box-sizing: border-box;
}

.pdf-viewer-fullscreen #pdf-canvas {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    border-radius: 4px;
    background: white;
}

/* Legacy PDF Viewer (for compatibility) */
.pdf-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

.pdf-navigation {
    display: flex;
    align-items: center;
    gap: 16px;
}

.page-info {
    font-size: 0.95rem;
    color: var(--text-secondary);
}

.pdf-viewer {
    background: var(--bg-darker);
    border-radius: var(--radius-md);
    overflow: auto;
    max-height: 70vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

#pdf-canvas {
    max-width: 100%;
    box-shadow: var(--shadow-lg);
}

/* Responsive for Fullscreen Preview */
@media (max-width: 768px) {
    .preview-toolbar {
        height: 50px;
        padding: 0 10px;
    }

    .toolbar-left h2 span {
        display: none;
    }

    .toolbar-divider {
        display: none;
    }

    .nav-btn {
        width: 45px;
        height: 70px;
        font-size: 1.2rem;
    }

    .preview-container {
        left: 50px;
        right: 50px;
        top: 50px;
    }

    .zoom-level {
        display: none;
    }
}

/* Toast */
#toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.toast {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    background: var(--bg-card);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-xl);
    animation: toastSlideIn 0.3s ease;
    min-width: 300px;
    max-width: 450px;
}

.toast.success {
    border-left: 4px solid var(--success);
}

.toast.error {
    border-left: 4px solid var(--danger);
}

.toast.info {
    border-left: 4px solid var(--secondary);
}

.toast.warning {
    border-left: 4px solid var(--warning);
}

.toast i {
    font-size: 1.25rem;
}

.toast.success i {
    color: var(--success);
}

.toast.error i {
    color: var(--danger);
}

.toast.info i {
    color: var(--secondary);
}

.toast.warning i {
    color: var(--warning);
}

.toast-message {
    flex: 1;
    font-size: 0.9rem;
}

.toast-close {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
    font-size: 1rem;
}

@keyframes toastSlideIn {
    from {
        opacity: 0;
        transform: translateX(50px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}