/* ═══════════════ CUSTOM STYLES ═══════════════ */

/* ── Animations ── */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(12px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(60px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slideOutRight {
    from {
        opacity: 1;
        transform: translateX(0);
    }

    to {
        opacity: 0;
        transform: translateX(60px);
    }
}

@keyframes pulse-ring {
    0% {
        transform: scale(0.8);
        opacity: 1;
    }

    100% {
        transform: scale(2.2);
        opacity: 0;
    }
}

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

@keyframes shimmer {
    0% {
        background-position: -200% 0;
    }

    100% {
        background-position: 200% 0;
    }
}

.animate-fade-in {
    animation: fadeIn 0.5s ease-out both;
}

.animate-fade-in-up {
    animation: fadeInUp 0.5s ease-out both;
}

/* ── Navigation ── */
.nav-link {
    display: inline-flex;
    align-items: center;
    padding: 0.375rem 0.875rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: #6b7280;
    border-radius: 0.5rem;
    transition: all 0.2s;
    text-decoration: none;
}

.nav-link:hover {
    color: #3b82f6;
    background: #eff6ff;
}

.nav-link.active {
    color: #3b82f6;
    background: #eff6ff;
    font-weight: 600;
}

.mobile-nav-link {
    display: block;
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: #6b7280;
    border-radius: 0.5rem;
    transition: all 0.2s;
    text-decoration: none;
}

.mobile-nav-link:hover {
    color: #3b82f6;
    background: #eff6ff;
}

/* ── Tool Cards (Home) ── */
.tool-card {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    padding: 1.5rem;
    background: white;
    border-radius: 1rem;
    border: 1px solid #f1f5f9;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    text-decoration: none;
    animation: fadeInUp 0.4s ease-out both;
}

.tool-card:nth-child(1) {
    animation-delay: 0.05s;
}

.tool-card:nth-child(2) {
    animation-delay: 0.10s;
}

.tool-card:nth-child(3) {
    animation-delay: 0.15s;
}

.tool-card:nth-child(4) {
    animation-delay: 0.20s;
}

.tool-card:nth-child(5) {
    animation-delay: 0.25s;
}

.tool-card:nth-child(6) {
    animation-delay: 0.30s;
}

.tool-card:hover {
    border-color: #bfdbfe;
    box-shadow: 0 8px 25px rgba(59, 130, 246, 0.08);
    transform: translateY(-3px);
}

.tool-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.75rem;
    height: 2.75rem;
    border-radius: 0.75rem;
    margin-bottom: 0.75rem;
}

.tool-icon-lg {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 3.5rem;
    height: 3.5rem;
    border-radius: 1rem;
    margin-bottom: 0.5rem;
}

/* ── Tool Header ── */
.tool-header {
    text-align: center;
    margin-bottom: 2rem;
    animation: fadeIn 0.4s ease-out;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* ── Dropzone ── */
.dropzone {
    position: relative;
    border: 2.5px dashed #cbd5e1;
    border-radius: 1.25rem;
    padding: 3rem 2rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
    background: white;
    animation: fadeInUp 0.5s ease-out 0.1s both;
}

.dropzone:hover {
    border-color: #93c5fd;
    background: #f0f7ff;
}

.dropzone.drag-over {
    border-color: #3b82f6;
    background: #eff6ff;
    border-style: solid;
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.1);
}

.dropzone.drag-over .dropzone-icon svg {
    color: #3b82f6;
    transform: scale(1.15);
}

.dropzone-content {
    pointer-events: none;
}

.dropzone-icon {
    display: flex;
    justify-content: center;
    margin-bottom: 1rem;
}

.dropzone-icon svg {
    transition: all 0.3s;
}

.dropzone-input {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
    pointer-events: auto;
}

/* ── Buttons ── */
.btn-primary {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.75rem;
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: white;
    font-weight: 600;
    font-size: 0.9375rem;
    border-radius: 0.75rem;
    border: none;
    cursor: pointer;
    transition: all 0.25s;
    box-shadow: 0 4px 14px rgba(59, 130, 246, 0.3);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(59, 130, 246, 0.4);
}

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

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

.btn-secondary {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.75rem;
    background: white;
    color: #374151;
    font-weight: 600;
    font-size: 0.9375rem;
    border-radius: 0.75rem;
    border: 1px solid #e5e7eb;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-secondary:hover {
    background: #f9fafb;
    border-color: #d1d5db;
}

.btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border-radius: 0.5rem;
    border: 1px solid #e5e7eb;
    background: white;
    cursor: pointer;
    transition: all 0.2s;
    color: #6b7280;
}

.btn-icon:hover {
    background: #f3f4f6;
    color: #374151;
}

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

/* ── Edit Tool Buttons ── */
.edit-tool-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 0.5rem;
    border: none;
    background: transparent;
    cursor: pointer;
    transition: all 0.2s;
    color: #6b7280;
}

.edit-tool-btn:hover {
    background: #f3f4f6;
    color: #374151;
}

.edit-tool-btn.active {
    background: #eff6ff;
    color: #3b82f6;
    box-shadow: inset 0 0 0 1.5px #bfdbfe;
}

/* ── File List ── */
.file-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.file-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    background: white;
    border-radius: 0.75rem;
    border: 1px solid #f1f5f9;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
    animation: fadeIn 0.3s ease-out both;
    cursor: grab;
    transition: box-shadow 0.2s, border-color 0.2s;
}

.file-item:active {
    cursor: grabbing;
}

.file-item:hover {
    border-color: #e2e8f0;
}

.file-item.sortable-chosen {
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
    border-color: #93c5fd;
}

.file-item .drag-handle {
    color: #cbd5e1;
    cursor: grab;
    flex-shrink: 0;
}

.file-item .file-name {
    flex: 1;
    font-size: 0.875rem;
    font-weight: 500;
    color: #374151;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.file-item .file-size {
    font-size: 0.75rem;
    color: #9ca3af;
    flex-shrink: 0;
}

.file-item .file-remove {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 1.75rem;
    height: 1.75rem;
    border-radius: 0.375rem;
    border: none;
    background: transparent;
    cursor: pointer;
    color: #9ca3af;
    transition: all 0.2s;
    flex-shrink: 0;
}

.file-item .file-remove:hover {
    background: #fef2f2;
    color: #ef4444;
}

/* ── Processing ── */
.processing {
    text-align: center;
    padding: 3rem 2rem;
    animation: fadeIn 0.3s ease-out;
}

.processing-spinner {
    display: inline-block;
    width: 3rem;
    height: 3rem;
    border: 3px solid #e5e7eb;
    border-top-color: #3b82f6;
    border-radius: 50%;
    animation: spin-slow 0.8s linear infinite;
}

.processing-text {
    margin-top: 1rem;
    font-size: 0.9375rem;
    color: #6b7280;
    font-weight: 500;
}

.processing-progress {
    margin-top: 0.75rem;
    width: 100%;
    max-width: 320px;
    height: 6px;
    background: #e5e7eb;
    border-radius: 999px;
    overflow: hidden;
    display: inline-block;
}

.processing-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #3b82f6, #60a5fa);
    border-radius: 999px;
    transition: width 0.3s;
    width: 0%;
}

/* ── Result ── */
.result {
    text-align: center;
    padding: 2rem;
    background: white;
    border-radius: 1rem;
    border: 1px solid #d1fae5;
    animation: fadeIn 0.4s ease-out;
}

.result-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 3.5rem;
    height: 3.5rem;
    border-radius: 50%;
    background: #d1fae5;
    color: #059669;
    margin-bottom: 1rem;
}

.result-title {
    font-size: 1.125rem;
    font-weight: 700;
    color: #065f46;
    margin-bottom: 0.25rem;
}

.result-info {
    font-size: 0.875rem;
    color: #6b7280;
    margin-bottom: 1rem;
}

.result .btn-primary {
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
    box-shadow: 0 4px 14px rgba(5, 150, 105, 0.3);
}

.result .btn-primary:hover {
    box-shadow: 0 6px 20px rgba(5, 150, 105, 0.4);
}

/* ── Toast ── */
.toast {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.875rem 1.25rem;
    background: white;
    border-radius: 0.75rem;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.08), 0 2px 8px rgba(0, 0, 0, 0.04);
    border: 1px solid #e5e7eb;
    font-size: 0.875rem;
    max-width: 380px;
    pointer-events: auto;
    animation: slideInRight 0.35s ease-out;
}

.toast.toast-exit {
    animation: slideOutRight 0.3s ease-in forwards;
}

.toast-error {
    border-left: 4px solid #ef4444;
}

.toast-success {
    border-left: 4px solid #10b981;
}

.toast-info {
    border-left: 4px solid #3b82f6;
}

.toast-icon {
    flex-shrink: 0;
}

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

.toast-close {
    flex-shrink: 0;
    background: none;
    border: none;
    color: #9ca3af;
    cursor: pointer;
    padding: 0.25rem;
    border-radius: 0.25rem;
    transition: color 0.2s;
}

.toast-close:hover {
    color: #374151;
}

/* ── View transitions ── */
.view {
    display: none;
}

.view.active {
    display: block;
    animation: fadeIn 0.35s ease-out;
}

/* ── Scrollbar ── */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 999px;
}

::-webkit-scrollbar-thumb:hover {
    background: #9ca3af;
}

/* ── Header shadow when scrolled ── */
.header-scrolled {
    box-shadow: 0 1px 10px rgba(0, 0, 0, 0.06);
}