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

:root {
    --primary-color: #6366f1;
    --primary-hover: #4f46e5;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;
    --info-color: #3b82f6;
    --text-primary: #1f2937;
    --text-secondary: #6b7280;
    --text-muted: #9ca3af;
    --bg-primary: #f9fafb;
    --bg-secondary: #ffffff;
    --bg-card: #ffffff;
    --border-color: #e5e7eb;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --transition: all 0.2s ease;
}

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

.app-container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header Styles */
.header {
    text-align: center;
    padding: 3rem 1.5rem 2rem;
    background: linear-gradient(135deg, var(--primary-color) 0%, #8b5cf6 100%);
    color: white;
}

.header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    letter-spacing: -0.02em;
}

.tagline {
    font-size: 1.1rem;
    opacity: 0.9;
}

/* Main Content */
.main-content {
    flex: 1;
    max-width: 800px;
    width: 100%;
    margin: 0 auto;
    padding: 2rem 1.5rem;
}

/* Upload Section */
.upload-section {
    margin-bottom: 2rem;
}

.upload-area {
    background: var(--bg-card);
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-lg);
    padding: 3rem 2rem;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
}

.upload-area:hover,
.upload-area.drag-over {
    border-color: var(--primary-color);
    background: #f5f3ff;
}

.upload-icon {
    color: var(--primary-color);
    margin-bottom: 1rem;
}

.upload-text {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.upload-subtext {
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

.supported-formats {
    font-size: 0.875rem;
    color: var(--text-muted);
    background: var(--bg-primary);
    padding: 0.5rem 1rem;
    border-radius: var(--radius-sm);
    display: inline-block;
}

/* Loading Section */
.loading-section {
    text-align: center;
    padding: 4rem 2rem;
}

.spinner {
    width: 48px;
    height: 48px;
    border: 4px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 1rem;
}

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

/* Results Section */
.results-section {
    animation: fadeIn 0.3s ease;
}

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

.font-info-card,
.license-card,
.usage-card,
.attribution-card,
.raw-data-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    margin-bottom: 1rem;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
}

.font-info-card h2,
.license-card h2,
.usage-card h2,
.attribution-card h2 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

/* Font Info Grid */
.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.info-item {
    background: var(--bg-primary);
    padding: 1rem;
    border-radius: var(--radius-md);
}

.info-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-bottom: 0.25rem;
}

.info-value {
    font-weight: 600;
    color: var(--text-primary);
    word-break: break-word;
}

/* License Badge */
.license-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.25rem;
    border-radius: var(--radius-md);
    font-weight: 600;
    margin-bottom: 1rem;
}

.license-badge.free {
    background: #d1fae5;
    color: #065f46;
}

.license-badge.commercial {
    background: #fef3c7;
    color: #92400e;
}

.license-badge.restricted {
    background: #fee2e2;
    color: #991b1b;
}

.license-badge.unknown {
    background: #e5e7eb;
    color: #374151;
}

.badge-icon {
    font-size: 1.25rem;
}

/* License Details */
.license-details {
    background: var(--bg-primary);
    padding: 1rem;
    border-radius: var(--radius-md);
}

.license-name {
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.license-description {
    color: var(--text-secondary);
    font-size: 0.9375rem;
    line-height: 1.7;
}

.license-url {
    display: inline-block;
    margin-top: 0.75rem;
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
}

.license-url:hover {
    text-decoration: underline;
}

/* Usage Grid */
.usage-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 0.75rem;
}

.usage-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    background: var(--bg-primary);
    border-radius: var(--radius-md);
    font-size: 0.9375rem;
}

.usage-item.allowed {
    color: var(--success-color);
}

.usage-item.restricted {
    color: var(--danger-color);
}

.usage-item.unknown {
    color: var(--text-muted);
}

.usage-icon {
    font-size: 1.125rem;
}

/* Attribution Content */
.attribution-content {
    background: var(--bg-primary);
    padding: 1rem;
    border-radius: var(--radius-md);
}

.attribution-content p {
    margin-bottom: 0.75rem;
}

.attribution-content p:last-child {
    margin-bottom: 0;
}

.attribution-text {
    font-family: 'Monaco', 'Menlo', monospace;
    font-size: 0.875rem;
    background: #1f2937;
    color: #f9fafb;
    padding: 1rem;
    border-radius: var(--radius-sm);
    overflow-x: auto;
    white-space: pre-wrap;
    word-break: break-all;
}

.copy-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.75rem;
    padding: 0.5rem 1rem;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    cursor: pointer;
    transition: var(--transition);
}

.copy-btn:hover {
    background: var(--primary-hover);
}

/* Raw Data Toggle */
.toggle-raw {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 0;
    background: none;
    border: none;
    font-size: 1rem;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
}

.toggle-raw:hover {
    color: var(--text-primary);
}

.toggle-raw svg {
    transition: transform 0.2s ease;
}

.toggle-raw.active svg {
    transform: rotate(180deg);
}

.raw-data {
    margin-top: 1rem;
    padding: 1rem;
    background: #1f2937;
    color: #f9fafb;
    border-radius: var(--radius-md);
    font-family: 'Monaco', 'Menlo', monospace;
    font-size: 0.8125rem;
    overflow-x: auto;
    white-space: pre-wrap;
    word-break: break-all;
    max-height: 400px;
    overflow-y: auto;
}

/* Check Another Button */
.check-another-btn {
    display: block;
    width: 100%;
    padding: 1rem;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    margin-top: 1rem;
}

.check-another-btn:hover {
    background: var(--primary-hover);
}

/* Error Section */
.error-section {
    text-align: center;
    padding: 3rem 2rem;
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
}

.error-icon {
    color: var(--danger-color);
    margin-bottom: 1rem;
}

.error-section h3 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

.error-section p {
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
}

.try-again-btn {
    padding: 0.75rem 2rem;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.try-again-btn:hover {
    background: var(--primary-hover);
}

/* Footer */
.footer {
    text-align: center;
    padding: 1.5rem;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
}

.footer p {
    color: var(--text-secondary);
    font-size: 0.9375rem;
}

.footer a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
}

.footer a:hover {
    text-decoration: underline;
}

/* Mobile Responsive */
@media (max-width: 640px) {
    .header {
        padding: 2rem 1rem 1.5rem;
    }

    .header h1 {
        font-size: 1.75rem;
    }

    .tagline {
        font-size: 1rem;
    }

    .main-content {
        padding: 1.5rem 1rem;
    }

    .upload-area {
        padding: 2rem 1.5rem;
    }

    .upload-text {
        font-size: 1.1rem;
    }

    .font-info-card,
    .license-card,
    .usage-card,
    .attribution-card,
    .raw-data-card {
        padding: 1.25rem;
    }

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

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

@media (max-width: 400px) {
    .usage-grid {
        grid-template-columns: 1fr;
    }
}

/* Print Styles */
@media print {
    .upload-section,
    .check-another-btn,
    .toggle-raw,
    .raw-data-card {
        display: none;
    }
}
