/* IDENTITY.OS™ Custom Styles */
:root {
    --primary-color: #6366f1;
    --secondary-color: #8b5cf6;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;
    --info-color: #3b82f6;
    --dark-color: #1f2937;
    --light-color: #f8fafc;
    --warm-white: #fefefe;
    --soft-gray: #6b7280;
    --border-color: #e5e7eb;
}

/* Global Styles */
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--light-color);
    color: var(--dark-color);
    line-height: 1.6;
}

.main-content {
    padding-top: 120px;
    padding-bottom: 3rem;
    min-height: 100vh;
}

/* Page-specific content padding */
.page-header {
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.page-title {
    font-size: 1.75rem;
    font-weight: 600;
    color: var(--dark-color);
    margin-bottom: 0.5rem;
}

.page-subtitle {
    color: var(--soft-gray);
    font-size: 1rem;
    margin-bottom: 0;
}

/* Container padding for desktop */
@media (min-width: 768px) {
    .container-fluid {
        padding-left: 2rem;
        padding-right: 2rem;
    }
    
    .container {
        padding-left: 1.5rem;
        padding-right: 1.5rem;
    }
}

@media (min-width: 1200px) {
    .container-fluid {
        padding-left: 3rem;
        padding-right: 3rem;
    }
    
    .container {
        padding-left: 2rem;
        padding-right: 2rem;
    }
}

/* Navigation */
.navbar {
    backdrop-filter: blur(10px);
    background-color: rgba(255, 255, 255, 0.95) !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    min-height: 70px;
    padding: 0.75rem 0;
    z-index: 1050;
}

/* Custom responsive breakpoint to prevent navigation cutoff */
@media (max-width: 1400px) {
    /* Adjust logo positioning for mobile */
    .container-fluid {
        padding-left: 1rem !important;
        padding-right: 1rem !important;
    }
    
    .navbar-brand {
        margin-left: 0 !important;
    }
    
    .navbar-nav {
        text-align: left;
        width: 100%;
    }
    
    .navbar-collapse {
        margin-top: 0.75rem;
        padding: 0;
    }
    
    .navbar-nav .nav-item {
        margin: 0;
        width: 100%;
    }
    
    /* Mobile menu styling - consistent horizontal layout */
    .navbar-nav .nav-link-vertical {
        display: flex;
        flex-direction: row;
        align-items: center;
        justify-content: flex-start;
        text-align: left;
        padding: 0.75rem 1rem;
        margin: 0;
        border-radius: 0;
        width: 100%;
        transition: background-color 0.2s ease;
    }
    
    .navbar-nav .nav-link-vertical:hover {
        background-color: rgba(0, 0, 0, 0.05);
    }
    
    .navbar-nav .nav-link-vertical div {
        margin-right: 1rem;
        margin-bottom: 0;
        display: flex;
        align-items: center;
        justify-content: flex-start;
        width: 20px;
        height: 20px;
    }
    
    .navbar-nav .nav-link-vertical i {
        width: 18px;
        height: 18px;
    }
    
    .navbar-nav .nav-link-vertical small {
        font-size: 0.95rem;
        line-height: 1.2;
        font-weight: 500;
    }
    
    /* Crisis button mobile styling */
    .crisis-btn {
        display: flex;
        flex-direction: row;
        align-items: center;
        justify-content: flex-start;
        text-align: left;
        padding: 0.75rem 1rem;
        margin: 0 0.5rem 0 0;
        border-radius: 0;
        width: calc(100% - 0.5rem);
        transition: all 0.2s ease;
    }
    
    .crisis-btn i {
        margin-right: 1rem;
        margin-bottom: 0;
        width: 18px;
        height: 18px;
        display: flex;
        align-items: center;
        justify-content: flex-start;
    }
    
    .crisis-btn small {
        font-size: 0.95rem;
        line-height: 1.2;
        margin-top: 0;
        font-weight: 500;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    
    /* User greeting and logout mobile styling */
    .navbar-nav .nav-item.d-flex {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        padding: 0.75rem 1rem;
        margin: 0;
        background-color: rgba(0, 0, 0, 0.02);
        border-radius: 0;
        width: 100%;
    }
    
    .navbar-nav .nav-item.d-flex .navbar-text {
        margin-bottom: 0;
        margin-right: 1rem;
        flex: 1;
        text-align: left;
    }
    
    .navbar-nav .nav-item.d-flex .btn {
        margin-left: auto;
        margin-right: 0.5rem;
        white-space: nowrap;
        font-size: 0.875rem;
    }
    
    /* Ensure proper spacing for main navigation items */
    .navbar-nav.me-auto {
        margin-bottom: 1rem;
        border-bottom: 1px solid rgba(0, 0, 0, 0.1);
        padding-bottom: 0.5rem;
    }
    
    /* Profile section styling */
    .navbar-nav:not(.me-auto) .nav-item:not(.d-flex) {
        margin-bottom: 0.5rem;
    }
}

.navbar-nav .nav-item {
    display: flex;
    align-items: center;
}

.navbar-nav .btn {
    display: flex;
    align-items: center;
    white-space: nowrap;
}

.navbar-brand {
    font-size: 1.5rem;
    color: var(--primary-color) !important;
    display: flex;
    align-items: center;
}

/* Vertical navigation links */
.nav-link-vertical {
    padding: 0.5rem 0.75rem !important;
    line-height: 1.2;
    min-width: 60px;
}

.nav-link-vertical div {
    margin-bottom: 2px;
}

.nav-link-vertical i {
    width: 18px;
    height: 18px;
}

.nav-link-vertical small {
    font-size: 0.75rem;
    font-weight: 500;
}

/* User greeting styling */
.navbar-text {
    line-height: 1.2;
    margin-bottom: 0;
}

.navbar-text small {
    font-size: 0.75rem;
}

.navbar-text strong {
    font-size: 0.9rem;
    color: var(--dark-color);
}

/* Crisis Mode button styling */
.crisis-btn {
    min-width: 50px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    line-height: 1 !important;
    padding: 6px 8px !important;
}

.crisis-btn small {
    font-size: 0.65rem;
    line-height: 0.9;
    margin-top: 2px;
}

.crisis-btn i {
    margin-bottom: 2px !important;
}

/* Onboarding Modal Styles */
.onboarding-step {
    padding: 1rem;
    border-radius: 8px;
    background: var(--light-color);
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.onboarding-step:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
    background: rgba(255, 255, 255, 0.9);
}

.step-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 0.5rem;
    background: rgba(255, 255, 255, 0.8);
    transition: all 0.3s ease;
}

.onboarding-step:hover .step-icon {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.step-icon i {
    width: 20px;
    height: 20px;
    transition: all 0.3s ease;
}

.onboarding-step:hover .step-icon i {
    transform: scale(1.1);
}

.onboarding-step h6 {
    margin-bottom: 0.25rem;
    font-weight: 600;
    color: var(--dark-color);
    transition: color 0.3s ease;
}

.onboarding-step:hover h6 {
    color: var(--primary-color);
}

.onboarding-step small {
    color: var(--soft-gray);
    line-height: 1.3;
    transition: color 0.3s ease;
}

.onboarding-step:hover small {
    color: var(--dark-color);
}

.modal-header.bg-primary {
    border-bottom: none;
}

.modal-footer {
    border-top: none;
    padding-top: 0;
}

/* Micro-interactions and Animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes pulseGlow {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(99, 102, 241, 0.4);
    }
    50% {
        box-shadow: 0 0 0 10px rgba(99, 102, 241, 0);
    }
}

@keyframes buttonPress {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(0.98);
    }
    100% {
        transform: scale(1);
    }
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-2px); }
    75% { transform: translateX(2px); }
}

/* Button Micro-interactions */
.btn {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: left 0.6s;
}

.btn:hover::before {
    left: 100%;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.btn:active {
    animation: buttonPress 0.2s ease;
}

.btn-primary:hover {
    box-shadow: 0 8px 25px rgba(99, 102, 241, 0.4);
}

.btn-success:hover {
    box-shadow: 0 8px 25px rgba(16, 185, 129, 0.4);
}

.btn-warning:hover {
    box-shadow: 0 8px 25px rgba(245, 158, 11, 0.4);
}

.btn-danger:hover {
    box-shadow: 0 8px 25px rgba(239, 68, 68, 0.4);
}

/* Card Micro-interactions */
.card {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.1);
    border-color: rgba(99, 102, 241, 0.2);
}

.action-card:hover {
    border-color: var(--primary-color);
}

.action-card:hover .action-icon {
    transform: scale(1.1) rotate(5deg);
    color: var(--primary-color);
}

/* Navigation Micro-interactions */
.nav-link-vertical:hover {
    transform: translateY(-2px);
    background: rgba(99, 102, 241, 0.1);
    border-radius: 8px;
}

.nav-link-vertical:hover i {
    transform: scale(1.1);
    color: var(--primary-color);
}

.navbar-brand {
    transition: all 0.3s ease;
}

.navbar-brand:hover {
    background: linear-gradient(135deg, #1e3a8a, #3730a3, #1e40af);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-size: 200% 200%;
    animation: gradientSweep 1.5s ease-in-out;
}

.navbar-brand:hover i {
    color: #1e40af;
    transition: color 0.3s ease;
}

@keyframes gradientSweep {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

/* Form Micro-interactions */
.form-control {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: 2px solid var(--border-color);
}

.form-control:focus {
    transform: translateY(-1px);
    box-shadow: 0 8px 25px rgba(99, 102, 241, 0.15);
    border-color: var(--primary-color);
}

.form-control:invalid {
    animation: shake 0.5s ease-in-out;
}

/* Input Groups */
.input-group:hover .form-control {
    border-color: var(--primary-color);
}

/* Alert Animations */
.alert {
    animation: fadeInUp 0.5s ease;
}

/* Page Load Animations */
.main-content > .row {
    animation: fadeInUp 0.6s ease;
}

.main-content > .row:nth-child(2) {
    animation-delay: 0.1s;
}

.main-content > .row:nth-child(3) {
    animation-delay: 0.2s;
}

/* Progress indicators - removed transform effects */
.stat-number {
    font-size: 2rem;
    font-weight: 700;
}

/* Crisis button special effect */
.crisis-btn {
    position: relative;
}

.crisis-btn:hover {
    animation: pulseGlow 1s infinite;
}

/* Loading states */
.btn.loading {
    pointer-events: none;
    opacity: 0.7;
}

.btn.loading::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    margin: auto;
    border: 2px solid transparent;
    border-top-color: currentColor;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Smooth scrolling */
html {
    scroll-behavior: smooth;
}

/* Focus indicators */
*:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
    border-radius: 4px;
}

/* Voice recognition styles removed */

/* Simplified action card interactions - removed 3D effects */
.action-card {
    cursor: pointer;
    transition: box-shadow 0.2s ease;
}

.action-card:hover {
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

/* Welcome section gradient - removed animation to prevent flickering */
.welcome-section {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
}

@keyframes gradientShift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* Enhanced navigation brand styling */

/* Staggered card loading animation */
.card[data-load-delay] {
    animation-delay: var(--load-delay, 0s);
}

/* Floating labels effect */
.form-floating .form-control:focus ~ label,
.form-floating .form-control:not(:placeholder-shown) ~ label {
    transform: scale(0.85) translateY(-0.5rem) translateX(0.15rem);
    color: var(--primary-color);
}

/* Success feedback animations */
@keyframes successPulse {
    0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
    70% { transform: scale(1.05); box-shadow: 0 0 0 10px rgba(16, 185, 129, 0); }
    100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

.success-feedback {
    animation: successPulse 0.6s ease-out;
}

/* Tooltip animations */
.tooltip {
    opacity: 0;
    transform: scale(0.8);
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.tooltip.show {
    opacity: 1;
    transform: scale(1);
}

/* Progress bar animations */
.progress-bar {
    transition: width 1s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* Modal entrance animations */
.modal.fade .modal-dialog {
    transform: scale(0.7) translateY(-50px);
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.modal.show .modal-dialog {
    transform: scale(1) translateY(0);
}

/* Button icon animations */
.btn i {
    transition: all 0.3s ease;
}

.btn:hover i {
    transform: translateX(2px);
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .action-card:hover {
        transform: translateY(-4px) scale(1.01);
    }
}
}

.nav-link {
    color: var(--soft-gray) !important;
    font-weight: 500;
    transition: color 0.3s ease;
    display: flex;
    align-items: center;
}

.nav-link:hover {
    color: var(--primary-color) !important;
}

.crisis-btn {
    animation: pulse 2s infinite;
    padding: 0.375rem 0.75rem !important;
    display: flex;
    align-items: center;
}

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

/* Cards */
.card {
    border: none;
    border-radius: 12px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 15px -3px rgba(0, 0, 0, 0.1);
}

.card-header {
    background-color: var(--warm-white);
    border-bottom: 1px solid var(--border-color);
    border-radius: 12px 12px 0 0 !important;
}

/* Welcome Section */
.welcome-section {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    border-radius: 20px;
    margin-bottom: 2rem;
}

/* Daily Affirmation */
.daily-affirmation {
    background: linear-gradient(135deg, #fef3c7, #fed7aa);
    border: none;
}

.daily-affirmation .blockquote {
    font-size: 1.2rem;
    font-style: italic;
    color: var(--dark-color);
}

/* Action Cards */
.action-card {
    height: 100%;
    transition: all 0.3s ease;
}

.action-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 20px -5px rgba(0, 0, 0, 0.15);
}

.action-icon {
    width: 48px;
    height: 48px;
    margin-bottom: 1rem;
    color: var(--primary-color);
}

/* Statistics */
.stat-number {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary-color);
}

.stat-label {
    font-size: 0.9rem;
    color: var(--soft-gray);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Chat Interface */
.chat-container {
    max-height: 85vh;
}

.chat-messages {
    max-height: 550px;
    overflow-y: auto;
    padding: 1rem;
    background-color: #f8fafc;
    border-radius: 8px;
    margin-bottom: 1.5rem;
    position: relative;
    /* Add extra padding at bottom to prevent overlap */
    padding-bottom: 1.5rem;
}

.message {
    margin-bottom: 1rem;
    padding: 0.75rem 1rem;
    border-radius: 12px;
    max-width: 80%;
}

.user-message {
    background-color: var(--primary-color);
    color: white;
    margin-left: auto;
    text-align: right;
}

.ai-message {
    background-color: white;
    border: 1px solid var(--border-color);
    margin-right: auto;
}

.message-content {
    margin-bottom: 0.5rem;
}

.message-time {
    font-size: 0.8rem;
    opacity: 0.7;
}

/* Forms */
.form-control {
    border-radius: 8px;
    border: 1px solid var(--border-color);
    padding: 0.75rem 1rem;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.form-control:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(99, 102, 241, 0.25);
}

.btn {
    border-radius: 8px;
    padding: 0.75rem 1.5rem;
    font-weight: 500;
    transition: all 0.3s ease;
}

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

.btn-primary:hover {
    background-color: #5048e5;
    border-color: #5048e5;
}

/* Crisis Mode */
.crisis-action {
    text-align: center;
    padding: 1rem;
    border-radius: 8px;
    background-color: var(--warm-white);
    margin-bottom: 1rem;
}

.crisis-icon {
    width: 32px;
    height: 32px;
    margin-bottom: 0.5rem;
    color: var(--danger-color);
}

/* Progress Page */
.progress-icon {
    width: 48px;
    height: 48px;
}

.activity-item {
    padding: 1rem 0;
    border-bottom: 1px solid var(--border-color);
}

.activity-item:last-child {
    border-bottom: none;
}

.insight-item {
    margin-bottom: 1.5rem;
}

.milestone {
    display: flex;
    align-items: center;
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    background-color: var(--light-color);
}

.milestone.achieved {
    background-color: #dcfce7;
    border-left: 4px solid var(--success-color);
}

.milestone.pending {
    background-color: #fef3c7;
    border-left: 4px solid var(--warning-color);
}

/* Responsive Design */
@media (max-width: 768px) {
    .main-content {
        padding-top: 100px;
    }
    
    .chat-messages {
        max-height: 450px;
        margin-bottom: 1.5rem;
        padding: 0.75rem;
    }
    
    .message {
        max-width: 90%;
        padding: 0.6rem 0.8rem;
        margin-bottom: 0.8rem;
    }
    
    .stat-number {
        font-size: 1.5rem;
    }
    
    .chat-container {
        max-height: 90vh;
    }
}

/* Loading States */
.spinner-border {
    animation: spin 1s linear infinite;
}

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

/* Alerts */
.alert {
    border-radius: 8px;
    border: none;
}

.alert-dismissible .btn-close {
    background-size: 1rem;
}

/* Utility Classes */
.text-gradient {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.shadow-soft {
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.border-soft {
    border: 1px solid var(--border-color);
}

/* Simplified animations - removed problematic fade-in effects */
.slide-up {
    animation: slideUp 0.3s ease-out;
}

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

/* Focus States */
*:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* Print Styles */
@media print {
    .navbar, .btn, .crisis-btn {
        display: none !important;
    }
    
    .card {
        box-shadow: none !important;
        border: 1px solid #ddd !important;
    }
}
