/**
 * Main Stylesheet - Medical Patients Generator
 * Modern healthcare design with sophisticated color palette
 */

/* Base Styles */
* {
    box-sizing: border-box;
}

body {
    font-family: var(--font-family);
    margin: 0;
    padding: 0;
    background: var(--background);
    min-height: 100vh;
    color: var(--text-primary);
    line-height: var(--line-height-normal);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Typography */
.font-inter {
    font-family: var(--font-family);
}

/* Generate Button - Modern Design */
.generate-button {
    background: linear-gradient(135deg, var(--success) 0%, #059669 100%);
    color: var(--surface);
    border: none;
    padding: 1rem 2rem;
    font-size: 1rem;
    font-weight: 600;
    border-radius: 0.75rem;
    cursor: pointer;
    width: 100%;
    transition: all var(--transition-normal);
    box-shadow: 0 4px 14px 0 rgba(16, 185, 129, 0.25);
    position: relative;
    overflow: hidden;
    transform: translateY(0);
}

.generate-button::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.6s ease;
}

.generate-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px 0 rgba(16, 185, 129, 0.35);
}

.generate-button:hover::before {
    left: 100%;
}

.generate-button:active {
    transform: translateY(-1px);
    box-shadow: 0 4px 14px 0 rgba(16, 185, 129, 0.25);
}

.generate-button:disabled {
    background: linear-gradient(135deg, var(--border) 0%, var(--text-disabled) 100%);
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
    opacity: 0.6;
}

.generate-button:disabled::before {
    display: none;
}

/* Enhanced Button States */
.generate-button.button-error {
    background: linear-gradient(135deg, var(--error) 0%, #dc2626 100%);
    box-shadow: 0 4px 14px 0 rgba(239, 68, 68, 0.25);
}

.generate-button.button-loading {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    box-shadow: 0 4px 14px 0 rgba(8, 145, 178, 0.25);
    pointer-events: none;
}

.generate-button.button-loading:hover {
    transform: none;
    box-shadow: 0 4px 14px 0 rgba(8, 145, 178, 0.25);
}

/* Status Box */
.status-box {
    margin-top: 2rem;
    display: none;
    animation: slideInUp 0.4s ease-out;
}

.status-box.show {
    display: block;
}

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

/* Status Content */
.status-content {
    padding: 1.5rem;
}

/* Progress Bar - Modern Design */
.progress {
    background: var(--border-light);
    border-radius: 0.75rem;
    height: 8px;
    margin: 1rem 0;
    overflow: hidden;
    position: relative;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.06);
}

.progress-bar {
    background: linear-gradient(90deg, var(--primary) 0%, var(--primary-light) 50%, var(--primary) 100%);
    height: 100%;
    width: 0%;
    transition: width var(--transition-normal);
    position: relative;
    border-radius: 0.75rem;
    overflow: hidden;
}

.progress-bar::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    right: 0;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% {
        transform: translateX(-100%);
    }
    100% {
        transform: translateX(100%);
    }
}

/* Download Section - Enhanced */
.download-section {
    background: linear-gradient(135deg, var(--background-secondary) 0%, #e2e8f0 100%);
    border-radius: 0.75rem;
    padding: 1.5rem;
    margin-top: 1.5rem;
    text-align: center;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
}

.download-section h4 {
    margin: 0 0 1rem;
    color: var(--primary);
    font-size: 1.125rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.download-link {
    background: linear-gradient(135deg, var(--success) 0%, #059669 100%);
    color: var(--surface);
    text-decoration: none;
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0.5rem 0;
    transition: all var(--transition-normal);
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.25);
    min-width: 200px;
    justify-content: center;
}

.download-link:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.35);
}

.download-info {
    margin-top: 1rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
    line-height: var(--line-height-relaxed);
}

/* Status Messages */
.success {
    color: var(--success);
    padding: 1rem;
    background: rgba(16, 185, 129, 0.08);
    border-radius: 0.5rem;
    border-left: 4px solid var(--success);
    margin: 1rem 0;
    animation: fadeIn 0.3s ease-out;
}

.error {
    color: var(--error);
    padding: 1rem;
    background: rgba(239, 68, 68, 0.08);
    border-radius: 0.5rem;
    border-left: 4px solid var(--error);
    margin: 1rem 0;
    animation: fadeIn 0.3s ease-out;
}

.fun-message {
    font-style: italic;
    color: var(--text-secondary);
    margin-top: 1rem;
    padding: 0.75rem;
    background: linear-gradient(90deg, rgba(8, 145, 178, 0.05) 0%, rgba(8, 145, 178, 0.08) 100%);
    border-radius: 0.5rem;
    border-left: 3px solid var(--primary);
    font-size: 0.875rem;
    animation: fadeIn 0.3s ease-out;
}

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

/* Enhanced Status Display */
.status-details {
    space-y: 0.5rem;
}

.status-row {
    display: flex;
    align-items: center;
    padding: 0.25rem 0;
    font-size: 0.95rem;
}

.status-row strong {
    color: var(--text-primary);
    min-width: 140px;
    display: inline-block;
}

/* Success Section Enhancements */
.success-icon {
    display: flex;
    align-items: center;
    margin-bottom: 1rem;
    font-size: 1.1rem;
}

.completion-stats {
    display: grid;
    gap: 0.5rem;
    margin-top: 1rem;
}

.stat-item,
.info-item {
    display: flex;
    align-items: center;
    padding: 0.375rem 0;
    font-size: 0.9rem;
}

.stat-item strong,
.info-item strong {
    color: var(--text-primary);
    margin-right: 0.5rem;
}

/* Download Section Enhancements */
.download-info {
    display: grid;
    gap: 0.5rem;
    margin-top: 1rem;
    padding: 1rem;
    background: rgba(8, 145, 178, 0.05);
    border-radius: 0.5rem;
    border: 1px solid rgba(8, 145, 178, 0.1);
}

.info-item code {
    font-family: var(--font-family-mono);
    background: rgba(8, 145, 178, 0.1);
    padding: 0.125rem 0.375rem;
    border-radius: 0.25rem;
    font-size: 0.85rem;
}

/* Configuration History Styles */
.config-history-item {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    padding: 1rem;
    margin-bottom: 0.75rem;
    transition: all var(--transition-normal);
}

.config-history-item:last-child {
    margin-bottom: 0;
}

.config-history-item:hover {
    border-color: var(--primary-light);
    box-shadow: 0 2px 8px rgba(8, 145, 178, 0.1);
    transform: translateY(-1px);
}

.config-history-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0.75rem;
}

.config-history-title {
    display: flex;
    align-items: center;
    flex: 1;
}

.config-history-time {
    display: flex;
    align-items: center;
    color: var(--text-secondary);
}

.config-history-stats {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.config-history-stats .stat {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.config-history-stats .stat i {
    width: 14px;
    text-align: center;
}

.config-load-btn {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: var(--surface);
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 0.375rem;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-normal);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    box-shadow: 0 2px 4px rgba(8, 145, 178, 0.2);
}

.config-load-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(8, 145, 178, 0.3);
}

.config-load-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(8, 145, 178, 0.2);
}

@media (max-width: 640px) {
    .config-history-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.25rem;
    }

    .config-history-stats {
        gap: 0.75rem;
    }

    .config-history-stats .stat {
        font-size: 0.8rem;
    }
}

/* Code Elements */
code {
    background: rgba(8, 145, 178, 0.08);
    color: var(--primary-dark);
    padding: 0.125rem 0.375rem;
    border-radius: 0.25rem;
    font-family: var(--font-family-mono);
    font-size: 0.875em;
    font-weight: 500;
}

/* API Banner is now a top notice bar - no animations needed */

/* Focus Improvements */
button:focus-visible,
textarea:focus-visible,
a:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
    border-radius: 0.25rem;
}

/* Loading States */
.loading {
    opacity: 0.6;
    pointer-events: none;
    position: relative;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid var(--border);
    border-top: 2px solid var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

/* Responsive Design */
@media (max-width: 1024px) {
    .container {
        padding: 1rem;
    }

    .grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    .lg\\:col-span-2,
    .lg\\:col-span-1 {
        grid-column: span 1;
    }
}

@media (max-width: 640px) {
    .container {
        padding: 0.75rem;
    }

    .status-content {
        padding: 1rem;
    }

    .download-section {
        padding: 1rem;
    }

    .generate-button {
        padding: 0.875rem 1.5rem;
        font-size: 0.9rem;
    }

    /* API banner responsive handled in banner.css */
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
    .generate-button::before,
    .progress-bar::after,
    .status-box,
    .success,
    .error,
    .fun-message {
        animation: none;
    }

    .generate-button:hover {
        transform: none;
    }

    .download-link:hover {
        transform: none;
    }

    * {
        transition: none !important;
    }
}

/* High Contrast Support */
@media (prefers-contrast: high) {
    .generate-button,
    .download-link {
        border: 2px solid var(--text-primary);
    }

    .bg-white {
        border: 1px solid var(--text-primary);
    }
}

/* Print Styles */
@media print {
    body {
        background: var(--surface);
    }

    .generate-button,
    .download-link {
        background: var(--surface);
        color: var(--text-primary);
        border: 1px solid var(--text-primary);
    }

    .bg-white {
        box-shadow: none;
        border: 1px solid var(--border);
    }

    .api-banner {
        display: none;
    }
}

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

::-webkit-scrollbar-track {
    background: var(--background);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: var(--border-dark);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-disabled);
}

/* Utility Classes */
.text-balance {
    text-wrap: balance;
}

.transition-all {
    transition: all var(--transition-normal);
}

.hover\\:scale-105:hover {
    transform: scale(1.05);
}

.shadow-glow {
    box-shadow: 0 0 20px rgba(8, 145, 178, 0.15);
}
