/* ==========================================================================
   MedRecognize AI - Medical Recognition System Stylesheet
   ========================================================================== */

:root {
    --primary: #0d9488;
    --primary-hover: #0f766e;
    --primary-light: #ccfbf1;
    --secondary: #0284c7;
    --secondary-light: #e0f2fe;
    --accent: #6366f1;
    --bg-body: #f8fafc;
    --card-bg: #ffffff;
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    --border-color: #e2e8f0;
    --error-bg: #fef2f2;
    --error-border: #fecaca;
    --error-text: #991b1b;
    --success-bg: #f0fdf4;
    --success-text: #166534;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 20px;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
    --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.06), 0 8px 10px -6px rgba(0, 0, 0, 0.04);
    --font-sans: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-sans);
    background-color: var(--bg-body);
    background-image: 
        radial-gradient(at 0% 0%, rgba(13, 148, 136, 0.05) 0px, transparent 50%),
        radial-gradient(at 100% 100%, rgba(2, 132, 199, 0.05) 0px, transparent 50%);
    background-attachment: fixed;
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.app-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2.5rem 1.5rem;
    width: 100%;
    flex: 1;
    display: flex;
    flex-direction: column;
}

/* Header */
.app-header {
    text-align: center;
    margin-bottom: 2.5rem;
}

.logo-badge {
    width: 64px;
    height: 64px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    border-radius: var(--radius-lg);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    box-shadow: 0 10px 20px rgba(13, 148, 136, 0.25);
    margin-bottom: 1rem;
}

.app-header h1 {
    font-size: 2.25rem;
    font-weight: 800;
    color: var(--text-primary);
    letter-spacing: -0.025em;
}

.app-header .subtitle {
    font-size: 1.05rem;
    color: var(--text-secondary);
    margin-top: 0.25rem;
}

/* Main Layout */
.main-content {
    flex: 1;
}

/* Cards & Layout */
.card {
    background-color: var(--card-bg);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-lg);
    padding: 2rem;
    margin-bottom: 2rem;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.upload-card {
    max-width: 720px;
    margin: 0 auto 2.5rem auto;
}

.card-header h2 {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.card-header h2 i {
    color: var(--primary);
}

.card-header p {
    color: var(--text-secondary);
    font-size: 0.95rem;
    margin-top: 0.35rem;
}

/* Input Tabs Switcher */
.input-tabs {
    display: flex;
    gap: 0.35rem;
    background-color: #f1f5f9;
    padding: 0.35rem;
    border-radius: var(--radius-md);
    margin: 1.5rem 0 1.25rem 0;
    width: 100%;
    box-sizing: border-box;
}

.tab-btn {
    flex: 1 1 0;
    min-width: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.65rem 0.5rem;
    font-size: 0.85rem;
    font-weight: 600;
    font-family: inherit;
    color: var(--text-secondary);
    background: transparent;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tab-btn i {
    flex-shrink: 0;
    font-size: 0.95rem;
}

.tab-btn:hover {
    color: var(--text-primary);
}

.tab-btn.active {
    background: white;
    color: var(--primary-hover);
    box-shadow: var(--shadow-sm);
}

/* Form Controls & Search Input */
.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.form-group label i {
    color: var(--primary);
    margin-right: 0.25rem;
}

.search-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.search-input-wrapper .search-icon {
    position: absolute;
    left: 1.1rem;
    color: var(--text-muted);
    font-size: 1.1rem;
    pointer-events: none;
}

.search-input-wrapper input[type="text"] {
    width: 100%;
    padding: 0.9rem 1rem 0.9rem 2.8rem;
    font-size: 1rem;
    font-family: inherit;
    color: var(--text-primary);
    background: #ffffff;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    transition: border-color 0.2s, box-shadow 0.2s;
}

.search-input-wrapper input[type="text"]:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(13, 148, 136, 0.15);
}

.field-hint {
    display: block;
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 0.4rem;
}

/* Dropzone Upload */
.dropzone {
    border: 2px dashed #cbd5e1;
    border-radius: var(--radius-md);
    padding: 2.25rem 1.5rem;
    text-align: center;
    background-color: #fafafa;
    cursor: pointer;
    position: relative;
    transition: all 0.25s ease;
}

.dropzone:hover, .dropzone.drag-over {
    border-color: var(--primary);
    background-color: var(--primary-light);
}

.dropzone input[type="file"] {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

.dropzone-icon {
    font-size: 2.5rem;
    color: var(--primary);
    margin-bottom: 0.5rem;
}

.dropzone h3 {
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--text-primary);
}

.dropzone p {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-top: 0.2rem;
}

.browse-btn {
    color: var(--primary);
    font-weight: 600;
    text-decoration: underline;
}

.file-limits {
    display: block;
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 0.4rem;
}

/* Image Preview in Dropzone */
.image-preview-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    position: relative;
    z-index: 2;
}

.image-preview-container img {
    max-height: 200px;
    max-width: 100%;
    border-radius: var(--radius-md);
    object-fit: contain;
    box-shadow: var(--shadow-md);
}

.file-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: #ffffff;
    padding: 0.4rem 0.9rem;
    border-radius: 20px;
    box-shadow: var(--shadow-sm);
    font-size: 0.85rem;
    font-weight: 500;
    border: 1px solid var(--border-color);
}

.btn-icon {
    background: #f1f5f9;
    border: none;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-secondary);
    transition: all 0.2s;
}

.btn-icon:hover {
    background: #e2e8f0;
    color: var(--error-text);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.85rem 1.75rem;
    font-size: 1rem;
    font-weight: 600;
    font-family: inherit;
    border-radius: var(--radius-md);
    cursor: pointer;
    border: none;
    transition: all 0.2s ease;
    text-decoration: none;
    width: 100%;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-hover));
    color: white;
    box-shadow: 0 4px 12px rgba(13, 148, 136, 0.3);
}

.btn-primary:hover:not(:disabled) {
    box-shadow: 0 6px 16px rgba(13, 148, 136, 0.4);
    transform: translateY(-1px);
}

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

.btn-secondary {
    background-color: var(--secondary-light);
    color: var(--secondary);
}

.btn-secondary:hover {
    background-color: #bae6fd;
}

.btn-outline {
    background: white;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
    width: auto;
}

.btn-outline:hover {
    background: var(--bg-body);
    color: var(--text-primary);
}

/* Feature Grid */
.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.5rem;
    max-width: 900px;
    margin: 0 auto 2rem auto;
}

.feature-item {
    background: white;
    padding: 1.5rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    text-align: center;
}

.feature-item i {
    font-size: 1.8rem;
    color: var(--primary);
    margin-bottom: 0.75rem;
}

.feature-item h4 {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 0.35rem;
}

.feature-item p {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* Alerts */
.alert {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    padding: 1.25rem 1.5rem;
    border-radius: var(--radius-md);
    margin-bottom: 2rem;
}

.alert-error {
    background-color: var(--error-bg);
    border: 1px solid var(--error-border);
    color: var(--error-text);
}

.alert-icon {
    font-size: 1.4rem;
    margin-top: 0.1rem;
}

.alert-body h4 {
    font-size: 1rem;
    font-weight: 700;
}

.alert-body p {
    font-size: 0.9rem;
    margin-top: 0.2rem;
}

/* Results Layout */
.results-layout {
    display: grid;
    grid-template-columns: 320px 1fr;
    gap: 2rem;
    align-items: start;
}

@media (max-width: 900px) {
    .results-layout {
        grid-template-columns: 1fr;
    }
}

.image-card {
    padding: 1.5rem;
}

.analyzed-image-wrapper {
    background-color: #f1f5f9;
    border-radius: var(--radius-md);
    overflow: hidden;
    margin: 1rem 0;
    text-align: center;
    border: 1px solid var(--border-color);
}

.analyzed-image-wrapper img {
    width: 100%;
    max-height: 350px;
    object-fit: contain;
    display: block;
}

.searched-term-badge {
    display: flex;
    align-items: center;
    gap: 1rem;
    background-color: var(--primary-light);
    border: 1px solid #99f6e4;
    padding: 1.25rem;
    border-radius: var(--radius-md);
    margin: 1rem 0;
}

.searched-term-badge i {
    font-size: 2rem;
    color: var(--primary);
}

.badge-label {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--primary-hover);
    letter-spacing: 0.04em;
}

.searched-term-badge h4 {
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--text-primary);
    margin-top: 0.1rem;
}

.result-card {
    padding: 2.25rem;
}

.result-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
    padding-bottom: 1.25rem;
    border-bottom: 2px solid var(--border-color);
    margin-bottom: 1.75rem;
}

.result-title h2 {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--text-primary);
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    margin-top: 0.25rem;
}

.badge-success {
    background-color: var(--success-bg);
    color: var(--success-text);
}

/* Markdown HTML Content Styling */
.result-body {
    font-size: 1rem;
    color: #334155;
    line-height: 1.7;
}

.result-body h3 {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--primary-hover);
    margin-top: 1.75rem;
    margin-bottom: 0.75rem;
    padding-bottom: 0.35rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.result-body h3:first-child {
    margin-top: 0;
}

.result-body p {
    margin-bottom: 1rem;
}

.result-body ul, .result-body ol {
    margin-bottom: 1.25rem;
    padding-left: 1.5rem;
}

.result-body li {
    margin-bottom: 0.4rem;
}

.result-body strong {
    color: var(--text-primary);
}

.result-body blockquote, .result-body em {
    background-color: #fffbebf5;
    border-left: 4px solid #f59e0b;
    padding: 0.85rem 1.25rem;
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    font-style: normal;
    display: block;
    margin-top: 1.5rem;
    font-size: 0.88rem;
    color: #92400e;
}

/* Utility Classes */
.hidden {
    display: none !important;
}

/* Footer */
.app-footer {
    margin-top: 3rem;
    text-align: center;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
    font-size: 0.85rem;
    color: var(--text-muted);
}

.app-footer p {
    max-width: 800px;
    margin: 0 auto 0.5rem auto;
}

.app-footer .copyright {
    font-size: 0.8rem;
}

/* Mobile & Small Screen Responsive Enhancements */
@media (max-width: 640px) {
    .app-container {
        padding: 1.5rem 1rem;
    }

    .card {
        padding: 1.25rem;
        border-radius: var(--radius-md);
    }

    .upload-card {
        padding: 1.25rem 1rem;
    }

    .input-tabs {
        display: flex;
        flex-direction: column;
        gap: 0.4rem;
        padding: 0.4rem;
    }

    .tab-btn {
        width: 100%;
        padding: 0.75rem 1rem;
        font-size: 0.92rem;
        justify-content: flex-start;
        text-align: left;
        border-radius: var(--radius-sm);
    }

    .tab-btn i {
        width: 20px;
        text-align: center;
    }

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

    .search-input-wrapper input[type="text"] {
        font-size: 0.95rem;
        padding-left: 2.5rem;
    }

    .search-input-wrapper .search-icon {
        left: 0.9rem;
    }
}
