/* --- CLINICAL TOOLS HUB CSS DESIGN SYSTEM --- */

:root {
    /* Color Palette */
    --bg-main: #0b0f19;
    --bg-card: rgba(22, 30, 49, 0.45);
    --bg-card-hover: rgba(26, 37, 62, 0.65);
    --border-color: rgba(255, 255, 255, 0.08);
    --border-hover: rgba(6, 182, 212, 0.3);
    
    /* Text Colors */
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    
    /* Brand Accents */
    --primary: #06b6d4;
    --primary-glow: rgba(6, 182, 212, 0.15);
    --primary-hover: #22d3ee;
    
    /* Category Accent Themes */
    --accent-endocrinology: #fbbf24;     /* Amber */
    --accent-psychiatry: #a78bfa;        /* Purple */
    --accent-womenshealth: #f472b6;      /* Pink */
    --accent-cardiology: #f87171;        /* Red */
    --accent-primarycare: #34d399;       /* Emerald */
    --accent-nephrology: #06b6d4;        /* Cyan/Teal */
    --accent-other: #94a3b8;              /* Slate */
    
    /* Layout & Shadow Tokens */
    --border-radius-sm: 8px;
    --border-radius-md: 14px;
    --border-radius-lg: 24px;
    --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --glass-blur: blur(12px);
    --shadow-soft: 0 10px 30px -10px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 25px -5px rgba(6, 182, 212, 0.2);
}

/* Base Reset */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

body {
    background-color: var(--bg-main);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    line-height: 1.5;
    position: relative;
}

/* Decorative Background Glows */
.bg-glow {
    position: fixed;
    border-radius: 50%;
    filter: blur(140px);
    z-index: -1;
    pointer-events: none;
    opacity: 0.35;
}

.bg-glow-1 {
    width: 600px;
    height: 600px;
    top: -200px;
    right: -100px;
    background: radial-gradient(circle, rgba(6, 182, 212, 0.15) 0%, rgba(0, 0, 0, 0) 70%);
}

.bg-glow-2 {
    width: 500px;
    height: 500px;
    bottom: -150px;
    left: -100px;
    background: radial-gradient(circle, rgba(139, 92, 246, 0.1) 0%, rgba(0, 0, 0, 0) 70%);
}

/* Layout Wrapper */
.container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 2.5rem 1.5rem;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Typography Extensions */
h1, h2, h3, h4 {
    font-family: 'Outfit', sans-serif;
    font-weight: 700;
    letter-spacing: -0.02em;
}

/* Main Header */
.main-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 2rem;
    margin-bottom: 3.5rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 2rem;
    animation: fadeInSlideDown 0.6s ease-out;
}

.header-content {
    flex: 1;
}

.logo-area {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    margin-bottom: 0.5rem;
}

.pulse-icon {
    width: 42px;
    height: 42px;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--primary) 0%, #0891b2 100%);
    color: var(--bg-main);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 15px rgba(6, 182, 212, 0.3);
    position: relative;
    overflow: hidden;
}

.pulse-icon svg {
    width: 24px;
    height: 24px;
}

.logo-area h1 {
    font-size: 2.2rem;
    background: linear-gradient(to right, #ffffff, #e2e8f0, #22d3ee);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.subtitle {
    color: var(--text-secondary);
    font-size: 1.05rem;
    max-width: 700px;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-family: 'Inter', sans-serif;
    font-weight: 600;
    font-size: 0.9rem;
    padding: 0.65rem 1.25rem;
    border-radius: var(--border-radius-sm);
    border: 1px solid transparent;
    cursor: pointer;
    transition: var(--transition-smooth);
}

.btn-primary {
    background-color: var(--primary);
    color: #042f2e;
    box-shadow: var(--shadow-glow);
}

.btn-primary:hover {
    background-color: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 0 28px -2px rgba(6, 182, 212, 0.35);
}

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

.btn-secondary {
    background-color: rgba(255, 255, 255, 0.05);
    border-color: var(--border-color);
    color: var(--text-primary);
}

.btn-secondary:hover {
    background-color: rgba(255, 255, 255, 0.09);
    border-color: var(--text-muted);
}

/* Controls (Search & Category Filters) */
.controls-section {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    margin-bottom: 2.5rem;
    animation: fadeInSlideUp 0.6s ease-out 0.1s both;
}

/* Search Bar Styling */
.search-wrapper {
    position: relative;
    width: 100%;
}

.search-icon {
    position: absolute;
    left: 1.25rem;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    color: var(--text-muted);
    pointer-events: none;
    transition: var(--transition-smooth);
}

#search-input {
    width: 100%;
    padding: 1.1rem 1.25rem 1.1rem 3.25rem;
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-md);
    color: var(--text-primary);
    font-size: 1.05rem;
    outline: none;
    backdrop-filter: var(--glass-blur);
    transition: var(--transition-smooth);
    box-shadow: var(--shadow-soft);
}

#search-input::placeholder {
    color: var(--text-muted);
}

#search-input:focus {
    border-color: var(--primary);
    background-color: rgba(22, 30, 49, 0.7);
    box-shadow: 0 0 0 3px var(--primary-glow), var(--shadow-soft);
}

#search-input:focus + .search-icon {
    color: var(--primary);
}

.clear-btn {
    position: absolute;
    right: 1.25rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4px;
    border-radius: 50%;
    transition: var(--transition-smooth);
}

.clear-btn:hover {
    background-color: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

.clear-btn svg {
    width: 18px;
    height: 18px;
}

/* Category Filters */
.categories-wrapper {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.filter-label {
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
}

.categories-list {
    display: flex;
    gap: 0.65rem;
    flex-wrap: wrap;
}

.category-pill {
    background-color: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 0.45rem 1rem;
    border-radius: 30px;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition-smooth);
    user-select: none;
}

.category-pill:hover {
    background-color: rgba(255, 255, 255, 0.07);
    border-color: var(--text-muted);
    color: var(--text-primary);
}

.category-pill.active {
    background-color: var(--primary-glow);
    border-color: var(--primary);
    color: var(--primary);
    font-weight: 600;
}

/* Tools Grid Section */
.tools-grid-section {
    flex: 1;
    margin-bottom: 3.5rem;
    animation: fadeInSlideUp 0.6s ease-out 0.2s both;
}

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

.grid-header h2 {
    font-size: 1.4rem;
    color: var(--text-primary);
}

.count-badge {
    background-color: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
}

.tools-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 1.75rem;
}

/* Tool Card */
.tool-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-md);
    padding: 1.75rem;
    display: flex;
    flex-direction: column;
    backdrop-filter: var(--glass-blur);
    transition: var(--transition-smooth);
    position: relative;
    overflow: hidden;
    box-shadow: var(--shadow-soft);
}

/* Inject glow indicators for specific categories */
.tool-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background-color: var(--category-color, var(--primary));
    transition: var(--transition-smooth);
}

.tool-card:hover {
    background-color: var(--bg-card-hover);
    border-color: var(--border-hover);
    transform: translateY(-5px);
    box-shadow: 0 15px 35px -8px rgba(0, 0, 0, 0.6), 0 0 20px -5px var(--category-glow, rgba(6, 182, 212, 0.1));
}

/* Card Header (Clickable Anchor) */
.card-header-link {
    text-decoration: none;
    color: inherit;
    display: block;
    margin-bottom: 1rem;
}

.card-title-group {
    display: flex;
    align-items: flex-start;
    gap: 0.85rem;
}

.tool-icon-wrapper {
    flex-shrink: 0;
    width: 48px;
    height: 48px;
    border-radius: 12px;
    background-color: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--category-color, var(--primary));
    transition: var(--transition-smooth);
}

.tool-card:hover .tool-icon-wrapper {
    background-color: var(--category-color-alpha, rgba(6, 182, 212, 0.1));
    border-color: var(--category-color);
    transform: scale(1.05);
}

.tool-icon-wrapper svg {
    width: 24px;
    height: 24px;
}

.card-title-text {
    flex: 1;
}

.tool-category-label {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--category-color, var(--primary));
    margin-bottom: 0.2rem;
    display: block;
}

.card-title-text h3 {
    font-size: 1.15rem;
    line-height: 1.35;
    color: var(--text-primary);
    transition: var(--transition-smooth);
}

.card-header-link:hover .card-title-text h3 {
    color: var(--primary-hover);
}

/* Card Description */
.tool-desc {
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.6;
    margin-bottom: 1.75rem;
    flex: 1;
}

/* Card Actions */
.card-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding-top: 1.25rem;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    margin-top: auto;
}

.card-actions .btn {
    padding: 0.55rem 1rem;
    font-size: 0.8rem;
    border-radius: 8px;
}

.btn-open {
    flex: 1;
    text-decoration: none;
}

.btn-icon-only {
    width: 36px;
    height: 36px;
    padding: 0;
    flex-shrink: 0;
    background-color: rgba(255, 255, 255, 0.03);
    border-color: var(--border-color);
    color: var(--text-secondary);
    border-radius: 8px;
}

.btn-icon-only:hover {
    color: var(--text-primary);
    background-color: rgba(255, 255, 255, 0.07);
    border-color: var(--text-muted);
}

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

/* Empty State Styling */
.empty-state {
    text-align: center;
    padding: 5rem 2rem;
    background-color: var(--bg-card);
    border: 1px dashed var(--border-color);
    border-radius: var(--border-radius-md);
    margin-top: 1rem;
    backdrop-filter: var(--glass-blur);
    animation: fadeIn 0.4s ease-out;
}

.empty-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 1.5rem;
    color: var(--text-muted);
}

.empty-icon svg {
    width: 100%;
    height: 100%;
}

.empty-state h3 {
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.empty-state p {
    color: var(--text-secondary);
    max-width: 400px;
    margin: 0 auto 1.5rem;
    font-size: 0.95rem;
}

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

.main-footer p {
    margin-bottom: 0.5rem;
}

.disclaimer {
    max-width: 800px;
    margin: 0.75rem auto 0;
    line-height: 1.6;
    font-size: 0.8rem;
    color: var(--text-muted);
    opacity: 0.75;
}

/* Modal Overlay & Box */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(7, 10, 18, 0.8);
    backdrop-filter: blur(8px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.modal-overlay.open {
    opacity: 1;
    pointer-events: auto;
}

.modal-container {
    background-color: #0f1626;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    width: 100%;
    max-width: 580px;
    padding: 2.25rem;
    box-shadow: 0 30px 60px -15px rgba(0, 0, 0, 0.8), var(--shadow-glow);
    transform: translateY(20px) scale(0.97);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    max-height: 90vh;
    overflow-y: auto;
}

.modal-overlay.open .modal-container {
    transform: translateY(0) scale(1);
}

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

.modal-header h3 {
    font-size: 1.5rem;
    background: linear-gradient(to right, #ffffff, #e2e8f0);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-smooth);
}

.modal-close:hover {
    background-color: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
}

.modal-close svg {
    width: 20px;
    height: 20px;
}

/* Forms styling */
.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
}

.required {
    color: var(--accent-cardiology);
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.8rem 1rem;
    background-color: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    color: var(--text-primary);
    font-size: 0.95rem;
    outline: none;
    transition: var(--transition-smooth);
}

.form-group input::placeholder,
.form-group textarea::placeholder {
    color: var(--text-muted);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    border-color: var(--primary);
    background-color: rgba(255, 255, 255, 0.06);
    box-shadow: 0 0 0 3px var(--primary-glow);
}

.form-group select option {
    background-color: #0f1626;
    color: var(--text-primary);
}

.modal-footer {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

.code-export-tip {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-muted);
    font-size: 0.75rem;
    max-width: 250px;
}

.code-export-tip svg {
    color: var(--primary);
    flex-shrink: 0;
}

.modal-actions {
    display: flex;
    gap: 0.75rem;
    margin-left: auto;
}

/* Toast System */
.toast-container {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    z-index: 1100;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    pointer-events: none;
}

.toast {
    background-color: rgba(15, 23, 42, 0.9);
    border: 1px solid var(--border-color);
    border-left: 4px solid var(--primary);
    color: var(--text-primary);
    padding: 1rem 1.5rem;
    border-radius: var(--border-radius-sm);
    box-shadow: 0 10px 25px rgba(0,0,0,0.5);
    backdrop-filter: var(--glass-blur);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-width: 280px;
    max-width: 400px;
    animation: toastSlideIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    transition: var(--transition-smooth);
    pointer-events: auto;
}

.toast-success {
    border-left-color: var(--accent-primarycare);
}

.toast-info {
    border-left-color: var(--primary);
}

.toast-content {
    flex: 1;
    font-size: 0.85rem;
    font-weight: 500;
}

.toast-close {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2px;
}

.toast-close:hover {
    color: var(--text-primary);
}

.toast-close svg {
    width: 14px;
    height: 14px;
}

/* --- KEYFRAME ANIMATIONS --- */

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

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

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

@keyframes toastSlideIn {
    from {
        opacity: 0;
        transform: translateX(100%) translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateX(0) translateY(0);
    }
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(6, 182, 212, 0.4);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(6, 182, 212, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(6, 182, 212, 0);
    }
}

/* Responsive Breakpoints */
@media (max-width: 768px) {
    .main-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1.25rem;
        margin-bottom: 2rem;
        padding-bottom: 1.5rem;
    }
    
    .header-actions {
        width: 100%;
    }
    
    .header-actions .btn {
        width: 100%;
    }
    
    .logo-area h1 {
        font-size: 1.8rem;
    }
    
    .categories-wrapper {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
    
    .categories-list {
        width: 100%;
        overflow-x: auto;
        padding-bottom: 6px;
        flex-wrap: nowrap;
        -webkit-overflow-scrolling: touch;
    }
    
    .category-pill {
        flex-shrink: 0;
    }
    
    .toast-container {
        left: 1rem;
        right: 1rem;
        bottom: 1rem;
    }
    
    .toast {
        min-width: 0;
        width: 100%;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 1.5rem 1rem;
    }
    
    .tools-grid {
        grid-template-columns: 1fr;
    }
    
    .modal-container {
        padding: 1.5rem;
    }
}
