/* CurenexAI clinical workspace refresh
   Loaded after style.css so legacy screens keep their behavior while sharing
   a calmer, task-oriented visual system. */

:root {
    --primary-50: #edf7fb;
    --primary-100: #d8eef6;
    --primary-200: #afdce9;
    --primary-300: #78c3d7;
    --primary-400: #3ca5c0;
    --primary-500: #167d9d;
    --primary-600: #116682;
    --primary-700: #105269;
    --primary-800: #123f50;
    --primary-900: #123441;
    --secondary-500: #16866f;
    --secondary-600: #116b5a;
    --bg-secondary: #f5f7f8;
    --border-color: #dce4e8;
    --text-primary: #17242d;
    --text-secondary: #586a76;
    --sidebar-width: 238px;
    --header-height: 64px;
    --border-radius: 6px;
    --border-radius-lg: 8px;
    --border-radius-xl: 8px;
    --shadow: 0 1px 2px rgba(18, 52, 65, 0.06);
    --shadow-md: 0 4px 14px rgba(18, 52, 65, 0.08);
    --shadow-lg: 0 8px 22px rgba(18, 52, 65, 0.1);
}

body {
    color: var(--text-primary);
    background: var(--bg-secondary);
    letter-spacing: 0;
}

body::selection {
    background: var(--primary-200);
    color: var(--primary-900);
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible {
    outline: 3px solid rgba(22, 125, 157, 0.28);
    outline-offset: 2px;
}

.main-header {
    background: rgba(255, 255, 255, 0.98);
    box-shadow: 0 1px 0 rgba(18, 52, 65, 0.04);
}

.header-content {
    padding: 0 1.25rem;
}

.logo-img {
    width: 142px;
    max-height: 42px;
}

.sidebar-toggle,
.search-btn,
.btn-icon {
    border-radius: 6px;
}

.header-search form {
    position: relative;
}

.search-input {
    width: min(30vw, 360px);
    height: 40px;
    padding: 0 2.8rem 0 2.5rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: #f7f9fa;
    color: var(--text-primary);
}

.header-search form::before {
    content: "\f002";
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
    position: absolute;
    left: 0.85rem;
    top: 50%;
    transform: translateY(-50%);
    color: #8796a0;
    z-index: 1;
}

.search-input:focus {
    width: min(32vw, 390px);
    border-color: var(--primary-500);
    box-shadow: 0 0 0 3px rgba(22, 125, 157, 0.12);
}

.search-btn {
    right: 4px;
    width: 32px;
    height: 32px;
    background: transparent;
    color: var(--primary-600);
}

.search-btn:hover {
    background: var(--primary-50);
    transform: translateY(-50%);
}

.user-info {
    border-radius: 6px;
    padding: 0.35rem 0.55rem;
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 6px;
    background: var(--primary-700);
}

.user-dropdown {
    border-radius: 8px;
}

.sidebar {
    background: #fbfcfc;
}

.sidebar-nav {
    padding: 0.8rem 0 1rem;
}

.sidebar-nav li {
    margin: 0.1rem 0.65rem;
}

.sidebar-nav a {
    min-height: 42px;
    padding: 0.65rem 0.78rem;
    gap: 0.72rem;
    border-radius: 6px;
    font-size: 0.875rem;
}

.sidebar-nav a:hover {
    background: #eef3f5;
}

.sidebar-nav a.active {
    color: var(--primary-800);
    background: var(--primary-100);
}

.sidebar-nav a.active::before {
    left: -0.65rem;
    top: 0.4rem;
    bottom: 0.4rem;
    width: 3px;
    background: var(--primary-600);
}

.sidebar-nav a i {
    width: 22px;
    color: #6d7d87;
}

.sidebar-nav a.active i {
    color: var(--primary-700);
}

.sidebar-nav .badge {
    border-radius: 4px;
    background: var(--primary-700);
}

.nav-section {
    padding: 1.15rem 0.8rem 0.35rem;
    color: #82919a;
    font-size: 0.64rem;
    letter-spacing: 0.06em;
}

.main-content {
    background: var(--bg-secondary);
}

.page-header {
    align-items: center;
    margin-bottom: 1.15rem;
}

.page-header h1 {
    font-size: 1.45rem;
    color: #152a36;
}

.page-header h1 i {
    color: var(--primary-600);
}

.page-header .text-muted {
    margin-top: 0.25rem;
    font-size: 0.83rem;
}

.dashboard-card,
.card,
.stat-card {
    border: 1px solid var(--border-color);
    border-radius: 7px;
    box-shadow: var(--shadow);
}

.dashboard-card:hover,
.card:hover,
.stat-card:hover {
    transform: none;
    box-shadow: var(--shadow-md);
}

.card-header {
    background: #fafcfc;
}

.btn {
    min-height: 40px;
    border-radius: 6px;
    font-weight: 600;
    box-shadow: none;
}

.btn-sm {
    min-height: 34px;
}

.btn-primary {
    background: var(--primary-700);
    border-color: var(--primary-700);
}

.btn-primary:hover {
    background: var(--primary-800);
    border-color: var(--primary-800);
}

.btn-success {
    background: #18745f;
    border-color: #18745f;
}

.data-table th {
    color: #526570;
    background: #f3f6f7;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.data-table tbody tr:hover {
    background: #f2f8fa;
}

.form-control,
input[type="text"],
input[type="email"],
input[type="number"],
input[type="date"],
input[type="password"],
input[type="search"],
select,
textarea {
    border-radius: 6px;
}

.mobile-clinical-nav {
    display: none;
}

/* Dashboard task orientation */
.dashboard-container::before {
    display: none !important;
}

.dashboard-intro {
    margin: -0.75rem -0.75rem 1.1rem;
    padding: 1.25rem;
    background: #ffffff;
    border-bottom: 1px solid var(--border-color);
}

.dashboard-intro .page-header {
    margin-bottom: 0;
}

.clinical-path {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    margin-bottom: 1.1rem;
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: 7px;
    overflow: hidden;
}

.clinical-path a {
    min-width: 0;
    padding: 0.85rem 0.7rem;
    display: flex;
    align-items: center;
    gap: 0.55rem;
    color: var(--text-secondary);
    border-right: 1px solid var(--border-color);
}

.clinical-path a:last-child {
    border-right: 0;
}

.clinical-path a:hover {
    background: var(--primary-50);
    color: var(--primary-800);
}

.clinical-path-number {
    width: 25px;
    height: 25px;
    flex: 0 0 25px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: #e5ecef;
    color: #526570;
    font-size: 0.72rem;
    font-weight: 700;
}

.clinical-path a:first-child .clinical-path-number {
    color: #fff;
    background: var(--primary-700);
}

.clinical-path-label {
    min-width: 0;
    font-size: 0.78rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dashboard-section-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 0 0 0.65rem;
}

.dashboard-section-heading h2 {
    margin: 0;
    font-size: 1rem;
}

.dashboard-section-heading span {
    color: var(--text-secondary);
    font-size: 0.76rem;
}

.stats-grid {
    gap: 0.75rem;
}

.stat-card {
    padding: 0.9rem;
}

.stat-card::before {
    display: none;
}

.stat-icon {
    border-radius: 6px;
}

.stat-details h3 {
    font-size: 1.35rem;
}

.stat-details p {
    font-size: 0.76rem;
}

.quick-actions h3 {
    font-size: 1rem;
    margin-bottom: 0.65rem;
}

.action-card {
    border-radius: 7px !important;
    box-shadow: none !important;
}

.action-card:hover {
    transform: none !important;
    border-color: var(--primary-300) !important;
    background: var(--primary-50) !important;
}

@media (min-width: 992px) {
    .main-content {
        padding: 1.25rem 1.4rem 2rem;
    }

    .dashboard-intro {
        margin: -1.25rem -1.4rem 1.15rem;
        padding: 1.25rem 1.4rem;
    }
}

@media (max-width: 900px) {
    .clinical-path {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .clinical-path a:nth-child(3) {
        border-right: 0;
    }

    .clinical-path a:nth-child(-n+3) {
        border-bottom: 1px solid var(--border-color);
    }
}

@media (max-width: 767.98px) {
    body {
        padding-bottom: 68px;
    }

    .main-content {
        min-height: calc(100vh - var(--header-height) - 68px);
    }

    .header-content {
        padding: 0 0.7rem;
    }

    .logo-img {
        width: 122px;
    }

    .mobile-clinical-nav {
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 350;
        height: 68px;
        padding: 5px max(5px, env(safe-area-inset-right)) calc(5px + env(safe-area-inset-bottom)) max(5px, env(safe-area-inset-left));
        display: grid;
        grid-template-columns: repeat(5, minmax(0, 1fr));
        align-items: end;
        background: rgba(255,255,255,.98);
        border-top: 1px solid var(--border-color);
        box-shadow: 0 -5px 18px rgba(18,52,65,.08);
    }

    .mobile-clinical-nav a {
        min-width: 0;
        height: 53px;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 2px;
        color: #667781;
        font-size: 0.65rem;
        font-weight: 600;
        border-radius: 6px;
    }

    .mobile-clinical-nav a i {
        font-size: 1rem;
    }

    .mobile-clinical-nav a.active {
        color: var(--primary-700);
        background: var(--primary-50);
    }

    .mobile-clinical-nav .mobile-primary-action {
        width: 58px;
        height: 58px;
        justify-self: center;
        margin-bottom: 8px;
        color: #fff;
        background: var(--primary-700);
        box-shadow: 0 6px 14px rgba(17,102,130,.24);
    }

    .mobile-clinical-nav .mobile-primary-action i {
        font-size: 1.15rem;
    }

    .footer {
        margin-bottom: 68px;
    }

    .page-header {
        align-items: flex-start;
    }

    .clinical-path {
        display: flex;
        overflow-x: auto;
        scroll-snap-type: x proximity;
    }

    .clinical-path a {
        min-width: 145px;
        border-bottom: 0 !important;
        scroll-snap-align: start;
    }
}

@media print {
    .mobile-clinical-nav {
        display: none !important;
    }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        scroll-behavior: auto !important;
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
    }
}
