/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: #0a0a0a;
    color: #e4e4e7;
    line-height: 1.6;
    min-height: 100vh;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

/* Hero Section */
.hero {
    text-align: center;
    padding: 4rem 0 6rem;
}

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

.hero-title {
    font-size: clamp(2.5rem, 5vw, 4rem);
    font-weight: 700;
    margin-bottom: 1rem;
    animation: fadeInUp 1s ease-out;
}

.gradient-text {
    background: linear-gradient(135deg, #3b82f6, #8b5cf6, #ec4899);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-size: 200% 200%;
    animation: gradientShift 3s ease-in-out infinite;
}

.hero-subtitle {
    font-size: 1.25rem;
    color: #a1a1aa;
    animation: fadeInUp 1s ease-out 0.2s both;
}

/* Cards */
.card {
    background: rgba(24, 24, 27, 0.8);
    border: 1px solid rgba(63, 63, 70, 0.4);
    border-radius: 1rem;
    padding: 2rem;
    margin-bottom: 2rem;
    backdrop-filter: blur(10px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3), 
                0 0 0 1px rgba(255, 255, 255, 0.05);
    animation: cardGlow 3s ease-in-out infinite;
}

.card h2, .card h3 {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
    color: #f4f4f5;
}

.card .detected-fonts-header + .fonts-grid {
    margin-top: 0;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.card-header h2 {
    margin-bottom: 0;
    flex: 1;
}

/* Controls */
.controls {
    display: flex;
    gap: 1rem;
    align-items: center;
    flex-shrink: 0;
}

.controls.initial-state {
    justify-content: flex-end;
}

/* Buttons */
.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 0.5rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-size: 0.875rem;
    position: relative;
    overflow: hidden;
}

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

.btn-primary {
    background: linear-gradient(135deg, #3b82f6, #8b5cf6);
    color: white;
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.3);
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(59, 130, 246, 0.4);
}

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

.btn-secondary {
    background: rgba(63, 63, 70, 0.8);
    color: #e4e4e7;
    border: 1px solid rgba(63, 63, 70, 0.6);
}

.btn-secondary:hover {
    background: rgba(63, 63, 70, 1);
    border-color: rgba(82, 82, 91, 0.8);
}

.btn-icon {
    padding: 0.75rem;
    min-width: 48px;
    min-height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(63, 63, 70, 0.8);
    color: #e4e4e7;
    border: 1px solid rgba(63, 63, 70, 0.6);
}

.btn-icon:hover {
    background: rgba(63, 63, 70, 1);
    border-color: rgba(82, 82, 91, 0.8);
    transform: translateY(-2px);
}

.btn-icon svg {
    width: 20px;
    height: 20px;
}

/* Progress Bar */
.progress-container {
    margin-bottom: 1.5rem;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: rgba(39, 39, 42, 0.8);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 0.75rem;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #3b82f6, #8b5cf6);
    width: 0%;
    transition: width 0.3s ease-out;
    border-radius: 4px;
}

.progress-text {
    font-size: 0.875rem;
    color: #a1a1aa;
}

/* Fingerprint Display */
.fingerprint-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    margin-bottom: 1.5rem;
}

.fingerprint-item label {
    display: block;
    font-size: 0.875rem;
    color: #a1a1aa;
    margin-bottom: 0.5rem;
}

.fingerprint-hash {
    background: rgba(39, 39, 42, 0.8);
    padding: 0.75rem;
    border-radius: 0.5rem;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.875rem;
    color: #3b82f6;
    word-break: break-all;
    border: 1px solid rgba(63, 63, 70, 0.4);
}

.score-container {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.score-value {
    font-size: 2rem;
    font-weight: 700;
    background: linear-gradient(135deg, #3b82f6, #8b5cf6);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.score-badge {
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 500;
    background: rgba(59, 130, 246, 0.2);
    color: #93c5fd;
    border: 1px solid rgba(59, 130, 246, 0.3);
}

.score-badge.high {
    background: rgba(34, 197, 94, 0.2);
    color: #86efac;
    border-color: rgba(34, 197, 94, 0.3);
}

.summary-box {
    background: rgba(39, 39, 42, 0.5);
    padding: 1rem;
    border-radius: 0.5rem;
    border: 1px solid rgba(63, 63, 70, 0.3);
}

.summary-box p {
    font-size: 0.875rem;
    color: #d4d4d8;
}

/* Fonts Grid */
.fonts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1rem;
}

.font-item {
    background: rgba(39, 39, 42, 0.5);
    padding: 1rem;
    border-radius: 0.5rem;
    border: 1px solid rgba(63, 63, 70, 0.3);
    transition: all 0.3s ease;
    opacity: 0;
    transform: translateY(20px);
    animation: fontReveal 0.5s ease-out forwards;
}

.font-item:hover {
    border-color: rgba(59, 130, 246, 0.5);
    background: rgba(39, 39, 42, 0.8);
}

.font-name {
    font-weight: 500;
    font-size: 0.875rem;
    margin-bottom: 0.5rem;
    color: #f4f4f5;
}

.font-preview {
    font-size: 0.75rem;
    color: #a1a1aa;
    font-style: italic;
}

/* Detected Fonts Header */
.detected-fonts-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    flex-wrap: nowrap; /* Prevent wrapping on mobile */
}

.detected-fonts-header h3 {
    margin-bottom: 0;
    white-space: nowrap; /* Prevent title from wrapping */
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1; /* Allow title to take up available space */
    margin-right: 1rem;
}

/* Special animation for Copy Button */
#copyBtn {
    display: none; 
    flex-shrink: 0; /* Prevent the button from shrinking */
}

#copyBtn.is-visible {
    display: flex;
    animation: spring 2.5s ease-in-out infinite;
}


#copyBtn .feather-check {
    color: #22c55e; /* Green checkmark */
}

/* Sharp spring animation with a 2-second pause */
@keyframes spring {
    /* Spring animation (lasts 0.5s) */
    0%   { transform: translateY(0); animation-timing-function: cubic-bezier(0.5, 0, 0.1, 1); }
    8%   { transform: translateY(-20px); animation-timing-function: cubic-bezier(0.9, 0, 0.5, 1); }
    12%  { transform: translateY(10px); }
    16%  { transform: translateY(-10px); }
    20%  { transform: translateY(0); }

    /* Pause (lasts 2s) */
    100% { transform: translateY(0); }
}


/* Animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes gradientShift {
    0%, 100% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
}

@keyframes cardGlow {
    0%, 100% {
        box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3), 
                    0 0 0 1px rgba(255, 255, 255, 0.05);
    }
    50% {
        box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3), 
                    0 0 0 1px rgba(255, 255, 255, 0.08),
                    0 0 20px rgba(59, 130, 246, 0.1);
    }
}

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

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 1.5rem 1rem;
    }
    
    .hero {
        padding: 2rem 0 4rem;
    }

    .hero-title {
        font-size: clamp(2rem, 8vw, 3rem);
    }

    .hero-subtitle {
        font-size: 1.1rem;
    }

    .card-header {
        flex-direction: column;
        gap: 1.5rem;
        align-items: center;
        text-align: center;
    }

    .card-header h2 {
        margin-bottom: 0;
        flex: none;
    }
    
    .fingerprint-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    .controls {
        width: 100%;
        display: flex;
        justify-content: center;
        gap: 1rem;
    }

    .controls.initial-state {
        justify-content: center;
    }

    .btn {
        flex: 0 0 auto;
        min-height: 44px;
    }

    .btn-icon {
        min-width: 44px;
        min-height: 44px;
        padding: 0.6rem;
    }

    .btn-primary {
        padding: 0.6rem 1.2rem;
    }
    
    .fonts-grid {
        grid-template-columns: 1fr;
    }
}
