/**
 * Movement Orthopedics Patient Care Portal
 * Main Stylesheet
 */

/* ========== Reset & Base ========== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --navy: #1B3A5C;
    --orange: #F66A05;
    --red: #e74c3c;
    --yellow: #f39c12;
    --blue: #3498db;
    --green: #27ae60;
    --gray-100: #f8f9fa;
    --gray-200: #e9ecef;
    --gray-300: #dee2e6;
    --gray-600: #6c757d;
    --gray-800: #343a40;
    --white: #ffffff;
    --shadow: 0 2px 8px rgba(0,0,0,0.1);
    --shadow-lg: 0 4px 16px rgba(0,0,0,0.15);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    font-size: 16px;
    line-height: 1.6;
    color: var(--gray-800);
    background: var(--gray-100);
}

/* ========== Layout ========== */
.app-container {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 260px;
    background: var(--navy);
    color: var(--white);
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    overflow-y: auto;
}

.sidebar-header {
    padding: 30px 20px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar-header h1 {
    font-size: 1.5em;
    font-weight: 700;
    line-height: 1.2;
    margin-bottom: 5px;
}

.sidebar-header .subtitle {
    font-size: 0.9em;
    opacity: 0.8;
}

.sidebar-nav {
    flex: 1;
    padding: 20px 0;
}

.nav-item {
    display: flex;
    align-items: center;
    padding: 14px 20px;
    color: var(--white);
    text-decoration: none;
    transition: all 0.2s;
}

.nav-item i {
    width: 24px;
    margin-right: 12px;
    font-size: 1.1em;
}

.nav-item:hover {
    background: rgba(255,255,255,0.1);
}

.nav-item.active {
    background: var(--orange);
    border-left: 4px solid var(--white);
    font-weight: 600;
}

.sidebar-footer {
    padding: 20px;
    border-top: 1px solid rgba(255,255,255,0.1);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 15px;
}

.user-info i {
    font-size: 2em;
}

.user-info strong {
    display: block;
    font-size: 0.95em;
}

.user-info small {
    font-size: 0.8em;
    opacity: 0.7;
}

.btn-logout {
    display: block;
    text-align: center;
    padding: 10px;
    background: rgba(255,255,255,0.1);
    color: var(--white);
    text-decoration: none;
    border-radius: 4px;
    transition: all 0.2s;
}

.btn-logout:hover {
    background: rgba(255,255,255,0.2);
}

.main-content {
    flex: 1;
    margin-left: 260px;
    padding: 30px;
    overflow-y: auto;
}

/* ========== Cards ========== */
.card {
    background: var(--white);
    border-radius: 8px;
    padding: 24px;
    box-shadow: var(--shadow);
    margin-bottom: 24px;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid var(--gray-200);
}

.card-header h2 {
    font-size: 1.5em;
    font-weight: 600;
    color: var(--navy);
}

.card-header h3 {
    font-size: 1.2em;
    font-weight: 600;
    color: var(--navy);
}

.card-body {
    padding: 0;
}

/* ========== Stats Grid ========== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: var(--white);
    border-radius: 8px;
    padding: 20px;
    box-shadow: var(--shadow);
    border-left: 4px solid var(--orange);
}

.stat-card h3 {
    font-size: 0.9em;
    color: var(--gray-600);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-card .stat-value {
    font-size: 2.5em;
    font-weight: 700;
    color: var(--navy);
}

.stat-card .stat-label {
    font-size: 0.85em;
    color: var(--gray-600);
}

/* ========== Tabs ========== */
.tabs {
    display: flex;
    gap: 4px;
    border-bottom: 2px solid var(--gray-200);
    margin-bottom: 24px;
}

.tab {
    padding: 12px 24px;
    background: transparent;
    border: none;
    color: var(--gray-600);
    cursor: pointer;
    font-size: 1em;
    font-weight: 500;
    transition: all 0.2s;
    border-bottom: 3px solid transparent;
}

.tab:hover {
    color: var(--navy);
    background: var(--gray-100);
}

.tab.active {
    color: var(--orange);
    border-bottom-color: var(--orange);
    font-weight: 600;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* ========== Tables ========== */
.table {
    width: 100%;
    border-collapse: collapse;
}

.table th {
    background: var(--gray-100);
    padding: 12px;
    text-align: left;
    font-weight: 600;
    color: var(--navy);
    border-bottom: 2px solid var(--gray-300);
}

.table td {
    padding: 12px;
    border-bottom: 1px solid var(--gray-200);
}

.table tbody tr:hover {
    background: var(--gray-100);
    cursor: pointer;
}

.table-actions {
    display: flex;
    gap: 8px;
}

/* ========== Forms ========== */
.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    font-weight: 600;
    margin-bottom: 6px;
    color: var(--navy);
}

.form-label.required::after {
    content: " *";
    color: var(--red);
}

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--gray-300);
    border-radius: 4px;
    font-size: 1em;
    font-family: inherit;
    transition: border-color 0.2s;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--orange);
    box-shadow: 0 0 0 3px rgba(246, 106, 5, 0.1);
}

.form-textarea {
    min-height: 100px;
    resize: vertical;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

/* ========== Buttons ========== */
.btn {
    display: inline-block;
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    text-align: center;
    transition: all 0.2s;
}

.btn-primary {
    background: var(--orange);
    color: var(--white);
}

.btn-primary:hover {
    background: #e55f04;
}

.btn-secondary {
    background: var(--gray-600);
    color: var(--white);
}

.btn-secondary:hover {
    background: var(--gray-800);
}

.btn-success {
    background: var(--green);
    color: var(--white);
}

.btn-danger {
    background: var(--red);
    color: var(--white);
}

.btn-small {
    padding: 6px 12px;
    font-size: 0.9em;
}

.btn-icon {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

/* ========== Alerts ========== */
.alert {
    padding: 14px 18px;
    border-radius: 4px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.alert-success {
    background: #d4edda;
    color: #155724;
    border-left: 4px solid var(--green);
}

.alert-error {
    background: #f8d7da;
    color: #721c24;
    border-left: 4px solid var(--red);
}

.alert-warning {
    background: #fff3cd;
    color: #856404;
    border-left: 4px solid var(--yellow);
}

.alert-info {
    background: #d1ecf1;
    color: #0c5460;
    border-left: 4px solid var(--blue);
}

/* ========== Patient List ========== */
.patient-list-item {
    padding: 16px;
    border-bottom: 1px solid var(--gray-200);
    cursor: pointer;
    transition: background 0.2s;
}

.patient-list-item:hover {
    background: var(--gray-100);
}

.patient-name {
    font-weight: 600;
    font-size: 1.1em;
    color: var(--navy);
    margin-bottom: 6px;
}

.patient-meta {
    display: flex;
    gap: 16px;
    font-size: 0.9em;
    color: var(--gray-600);
    flex-wrap: wrap;
}

.patient-meta span {
    display: flex;
    align-items: center;
    gap: 4px;
}

/* ========== Timeline ========== */
.timeline {
    position: relative;
    padding-left: 30px;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 10px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--gray-300);
}

.timeline-item {
    position: relative;
    padding-bottom: 24px;
}

.timeline-item::before {
    content: '';
    position: absolute;
    left: -26px;
    top: 6px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--white);
    border: 3px solid var(--orange);
}

.timeline-item.system::before {
    border-color: var(--gray-600);
}

.timeline-item.alert::before {
    border-color: var(--red);
}

.timeline-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
}

.timeline-sender {
    font-weight: 600;
    color: var(--navy);
}

.timeline-time {
    font-size: 0.85em;
    color: var(--gray-600);
}

.timeline-message {
    background: var(--gray-100);
    padding: 12px;
    border-radius: 4px;
}

.timeline-message.patient {
    background: #e3f2fd;
}

.timeline-message.provider {
    background: #f3e5f5;
}

/* ========== Message Composer ========== */
.message-composer {
    background: var(--white);
    border-radius: 8px;
    padding: 20px;
    box-shadow: var(--shadow);
    margin-top: 20px;
}

.canned-select {
    margin-bottom: 12px;
}

.composer-textarea {
    width: 100%;
    min-height: 100px;
    padding: 12px;
    border: 1px solid var(--gray-300);
    border-radius: 4px;
    font-family: inherit;
    font-size: 1em;
    resize: vertical;
}

.composer-actions {
    display: flex;
    justify-content: space-between;
    margin-top: 12px;
}

/* ========== Quick Actions ========== */
.quick-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 16px;
}

.quick-action {
    padding: 8px 16px;
    border: 2px solid var(--navy);
    background: var(--white);
    color: var(--navy);
    border-radius: 20px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.quick-action:hover {
    background: var(--navy);
    color: var(--white);
}

/* ========== Status Controls ========== */
.status-controls {
    display: flex;
    gap: 10px;
    margin: 20px 0;
}

.status-btn {
    flex: 1;
    padding: 12px;
    border: 2px solid transparent;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.status-btn.green {
    background: var(--green);
    color: var(--white);
}

.status-btn.yellow {
    background: var(--yellow);
    color: var(--white);
}

.status-btn.red {
    background: var(--red);
    color: var(--white);
}

.status-btn.blue {
    background: var(--blue);
    color: var(--white);
}

.status-btn:hover {
    opacity: 0.9;
    transform: translateY(-2px);
}

/* ========== Search & Filters ========== */
.search-bar {
    position: relative;
    margin-bottom: 20px;
}

.search-input {
    width: 100%;
    padding: 12px 12px 12px 40px;
    border: 1px solid var(--gray-300);
    border-radius: 6px;
    font-size: 1em;
}

.search-bar i {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--gray-600);
}

.filters {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ========== Charts ========== */
.chart-container {
    position: relative;
    height: 300px;
    margin: 20px 0;
}

.chart-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

/* ========== Login Page ========== */
.login-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, var(--navy) 0%, #2c5282 100%);
}

.login-card {
    background: var(--white);
    border-radius: 12px;
    padding: 40px;
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 400px;
}

.login-header {
    text-align: center;
    margin-bottom: 30px;
}

.login-header h1 {
    color: var(--navy);
    font-size: 1.8em;
    margin-bottom: 8px;
}

.login-header p {
    color: var(--gray-600);
}

/* ========== Patient Portal Styles ========== */
.portal-container {
    max-width: 600px;
    margin: 0 auto;
    padding: 20px;
}

.portal-header {
    background: var(--navy);
    color: var(--white);
    padding: 20px;
    text-align: center;
    margin-bottom: 20px;
    border-radius: 8px;
}

.portal-card {
    background: var(--white);
    border-radius: 8px;
    padding: 20px;
    box-shadow: var(--shadow);
    margin-bottom: 20px;
}

.check-in-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.pain-scale {
    display: flex;
    justify-content: space-between;
    margin-top: 10px;
}

.pain-btn {
    width: 40px;
    height: 40px;
    border: 2px solid var(--gray-300);
    background: var(--white);
    border-radius: 50%;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.pain-btn:hover,
.pain-btn.selected {
    background: var(--orange);
    border-color: var(--orange);
    color: var(--white);
}

/* ========== Responsive ========== */
@media (max-width: 768px) {
    .sidebar {
        width: 200px;
    }
    
    .main-content {
        margin-left: 200px;
        padding: 20px;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .chart-row {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 576px) {
    .sidebar {
        width: 70px;
    }
    
    .sidebar-header h1,
    .sidebar-header .subtitle,
    .nav-item span,
    .user-info div,
    .btn-logout {
        display: none;
    }
    
    .nav-item {
        justify-content: center;
    }
    
    .main-content {
        margin-left: 70px;
        padding: 15px;
    }
}

/* ========== Print Styles ========== */
@media print {
    .sidebar,
    .btn,
    .quick-actions,
    .message-composer {
        display: none;
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .card {
        box-shadow: none;
        border: 1px solid var(--gray-300);
    }
}
