/* Custom styles for MyHealth Vue+Vuetify mobile-friendly application */

/* General styles */
html, body {
    font-family: 'Roboto', sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    touch-action: manipulation;
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* Theme transition effects */
.v-application {
    transition: background-color 0.3s ease;
}

.v-card,
.v-app-bar,
.v-navigation-drawer,
.v-footer,
.v-btn,
.v-list,
.v-list-item,
.v-data-table,
.v-text-field,
.v-dialog,
.v-text-field,
.v-select,
.v-input {
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}

/* Smooth icon transition */
.v-icon {
    transition: transform 0.3s ease, color 0.3s ease;
}

.theme-toggle-btn {
    position: relative;
    overflow: hidden;
}

.theme-toggle-btn::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.2) 0%, rgba(255, 255, 255, 0) 70%);
    transform: scale(0) translate(-50%, -50%);
    transform-origin: top left;
    border-radius: 50%;
    transition: transform 0.5s;
}

.theme-toggle-btn:active::after {
    transform: scale(3) translate(-50%, -50%);
}

.theme-toggle-icon {
    transform: rotate(0deg);
    transition: transform 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.theme-toggle-icon--dark {
    transform: rotate(180deg);
}

/* Dark theme overrides */
[data-theme="dark"] .v-card__title {
    border-bottom-color: rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .v-data-table th {
    color: rgba(255, 255, 255, 0.87) !important;
}

[data-theme="dark"] h2 {
    color: rgba(255, 255, 255, 0.87);
}

[data-theme="dark"] .v-field__outline__notch {
    border-color: rgba(255, 255, 255, 0.2);
}

[data-theme="dark"] .v-btn:focus, 
[data-theme="dark"] .v-field:focus-within {
    outline: 2px solid rgba(41, 128, 185, 0.5);
}

/* Custom dialog background color in dark mode */
[data-theme="dark"] .v-dialog {
    background-color: #1e1e1e;
}

/* Semi-transparent backdrop for modals */
.v-overlay__scrim {
    background-color: rgba(0, 0, 0, 0.5) !important;
    backdrop-filter: blur(3px);
}

/* Better contrast for dark mode inputs */
[data-theme="dark"] .v-field__input {
    color: rgba(255, 255, 255, 0.9);
}

/* Health Chart Styles */
.health-chart-container {
    position: relative;
    overflow: hidden;
    height: 300px;
}

.health-reading-wrapper {
    border-radius: 8px;
    padding: 8px;
    margin-bottom: 8px;
    border: 1px solid rgba(0, 0, 0, 0.1);
    transition: background-color 0.2s ease, box-shadow 0.2s ease;
}

.health-reading-wrapper:hover {
    background-color: rgba(0, 0, 0, 0.02);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

[data-theme="dark"] .health-reading-wrapper {
    border-color: rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .health-reading-wrapper:hover {
    background-color: rgba(255, 255, 255, 0.05);
}

.health-reading-wrapper .edit-mode {
    background-color: rgba(0, 0, 0, 0.03);
    border-radius: 8px;
}

[data-theme="dark"] .health-reading-wrapper .edit-mode {
    background-color: rgba(255, 255, 255, 0.05);
}

.connection-line {
    display: inline-block;
    height: 2.5px;
    width: 40px;
    background-color: #2980b9;
    opacity: 0.8;
}

/* Prevent zoom on input focus for mobile */
@media (max-width: 768px) {
    input, select, textarea {
        font-size: 16px !important;
    }
}

/* Override some Vuetify styles */
h2 {
    font-weight: 500;
    margin-bottom: 1rem;
    color: #2c3e50;
}

.v-data-table th {
    font-weight: 500 !important;
}

/* Layout */
.v-main {
    min-height: calc(100vh - 128px); /* Account for app bar and footer */
}

/* For mobile devices with bottom navigation */
@media (max-width: 959px) {
    .v-main {
        min-height: calc(100vh - 56px - 56px); /* Account for app bar and bottom navigation */
        padding-bottom: 64px;
    }
}

/* Card style overrides */
.v-card {
    border-radius: 8px;
}

.v-card__title {
    font-size: 1.25rem;
    font-weight: 500;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

/* Fix for Safari button height */
.v-btn {
    line-height: normal;
}

/* Navigation drawer */
.v-navigation-drawer {
    z-index: 999;
}

/* Bottom navigation */
.v-bottom-navigation {
    box-shadow: 0 -2px 4px rgba(0, 0, 0, 0.1);
}

/* Dialog responsiveness */
@media (max-width: 599px) {
    .v-dialog:not(.v-dialog--fullscreen) {
        width: 100% !important;
        margin: 0 !important;
        border-radius: 0 !important;
    }
}

/* Data table responsiveness - use with care because Vuetify handles much of this */
@media (max-width: 599px) {
    .v-data-table__wrapper {
        overflow-x: auto;
    }
}

/* Custom classes for mobile optimization */
.text-truncate {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

.mobile-only {
    display: none;
}

@media (max-width: 959px) {
    .mobile-only {
        display: initial;
    }
    
    .desktop-only {
        display: none;
    }
}

/* Density adjustments for mobile inputs */
.v-text-field--density-comfortable .v-field__input {
    min-height: 40px;
    padding-top: 8px;
    padding-bottom: 8px;
}

/* Spacing adjustments for mobile */
@media (max-width: 599px) {
    .v-container {
        padding: 12px !important;
    }
    
    .v-card-text {
        padding: 16px !important;
    }
}

/* Focus styles for better accessibility */
.v-btn:focus, 
.v-field:focus-within {
    outline: 2px solid rgba(52, 152, 219, 0.5);
    outline-offset: 2px;
}

/* Touch-friendly sizing for interactive elements */
@media (max-width: 768px) {
    .v-btn {
        min-height: 44px;
    }
    
    .v-list-item {
        min-height: 48px;
    }
}

/* Fix for Safari overflow issues */
.v-application {
    overflow-x: hidden;
}

/* Screen reader only content (accessibility) */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* Input validation styling */
.v-field.valid .v-field__outline {
    color: var(--v-success-base, #2ecc71) !important;
}

.v-field.error .v-field__outline {
    color: var(--v-error-base, #e74c3c) !important;
}

.format-helper {
    font-size: 12px;
    color: rgba(0, 0, 0, 0.6);
    margin-top: 4px;
    font-style: italic;
}

[data-theme="dark"] .format-helper {
    color: rgba(255, 255, 255, 0.6);
}

/* Dashboard sections common styles */
.dashboard-section {
    margin-bottom: 1.5rem;
}

.dashboard-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

[data-theme="dark"] .dashboard-section-header {
    border-bottom-color: rgba(255, 255, 255, 0.1);
}

.dashboard-section-title {
    font-size: 1.25rem;
    font-weight: 500;
    margin: 0;
    display: flex;
    align-items: center;
}

.dashboard-section-title .v-icon {
    margin-right: 0.5rem;
    opacity: 0.8;
}

.dashboard-section-empty {
    text-align: center;
    padding: 2rem;
    background-color: rgba(0, 0, 0, 0.02);
    border-radius: 8px;
    margin-bottom: 1rem;
}

[data-theme="dark"] .dashboard-section-empty {
    background-color: rgba(255, 255, 255, 0.05);
}

.dashboard-section-card {
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    height: 100%;
}

.dashboard-section-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.1) !important;
}

/* Medical-specific styles */
.health-metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}

.metric-card {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.metric-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.1) !important;
}

.reading-value {
    font-size: 24px;
    font-weight: 600;
    line-height: 1.2;
}

.reading-unit {
    font-size: 14px;
    color: rgba(0, 0, 0, 0.6);
    margin-left: 4px;
}

[data-theme="dark"] .reading-unit {
    color: rgba(255, 255, 255, 0.6);
}

.reading-date {
    font-size: 12px;
    color: rgba(0, 0, 0, 0.6);
}

[data-theme="dark"] .reading-date {
    color: rgba(255, 255, 255, 0.6);
}

.medication-wrapper .v-card {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.medication-wrapper .v-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1) !important;
}

.visit-card {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.visit-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1) !important;
}

.reminder-icon {
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.15);
    }
    100% {
        transform: scale(1);
    }
}

/* Health status indicators */
.status-normal {
    color: #4CAF50;
}

.status-warning {
    color: #FFC107;
}

.status-alert {
    color: #F44336;
}

.status-info {
    color: #2196F3;
}

.pill-icon {
    font-size: 18px;
    margin-right: 4px;
}

.bp-indicator {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 12px;
    font-weight: 700;
    color: white;
}

.bp-normal {
    background-color: #4CAF50;
}

.bp-elevated {
    background-color: #FFC107;
}

.bp-high-1 {
    background-color: #FF9800;
}

.bp-high-2 {
    background-color: #F44336;
}

.bp-crisis {
    background-color: #9C27B0;
    animation: pulse 2s infinite;
}

.bp-low {
    background-color: #2196F3;
}

/* AI Assistant Styles */
.ai-assistant-sidebar .message-bubble {
    position: relative;
    margin-bottom: 8px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.ai-assistant-sidebar .message-content {
    white-space: pre-wrap;
    word-break: break-word;
}

.ai-assistant-sidebar .bg-grey-lighten-3 {
    position: relative;
}

.ai-assistant-sidebar .bg-grey-lighten-3::before {
    content: '';
    position: absolute;
    top: 8px;
    left: -8px;
    width: 0;
    height: 0;
    border-top: 8px solid transparent;
    border-right: 8px solid #e0e0e0;
    border-bottom: 8px solid transparent;
}

.ai-assistant-sidebar .bg-primary::before {
    content: '';
    position: absolute;
    top: 8px;
    right: -8px;
    width: 0;
    height: 0;
    border-top: 8px solid transparent;
    border-left: 8px solid var(--v-primary-base, #1976D2);
    border-bottom: 8px solid transparent;
}

.chat-container {
    scroll-behavior: smooth;
    overflow-x: hidden;
}

[data-theme="dark"] .ai-assistant-sidebar .bg-grey-lighten-3 {
    background-color: #333 !important;
    color: #fff;
}

[data-theme="dark"] .ai-assistant-sidebar .bg-grey-lighten-3::before {
    border-right-color: #333;
}

[data-theme="dark"] .ai-assistant-sidebar .text-grey {
    color: rgba(255, 255, 255, 0.6) !important;
}

.ai-assistant-sidebar {
    overflow: hidden;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), width 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
    display: flex;
    flex-direction: column;
}

/* Override Vuetify's overlay for AI assistant */
.v-overlay--active {
    background-color: transparent !important;
    pointer-events: none !important;
}

.v-overlay__content {
    pointer-events: auto !important;
}

/* Add a slight shadow to the left edge of the sidebar */
.ai-assistant-sidebar::before {
    content: '';
    position: absolute;
    left: -10px;
    top: 0;
    height: 100%;
    width: 10px;
    box-shadow: 5px 0 10px rgba(0, 0, 0, 0.1);
    pointer-events: none;
}

/* Fullscreen AI Assistant */
.ai-assistant-sidebar.fullscreen {
    width: 100% !important;
    max-width: 100% !important;
    z-index: 1500 !important;
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    height: 100vh !important;
}

/* Chat container in fullscreen mode */
.ai-assistant-sidebar.fullscreen .chat-container {
    width: 100% !important;
    max-width: 1200px !important;
    margin: 0 auto !important;
    padding: 0 !important;
}

/* Assistant message bubble alignment - explicitly left aligned */
.ai-assistant-sidebar.fullscreen .message-bubble.bg-grey-lighten-3 {
    float: left !important;
    clear: both !important;
    max-width: 70% !important;
}

/* User message bubble alignment - explicitly right aligned */
.ai-assistant-sidebar.fullscreen .message-bubble.bg-primary {
    float: right !important;
    clear: both !important;
    max-width: 70% !important;
}

/* Ensure each message has space and clears floats */
.ai-assistant-sidebar.fullscreen .chat-container > div {
    margin-bottom: 16px !important;
    overflow: hidden !important;
    width: 100% !important;
}

/* Input container in fullscreen mode */
.chat-input-container-fullscreen {
    max-width: 900px !important;
    margin: 0 auto !important;
}

.fullscreen-toggle-btn {
    transition: transform 0.3s ease;
}

.fullscreen-toggle-btn--active .v-icon {
    transform: scale(0.8);
}

.ai-assistant-content {
    display: flex;
    flex-direction: column;
    flex: 1;
    position: relative;
    max-height: calc(100% - 110px);
}

.chat-input {
    background-color: var(--v-background-base, #fff);
    border-top: 1px solid rgba(0, 0, 0, 0.06);
    z-index: 2;
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
}

[data-theme="dark"] .chat-input {
    background-color: var(--v-background-base, #1e1e1e);
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.floating-ai-button {
    z-index: 100;
    animation: bounce 2s infinite;
    transition: transform 0.3s ease;
}

.floating-ai-button:hover {
    transform: scale(1.1);
    animation: none;
}

@keyframes bounce {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-10px);
    }
}

/* Prompt textarea styling for LLM models */
.prompt-textarea textarea {
    font-family: 'Roboto Mono', monospace !important;
    font-size: 14px !important;
    line-height: 1.6 !important;
    background-color: #f8f9fa !important;
    padding: 12px !important;
    border-radius: 4px !important;
    border: 1px solid rgba(0, 0, 0, 0.1) !important;
    min-height: 250px !important;
}

[data-theme="dark"] .prompt-textarea textarea {
    background-color: #1e1e1e !important;
    border-color: rgba(255, 255, 255, 0.1) !important;
    color: rgba(255, 255, 255, 0.9) !important;
}