/* AI Coach Integration Styles */
.ai-coach-panel {
    position: fixed;
    right: -400px;
    top: 0;
    width: 400px;
    height: 100vh;
    background: white;
    box-shadow: -2px 0 10px rgba(0,0,0,0.1);
    transition: right 0.3s ease;
    z-index: 1000000;
    display: flex;
    flex-direction: column;
}

.ai-coach-panel.open {
    right: 0;
}

.ai-coach-panel.open ~ .ai-coach-fab {
    opacity: 0;
    pointer-events: none;
    transform: scale(0.8);
}

.ai-coach-header {
    padding: 20px;
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.ai-coach-close {
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
}

.ai-coach-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

.ai-insight-card {
    background: #f9fafb;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 15px;
    border-left: 4px solid #059669;
}

.ai-insight-card.warning {
    border-left-color: #f59e0b;
    background: #fffbeb;
}

.ai-insight-card.error {
    border-left-color: #dc2626;
    background: #fef2f2;
}

.ai-chat-container {
    display: flex;
    flex-direction: column;
    height: 100%;
    background: #ffffff;
}

/* Message timestamp or metadata could go here */
.message-time {
    font-size: 11px;
    color: #9ca3af;
    margin-top: 6px;
    display: block;
}

/* Code blocks if AI returns code */
.message-content code {
    background: #f3f4f6;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 13px;
    color: #059669;
}

.message-content pre {
    background: #f3f4f6;
    padding: 12px;
    border-radius: 8px;
    overflow-x: auto;
    margin: 12px 0;
}

.message-content pre code {
    background: none;
    padding: 0;
}

.ai-messages {
    flex: 1;
    overflow-y: auto;
    padding: 24px 20px;
    display: flex;
    flex-direction: column;
    gap: 0;
    background: #ffffff;
}

.ai-message {
    display: flex;
    gap: 0;
    animation: slideIn 0.3s ease;
    align-items: flex-start;
    margin-bottom: 24px;
}

.ai-message.user {
    flex-direction: row-reverse;
    justify-content: flex-start;
}

.message-avatar {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
    background: #059669;
    color: white;
    font-weight: 700;
    margin-right: 12px;
    font-family: 'Arial', sans-serif;
    letter-spacing: -0.5px;
}

.ai-message.user .message-avatar {
    background: #e5e7eb;
    color: #6b7280;
    margin-right: 0;
    margin-left: 12px;
    font-size: 10px;
    font-weight: 500;
}

.message-content {
    padding: 0;
    border-radius: 0;
    max-width: 85%;
    line-height: 1.7;
    font-size: 15px;
    color: #374151;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

.ai-message.user .message-content {
    background: transparent;
    color: #1f2937;
    text-align: left;
}

.ai-message.coach .message-content {
    background: transparent;
    color: #374151;
}

/* Message content typography */
.msg-para {
    margin: 0 0 16px 0;
    font-weight: 400;
    letter-spacing: 0.01em;
}

.msg-para:last-child {
    margin-bottom: 0;
}

.msg-heading {
    font-size: 18px;
    font-weight: 700;
    color: #059669;
    margin: 20px 0 14px 0;
    padding-bottom: 8px;
    border-bottom: 2px solid #d1fae5;
}

.msg-heading:first-child {
    margin-top: 0;
}

.msg-section-title {
    font-size: 15px;
    font-weight: 600;
    color: #111827;
    margin: 18px 0 10px 0;
    padding: 10px 12px;
    background: linear-gradient(135deg, #f0fdf4 0%, #ecfdf5 100%);
    border-radius: 8px;
    border-left: 4px solid #059669;
}

.msg-section-title:first-child {
    margin-top: 0;
}

.msg-section-title .section-number {
    color: #059669;
    font-weight: 700;
    margin-right: 4px;
}

.msg-subheading {
    font-size: 14px;
    font-weight: 600;
    color: #374151;
    margin: 14px 0 8px 0;
}

.ai-message.user .msg-heading {
    color: #111827;
}

.msg-list {
    margin: 12px 0 16px 0;
    padding-left: 0;
    list-style-position: outside;
    list-style-type: none;
    counter-reset: list-counter;
}

.msg-list:last-child {
    margin-bottom: 0;
}

.msg-list li,
.msg-bullet {
    margin-bottom: 10px;
    line-height: 1.7;
    padding-left: 28px;
    position: relative;
    font-weight: 400;
    display: block;
}

.msg-list li:last-child,
.msg-bullet:last-child {
    margin-bottom: 0;
}

/* Custom bullet styling */
.msg-list li::before,
.msg-bullet::before {
    content: "•";
    position: absolute;
    left: 8px;
    color: #059669;
    font-weight: 700;
    font-size: 18px;
}

/* Numbered list styling */
ol.msg-list {
    counter-reset: list-counter;
}

ol.msg-list li::before {
    content: counter(list-counter) ".";
    counter-increment: list-counter;
    position: absolute;
    left: 0;
    color: #059669;
    font-weight: 700;
    font-size: 15px;
}

ol.msg-list li {
    padding-left: 32px;
}

.msg-list ul,
.msg-list ol {
    margin-top: 8px;
    padding-left: 24px;
}

/* Currency and metric highlighting */
.msg-currency {
    font-weight: 600;
    color: #059669;
    white-space: nowrap;
}

.msg-metric {
    font-weight: 600;
    color: #7c3aed;
    background: #f5f3ff;
    padding: 1px 6px;
    border-radius: 4px;
    font-size: 0.95em;
}

.message-content strong {
    font-weight: 700;
    color: #111827;
}

.ai-message.user .message-content strong {
    color: #111827;
    font-weight: 700;
}

.message-content em {
    font-style: italic;
    opacity: 1;
    color: #6b7280;
}

/* Better spacing for coach messages */
.ai-message.coach .message-content {
    padding: 0;
}

.ai-message.coach .msg-para + .msg-para {
    margin-top: 16px;
}

.ai-message.coach .msg-list {
    background: transparent;
    padding: 0;
    border-radius: 0;
    margin: 12px 0 16px 0;
}

/* User message styling */
.ai-message.user .message-content {
    background: transparent;
    padding: 0;
    font-weight: 500;
    color: #1f2937;
}

.ai-chat-input {
    padding: 16px 20px 20px 20px;
    border-top: 1px solid #e5e7eb;
    display: flex;
    gap: 12px;
    background: white;
    align-items: flex-end;
}

.ai-chat-input input {
    flex: 1;
    padding: 14px 18px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    font-size: 15px;
    transition: all 0.2s;
    color: #1f2937;
    background: #ffffff;
}

.ai-chat-input input::placeholder {
    color: #9ca3af;
}

.ai-chat-input input:focus {
    outline: none;
    border-color: #059669;
    box-shadow: 0 0 0 3px rgba(5, 150, 105, 0.1);
}

.ai-chat-input button {
    width: 44px;
    height: 44px;
    padding: 0;
    background: #059669;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.ai-chat-input button:hover {
    background: #047857;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(5, 150, 105, 0.3);
}

.ai-chat-input button:active {
    transform: translateY(0);
}

.ai-chat-input button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.ai-coach-fab {
    position: fixed !important;
    bottom: 30px !important;
    right: 30px !important;
    width: 68px;
    height: 68px;
    border-radius: 18px;
    background: linear-gradient(135deg, #10b981 0%, #059669 50%, #047857 100%);
    color: white;
    border: none;
    box-shadow: 
        0 12px 35px rgba(16, 185, 129, 0.35), 
        0 6px 15px rgba(0, 0, 0, 0.2),
        inset 0 1px 2px rgba(255, 255, 255, 0.3),
        inset 0 -2px 4px rgba(0, 0, 0, 0.1);
    cursor: pointer;
    display: flex !important;
    align-items: center;
    justify-content: center;
    z-index: 999999 !important;
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    overflow: visible;
    backdrop-filter: blur(10px);
}

.ai-coach-fab:hover {
    transform: translateY(-6px) scale(1.08) rotate(5deg);
    box-shadow: 
        0 18px 45px rgba(16, 185, 129, 0.5), 
        0 10px 20px rgba(0, 0, 0, 0.25),
        inset 0 2px 3px rgba(255, 255, 255, 0.4),
        inset 0 -2px 4px rgba(0, 0, 0, 0.15);
}

.ai-coach-fab:active {
    transform: translateY(-3px) scale(1.03) rotate(2deg);
}

.ai-coach-fab svg {
    filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.25));
    transition: transform 0.3s ease;
}

.ai-coach-fab:hover svg {
    transform: scale(1.05);
}

/* Floating animation for attention */
@keyframes float {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-8px); }
}

.ai-coach-fab {
    animation: float 4s ease-in-out infinite;
}

.ai-coach-fab:hover {
    animation: none;
}

.ai-loading {
    display: flex;
    gap: 4px;
    padding: 0;
    align-items: center;
}

.ai-loading::after {
    content: '';
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #9ca3af;
    animation: typing 1.4s infinite;
}

.ai-loading::before {
    content: '';
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #9ca3af;
    animation: typing 1.4s infinite 0.2s;
}

.ai-loading span {
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #9ca3af;
    animation: typing 1.4s infinite 0.4s;
}

@keyframes typing {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: 0.5;
    }
    30% {
        transform: translateY(-6px);
        opacity: 1;
    }
}

.ai-tabs {
    display: flex;
    border-bottom: 1px solid #e5e7eb;
    padding: 0 20px;
    background: white;
}

.ai-tab {
    padding: 15px 20px;
    border: none;
    background: none;
    cursor: pointer;
    font-weight: 500;
    color: #6b7280;
    border-bottom: 2px solid transparent;
    transition: all 0.3s;
}

.ai-tab.active {
    color: #059669;
    border-bottom-color: #059669;
}

.routine-section {
    margin-bottom: 20px;
}

.routine-section h4 {
    color: #059669;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.routine-item {
    padding: 10px;
    background: white;
    border-radius: 6px;
    margin-bottom: 8px;
    display: flex;
    align-items: start;
    gap: 10px;
}

.routine-item input[type="checkbox"] {
    margin-top: 4px;
}

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

/* Scrollbar styling for messages */
.ai-messages::-webkit-scrollbar {
    width: 6px;
}

.ai-messages::-webkit-scrollbar-track {
    background: transparent;
}

.ai-messages::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 3px;
}

.ai-messages::-webkit-scrollbar-thumb:hover {
    background: #9ca3af;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.severity-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
}

.severity-badge.high {
    background: #fee2e2;
    color: #dc2626;
}

.severity-badge.medium {
    background: #fef3c7;
    color: #f59e0b;
}

.severity-badge.low {
    background: #dbeafe;
    color: #3b82f6;
}

.metric-highlight {
    font-size: 24px;
    font-weight: 700;
    color: #059669;
    margin: 10px 0;
}

.learning-path {
    background: white;
    padding: 15px;
    border-radius: 8px;
    margin-top: 15px;
}

.learning-path h4 {
    color: #1f2937;
    margin-bottom: 10px;
}

.learning-item {
    padding: 8px;
    border-left: 3px solid #059669;
    background: #f9fafb;
    margin-bottom: 8px;
    padding-left: 12px;
}

