/**
 * CrossPoint to Grimmory Bookmark Sync - Custom Styles
 * 
 * This stylesheet provides custom styles and animations that complement
 * Tailwind CSS utility classes. It includes:
 * - Smooth transitions and animations
 * - Custom scrollbar styling
 * - Step indicator styles
 * - Log entry animations
 */

/* ============================================================================
   GLOBAL STYLES
   ============================================================================ */

* {
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ============================================================================
   CUSTOM SCROLLBAR
   ============================================================================ */

/* Webkit browsers (Chrome, Safari, Edge) */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
    transition: background 0.2s ease;
}

::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* Firefox */
* {
    scrollbar-width: thin;
    scrollbar-color: #cbd5e1 #f1f5f9;
}

/* ============================================================================
   STEP INDICATOR STYLES
   ============================================================================ */

.step-indicator {
    background-color: #e2e8f0;
    color: #64748b;
    transition: all 0.3s ease;
    font-weight: 600;
}

.step-indicator[data-step="1"].bg-primary,
.step-indicator[data-step="2"].bg-primary,
.step-indicator[data-step="3"].bg-primary {
    animation: pulse-step 1s ease-in-out;
}

.step-line {
    transition: all 0.3s ease;
}

@keyframes pulse-step {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
    }
}

/* ============================================================================
   FORM ELEMENTS
   ============================================================================ */

input[type="text"],
input[type="url"],
input[type="password"] {
    transition: all 0.2s ease;
}

input[type="text"]:focus,
input[type="url"]:focus,
input[type="password"]:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

input[type="checkbox"] {
    cursor: pointer;
    transition: all 0.2s ease;
}

input[type="checkbox"]:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* ============================================================================
   BUTTON STYLES
   ============================================================================ */

button {
    cursor: pointer;
    user-select: none;
    transition: all 0.2s ease;
}

button:active {
    transform: translateY(1px);
}

button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
}

/* ============================================================================
   DROP ZONE STYLES
   ============================================================================ */

#dropZone {
    transition: all 0.3s ease;
    border-width: 3px;
}

#dropZone.border-primary {
    border-color: #3b82f6;
}

#dropZone svg {
    transition: all 0.3s ease;
}

#dropZone:hover svg {
    transform: translateY(-4px);
}

#dropZone.border-primary svg {
    color: #3b82f6;
    transform: scale(1.1);
}

/* ============================================================================
   SYNC LOG STYLES
   ============================================================================ */

#syncLog {
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', 'Consolas', 'Courier New', monospace;
    font-size: 13px;
    line-height: 1.6;
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
    box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.3);
}

.log-entry {
    padding: 2px 0;
    animation: fadeInLog 0.3s ease;
    word-wrap: break-word;
    white-space: pre-wrap;
}

@keyframes fadeInLog {
    from {
        opacity: 0;
        transform: translateX(-10px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* ============================================================================
   BOOKMARKS MODAL STYLES
   ============================================================================ */

#bookmarksModal {
    animation: fadeInModal 0.2s ease;
}

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

#bookmarksModal > div {
    animation: slideUpModal 0.3s ease;
}

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

.line-clamp-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ============================================================================
   STATS PANEL ANIMATION
   ============================================================================ */

#syncStatsPanel > div {
    animation: popIn 0.4s ease;
}

@keyframes popIn {
    0% {
        transform: scale(0.8);
        opacity: 0;
    }
    50% {
        transform: scale(1.05);
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

/* ============================================================================
   PROGRESS BAR ANIMATION
   ============================================================================ */

#overallProgressBar {
    transition: width 0.4s ease;
}

/* ============================================================================
   FILE LIST STYLES
   ============================================================================ */

#selectedFilesList {
    scrollbar-width: thin;
}

.file-item-enter {
    animation: slideInFile 0.3s ease;
}

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

/* ============================================================================
   CARD SHADOW EFFECTS
   ============================================================================ */

.bg-white {
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
}

/* ============================================================================
   ERROR MESSAGE STYLES
   ============================================================================ */

#credentialsError {
    animation: shakeError 0.4s ease;
}

@keyframes shakeError {
    0%, 100% {
        transform: translateX(0);
    }
    25% {
        transform: translateX(-10px);
    }
    75% {
        transform: translateX(10px);
    }
}

/* ============================================================================
   VIEW TRANSITIONS
   ============================================================================ */

#credentialsView,
#fileSelectionView,
#syncProgressView {
    animation: fadeInView 0.4s ease;
}

@keyframes fadeInView {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ============================================================================
   LOADING SPINNER (for future use)
   ============================================================================ */

.spinner {
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top-color: #ffffff;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    animation: spin 0.8s linear infinite;
}

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

/* ============================================================================
   RESPONSIVE ADJUSTMENTS
   ============================================================================ */

@media (max-width: 640px) {
    #progressIndicator .flex {
        flex-direction: column;
        align-items: flex-start;
    }

    #progressIndicator .step-line {
        width: 1px;
        height: 20px;
        margin: 4px 0;
    }

    #syncLog {
        font-size: 11px;
        max-height: 300px;
    }
}

/* ============================================================================
   ACCESSIBILITY IMPROVEMENTS
   ============================================================================ */

/* Focus visible for keyboard navigation */
*:focus-visible {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}

/* Reduce motion for users who prefer it */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .border-slate-300 {
        border-color: #000000 !important;
    }
    
    .text-slate-600 {
        color: #000000 !important;
    }
}

/* ============================================================================
   UTILITY CLASSES
   ============================================================================ */

.gradient-text {
    background: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.shadow-glow {
    box-shadow: 0 0 20px rgba(59, 130, 246, 0.3);
}

.hover-lift {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.hover-lift:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
}

/* ============================================================================
   PRINT STYLES
   ============================================================================ */

@media print {
    body {
        background: white;
    }
    
    #syncLog {
        background: white;
        color: black;
        border: 1px solid black;
    }
    
    button {
        display: none;
    }
}
