/**
 * Green Cross Global - Trainer Portal Theme
 * Fresh, modern design inspired by mydigitalassessment.co.uk
 */

/* ========================================
   iOS/Android Safe Area Support
   ======================================== */

/* App mode: Add safe area padding to push content below status bar */
body.app-mode {
    padding-top: env(safe-area-inset-top, 0px);
    padding-left: env(safe-area-inset-left, 0px);
    padding-right: env(safe-area-inset-right, 0px);
}

/* Navbar safe area padding when in app mode - desktop only */
@media (min-width: 992px) {
    body.app-mode .navbar,
    body.app-mode .navbar-main,
    body.app-mode #navbar-main {
        padding-top: calc(0.5rem + env(safe-area-inset-top, 0px));
        margin-top: calc(-1 * env(safe-area-inset-top, 0px));
        padding-left: env(safe-area-inset-left, 0px);
        padding-right: env(safe-area-inset-right, 0px);
    }
}

/* Hide top navbar on mobile in app mode - use floating nav instead */
@media (max-width: 991.98px) {
    body.app-mode .navbar,
    body.app-mode .navbar-main,
    body.app-mode #navbar-main {
        display: none !important;
    }

    /* Adjust page content to start from top when navbar is hidden */
    body.app-mode .page-content {
        padding-top: calc(1rem + env(safe-area-inset-top, 0px));
    }

    body.app-mode .main-content {
        padding-top: 0;
    }
}

/* Standalone/PWA mode support */
@media all and (display-mode: standalone) {
    body {
        padding-top: env(safe-area-inset-top, 0px);
    }

    .navbar,
    .navbar-main,
    #navbar-main {
        padding-top: calc(0.5rem + env(safe-area-inset-top, 0px));
    }
}

/* ========================================
   CSS Variables
   ======================================== */
:root {
    /* Override Purpose theme primary color */
    --primary: #059669 !important;
    --indigo: #059669;

    /* Sage green palette */
    --sage-50: #f6f9f6;
    --sage-100: #e8f4e5;
    --sage-200: #d5e9d9;
    --sage-300: #b8d9be;
    --sage-400: #8fc298;
    --sage-500: #6aab76;
    --sage-600: #059669;
    --sage-700: #047857;
    --sage-800: #065f46;
    --sage-900: #064e3b;

    /* Neutrals */
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;

    /* Accent colors */
    --amber-400: #fbbf24;
    --amber-500: #f59e0b;
    --blue-500: #3b82f6;
    --blue-100: #dbeafe;
    --red-500: #ef4444;
    --red-100: #fee2e2;

    /* Semantic */
    --primary-hover: var(--sage-700);
    --primary-light: var(--sage-100);
    --success: var(--sage-600);
    --warning: var(--amber-500);
    --danger: var(--red-500);
    --info: var(--blue-500);

    /* Typography */
    --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px -1px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);

    /* Border radius */
    --radius-sm: 0.375rem;
    --radius: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
    --radius-full: 9999px;
}

/* ========================================
   Base Styles
   ======================================== */
body {
    font-family: var(--font-family);
    color: var(--gray-800);
    line-height: 1.6;
}

body.application {
    background: linear-gradient(135deg, var(--sage-200) 0%, var(--sage-100) 50%, var(--sage-200) 100%);
    min-height: 100vh;
}

/* ========================================
   Typography
   ======================================== */
h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    color: var(--gray-800);
    line-height: 1.3;
}

.text-muted {
    color: var(--gray-500) !important;
}

/* ========================================
   Navigation
   ======================================== */
.navbar-main {
    background: transparent !important;
    box-shadow: none;
    padding: 0.5rem 0;
    border: none !important;
    margin-bottom: 1rem;
}

/* Fix Purpose theme's navbar width hack - reset to normal 100% width */
.application .navbar,
.application .navbar-main {
    width: 100% !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
}

.application .navbar .container,
.application .navbar .container-fluid,
.application .navbar-main .container-fluid {
    width: 100% !important;
    max-width: 100% !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
    justify-content: center !important;
}

.application .navbar-collapse {
    padding-left: 0 !important;
    padding-right: 0 !important;
    flex-grow: 0 !important;
}

/* Center navbar items */
.navbar-main .navbar-nav {
    justify-content: center !important;
    width: 100%;
}

/* Keep brand on the left, nav items centered */
.navbar-main .container-fluid {
    display: flex !important;
    flex-wrap: wrap !important;
}

.navbar-main .navbar-brand {
    position: absolute;
    left: 0;
}

.navbar-main .navbar-collapse {
    flex-grow: 1 !important;
    justify-content: center !important;
}

.navbar-main .nav-link {
    color: var(--gray-600) !important;
    font-weight: 500;
    font-size: 0.875rem;
    padding: 0.5rem 0.875rem !important;
    border-radius: var(--radius);
    transition: all 0.15s ease;
}

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

.navbar-main .dropdown-menu {
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 0.5rem;
    margin-top: 0.5rem;
}

.navbar-main .dropdown-item {
    border-radius: var(--radius);
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    color: var(--gray-700);
    transition: all 0.15s ease;
}

.navbar-main .dropdown-item:hover {
    background: var(--primary-light);
    color: var(--primary);
}

.navbar-main .dropdown-item i {
    width: 1.25rem;
    color: var(--gray-400);
}

.navbar-main .dropdown-item:hover i {
    color: var(--primary);
}

/* ========================================
   Page Layout
   ======================================== */
.page-content {
    padding: 1.5rem 0;
}

.page-title {
    margin-bottom: 1.5rem;
    background: transparent !important;
    padding: 0 !important;
}

/* Override Purpose theme purple backgrounds */
.bg-primary,
.bg-gradient-primary {
    background: var(--primary) !important;
}

.main-content::before,
.page-content::before {
    display: none !important;
}

/* Remove any purple overlays/backgrounds from the main content area */
.main-content {
    background: transparent !important;
}

.container-application {
    background: transparent !important;
}

/* Override the Purpose theme's purple header area */
.application .main-content:before,
.application-offset .main-content:before,
.main-content:before,
.application-offset .container-application:before,
.container-application:before,
body.application-offset .container-application:before,
body.application.application-offset .container-application:before,
body.application.application-offset .container-fluid.container-application:before {
    display: none !important;
    content: none !important;
    visibility: hidden !important;
    background: transparent !important;
    background-color: transparent !important;
    height: 0 !important;
    width: 0 !important;
    opacity: 0 !important;
    position: absolute !important;
    z-index: -9999 !important;
}

/* Force the container to not have the purple pseudo-element */
.container-application {
    position: relative;
}

.container-application::before {
    all: unset !important;
    display: none !important;
}

/* Ensure main-content fills properly */
.main-content {
    width: 100%;
}

.application-offset .main-content {
    padding-top: 0 !important;
}

.application-offset .page-content {
    padding-top: 1.5rem;
}

/* Kill any remaining purple from Purpose theme */
[class*="bg-gradient-primary"] {
    background: linear-gradient(135deg, var(--sage-600) 0%, var(--sage-700) 100%) !important;
}

/* Override all purple (#6e00ff) instances */
.bg-primary {
    background-color: #059669 !important;
}

.btn-primary {
    background-color: #059669 !important;
    border-color: #059669 !important;
}

.btn-primary:hover {
    background-color: #047857 !important;
    border-color: #047857 !important;
}

.badge-primary {
    background-color: #059669 !important;
}

.avatar span {
    background-color: #059669 !important;
}

/* ========================================
   Dashboard Welcome
   ======================================== */
.dashboard-welcome {
    background: white;
    border-radius: var(--radius-xl);
    padding: 2rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow);
}

.dashboard-welcome h1 {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--gray-800);
    margin-bottom: 0.25rem;
}

.dashboard-welcome p {
    color: var(--gray-500);
    margin: 0;
}

/* ========================================
   Stats Cards
   ======================================== */
.stat-card {
    background: white;
    border-radius: var(--radius-xl);
    padding: 1.5rem;
    box-shadow: var(--shadow);
    height: 100%;
    transition: all 0.2s ease;
    border: 1px solid transparent;
}

.stat-card:hover {
    box-shadow: var(--shadow-lg);
    border-color: var(--sage-200);
}

.stat-card-icon {
    width: 3rem;
    height: 3rem;
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    margin-bottom: 1rem;
}

.stat-card-icon.green {
    background: var(--sage-100);
    color: var(--sage-600);
}

.stat-card-icon.blue {
    background: var(--blue-100);
    color: var(--blue-500);
}

.stat-card-icon.amber {
    background: #fef3c7;
    color: var(--amber-500);
}

.stat-card-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--gray-800);
    line-height: 1;
    margin-bottom: 0.25rem;
}

.stat-card-label {
    font-size: 0.875rem;
    color: var(--gray-500);
    font-weight: 500;
}

.stat-card-meta {
    font-size: 0.75rem;
    color: var(--gray-400);
    margin-top: 0.5rem;
}

.stat-card-explainer {
    font-size: 0.7rem;
    color: var(--gray-400);
    margin-top: 0.5rem;
    font-style: italic;
    line-height: 1.4;
}

/* ========================================
   Performance Card
   ======================================== */
.performance-card {
    background: white;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.performance-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--gray-100);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.performance-header h3 {
    font-size: 1rem;
    font-weight: 600;
    margin: 0;
    color: var(--gray-800);
}

.performance-body {
    padding: 1.5rem;
}

.rating-display {
    text-align: center;
    padding: 1rem 0;
}

.rating-circle {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background: conic-gradient(var(--sage-500) calc(var(--rating) * 1%), var(--gray-100) 0);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1rem;
    position: relative;
}

.rating-circle::before {
    content: '';
    position: absolute;
    width: 80px;
    height: 80px;
    background: white;
    border-radius: 50%;
}

.rating-circle-value {
    position: relative;
    z-index: 1;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--gray-800);
}

.rating-label {
    font-size: 0.875rem;
    color: var(--gray-500);
    font-weight: 500;
}

.rating-meta {
    font-size: 0.75rem;
    color: var(--gray-400);
    margin-top: 0.25rem;
}

.confidence-display {
    text-align: center;
    padding: 1rem 0;
}

.confidence-value {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--sage-600);
    line-height: 1;
}

.confidence-value.positive {
    color: var(--sage-600);
}

.confidence-value.negative {
    color: var(--red-500);
}

.confidence-arrow {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 0.5rem;
    font-size: 0.875rem;
    color: var(--gray-500);
}

.confidence-arrow i {
    color: var(--sage-500);
}

/* Stats row in performance card */
.stats-row {
    display: flex;
    border-top: 1px solid var(--gray-100);
    margin: 0 -1.5rem -1.5rem;
}

.stats-row-item {
    flex: 1;
    text-align: center;
    padding: 1.25rem 1rem;
    border-right: 1px solid var(--gray-100);
}

.stats-row-item:last-child {
    border-right: none;
}

.stats-row-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--sage-600);
    line-height: 1;
}

.stats-row-label {
    font-size: 0.75rem;
    color: var(--gray-500);
    margin-top: 0.25rem;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

/* ========================================
   Feedback Card
   ======================================== */
.feedback-card {
    background: white;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.feedback-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--gray-100);
}

.feedback-header h3 {
    font-size: 1rem;
    font-weight: 600;
    margin: 0;
    color: var(--gray-800);
}

.feedback-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.feedback-item {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--gray-50);
    transition: background 0.15s ease;
}

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

.feedback-item:hover {
    background: var(--gray-50);
}

.feedback-avatar {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 50%;
    background: var(--sage-100);
    color: var(--sage-700);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.875rem;
    font-weight: 600;
    flex-shrink: 0;
}

.feedback-content {
    flex: 1;
    min-width: 0;
}

.feedback-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.25rem;
}

.feedback-name {
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--gray-800);
}

.feedback-time {
    font-size: 0.75rem;
    color: var(--gray-400);
}

.feedback-text {
    font-size: 0.875rem;
    color: var(--gray-600);
    line-height: 1.5;
    margin: 0;
}

.feedback-footer {
    padding: 1rem 1.5rem;
    background: var(--gray-50);
    text-align: center;
}

.feedback-footer a {
    color: var(--sage-600);
    font-weight: 600;
    font-size: 0.875rem;
    text-decoration: none;
}

.feedback-footer a:hover {
    color: var(--sage-700);
    text-decoration: underline;
}

/* ========================================
   Messages Card
   ======================================== */
.messages-card {
    background: white;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.messages-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--gray-100);
}

.messages-header h3 {
    font-size: 1rem;
    font-weight: 600;
    margin: 0;
    color: var(--gray-800);
}

.message-item {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--gray-50);
    display: flex;
    gap: 0.75rem;
    transition: background 0.15s ease;
}

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

.message-item:hover {
    background: var(--gray-50);
}

.message-icon {
    width: 2rem;
    height: 2rem;
    border-radius: var(--radius);
    background: var(--blue-100);
    color: var(--blue-500);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    flex-shrink: 0;
}

.message-content {
    flex: 1;
    min-width: 0;
}

.message-text {
    font-size: 0.875rem;
    color: var(--gray-700);
    line-height: 1.5;
    margin: 0 0 0.25rem;
}

.message-time {
    font-size: 0.75rem;
    color: var(--gray-400);
}

/* ========================================
   Badges
   ======================================== */
.badge-primary {
    background: var(--sage-100);
    color: var(--sage-700);
    font-weight: 600;
    padding: 0.25rem 0.75rem;
    border-radius: var(--radius-full);
    font-size: 0.75rem;
}

.badge-success {
    background: var(--sage-100);
    color: var(--sage-700);
}

.badge-warning {
    background: #fef3c7;
    color: #b45309;
}

.badge-info {
    background: var(--blue-100);
    color: var(--blue-500);
}

.percentile-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0.625rem;
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 600;
}

.percentile-badge.top-tier {
    background: var(--sage-100);
    color: var(--sage-700);
}

.percentile-badge.mid-tier {
    background: var(--blue-100);
    color: var(--blue-500);
}

/* ========================================
   Buttons
   ======================================== */
.btn {
    font-weight: 500;
    border-radius: var(--radius-full);
    padding: 0.625rem 1.25rem;
    font-size: 0.875rem;
    transition: all 0.15s ease;
    border: none;
}

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

.btn-primary:hover {
    background: var(--primary-hover);
    color: white;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(5, 150, 105, 0.3);
}

.btn-lg {
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
}

/* ========================================
   Cards (Generic)
   ======================================== */
.card {
    background: white;
    border: none;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow);
}

.card-header {
    background: transparent;
    border-bottom: 1px solid var(--gray-100);
    padding: 1.25rem 1.5rem;
}

.card-header h6 {
    font-size: 1rem;
    font-weight: 600;
    margin: 0;
    color: var(--gray-800);
}

.card-body {
    padding: 1.5rem;
}

.card-footer {
    background: var(--gray-50);
    border-top: 1px solid var(--gray-100);
    padding: 1rem 1.5rem;
}

/* ========================================
   Forms
   ======================================== */
.form-control {
    border: 1px solid var(--gray-300);
    border-radius: var(--radius);
    padding: 0.625rem 0.875rem;
    font-size: 0.9375rem;
    transition: all 0.15s ease;
}

.form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(5, 150, 105, 0.1);
    outline: none;
}

.form-control-label {
    font-weight: 500;
    font-size: 0.875rem;
    color: var(--gray-700);
    margin-bottom: 0.5rem;
}

.input-group-text {
    background: var(--gray-50);
    border: 1px solid var(--gray-300);
    color: var(--gray-500);
}

/* ========================================
   Alerts
   ======================================== */
.alert {
    border: none;
    border-radius: var(--radius-lg);
    padding: 1rem 1.25rem;
}

.alert-info {
    background: var(--blue-100);
    color: #1e40af;
}

.alert-success {
    background: var(--sage-100);
    color: var(--sage-800);
}

.alert-warning {
    background: #fef3c7;
    color: #b45309;
}

/* ========================================
   Login Page
   ======================================== */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

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

.login-card .card-header {
    text-align: center;
    padding: 2rem;
    background: white;
    border-bottom: 1px solid var(--gray-100);
}

.login-card .card-body {
    padding: 2rem;
}

/* ========================================
   Empty States
   ======================================== */
.empty-state {
    text-align: center;
    padding: 2rem;
    color: var(--gray-400);
}

.empty-state i {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.empty-state p {
    margin: 0;
    font-size: 0.875rem;
}

/* ========================================
   Responsive
   ======================================== */
@media (max-width: 991.98px) {
    .navbar-main .navbar-collapse {
        background: rgba(255, 255, 255, 0.95);
        backdrop-filter: blur(10px);
        padding: 1rem;
        border-radius: var(--radius-lg);
        margin-top: 0.75rem;
        box-shadow: var(--shadow-lg);
        border: 1px solid var(--gray-200);
    }

    .navbar-main .nav-link {
        padding: 0.75rem 1rem 0.75rem 1.5rem !important;
    }

    .navbar-main .navbar-nav .nav-item .nav-link {
        padding-left: 1.5rem !important;
    }

    /* Mobile navbar - logo left, toggle right */
    #navbar-main {
        position: sticky;
        top: 0;
        z-index: 1030;
        background: white;
    }

    #navbar-main .navbar-toggler {
        display: flex !important;
        margin-left: auto;
    }

    #navbar-main .container-fluid {
        flex-wrap: nowrap;
    }

    .navbar-main .navbar-brand {
        position: relative !important;
        left: auto !important;
        margin-left: 0.5rem !important;
    }
}

@media (max-width: 767.98px) {
    .page-content {
        padding: 1rem 0;
    }

    .dashboard-welcome {
        padding: 1.5rem;
    }

    .dashboard-welcome h1 {
        font-size: 1.5rem;
    }

    .stat-card {
        padding: 1.25rem;
    }

    .stat-card-value {
        font-size: 1.75rem;
    }

    .stats-row {
        flex-wrap: wrap;
    }

    .stats-row-item {
        flex: 0 0 33.333%;
    }
}

/* ========================================
   Modals
   ======================================== */
.modal-content {
    border: none !important;
    border-radius: var(--radius-xl) !important;
    box-shadow: var(--shadow-lg) !important;
    overflow: hidden;
}

.modal-header {
    background: var(--gray-100) !important;
    border-bottom: 1px solid var(--gray-200) !important;
    padding: 1.25rem 1.5rem !important;
}

.modal-header .modal-title {
    font-weight: 600 !important;
    font-size: 1.125rem !important;
    color: var(--gray-800) !important;
}

.modal-header .close {
    color: var(--gray-500) !important;
    opacity: 1 !important;
    font-size: 1.5rem !important;
    font-weight: 400 !important;
}

.modal-header .close:hover {
    color: var(--gray-700) !important;
}

.modal-body {
    padding: 1.5rem !important;
    color: var(--gray-700) !important;
    line-height: 1.6 !important;
}

.modal-footer {
    background: var(--gray-50) !important;
    border-top: 1px solid var(--gray-200) !important;
    padding: 1rem 1.5rem !important;
}

.modal-footer .btn-secondary {
    background: var(--gray-200) !important;
    border: none !important;
    color: var(--gray-700) !important;
    border-radius: var(--radius-full) !important;
    padding: 0.5rem 1.25rem !important;
}

.modal-footer .btn-secondary:hover {
    background: var(--gray-300) !important;
}

/* Primary/Success/Info modal overrides */
.modal-primary .modal-content,
.modal-success .modal-content,
.modal-info .modal-content {
    background: var(--gray-100) !important;
}

.modal-primary .modal-body,
.modal-success .modal-body,
.modal-info .modal-body {
    background: var(--gray-100) !important;
    padding: 2rem !important;
}

.modal-primary .modal-body i.fas,
.modal-primary .modal-body i.far,
.modal-success .modal-body i.fas,
.modal-success .modal-body i.far,
.modal-info .modal-body i.fas,
.modal-info .modal-body i.far {
    color: var(--sage-600) !important;
    background: white;
    width: 5rem;
    height: 5rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem !important;
    margin: 0 auto;
    box-shadow: var(--shadow);
}

.modal-primary .modal-body .heading,
.modal-success .modal-body .heading,
.modal-info .modal-body .heading,
.modal-primary .modal-body h5,
.modal-success .modal-body h5,
.modal-info .modal-body h5,
.modal-primary .modal-body h2,
.modal-success .modal-body h2,
.modal-info .modal-body h2 {
    color: var(--gray-800) !important;
    font-weight: 600 !important;
}

.modal-primary .modal-body p,
.modal-success .modal-body p,
.modal-info .modal-body p {
    color: var(--gray-600) !important;
}

/* Modal buttons */
.modal .btn-success,
.modal .btn-primary {
    background: var(--sage-600) !important;
    border: none !important;
    border-radius: var(--radius-full) !important;
    padding: 0.625rem 1.5rem !important;
    font-weight: 500 !important;
}

.modal .btn-success:hover,
.modal .btn-primary:hover {
    background: var(--sage-700) !important;
}

.modal .btn-danger {
    background: var(--red-500) !important;
    border: none !important;
    border-radius: var(--radius-full) !important;
    padding: 0.625rem 1.5rem !important;
    font-weight: 500 !important;
}

.modal .btn-danger:hover {
    background: #dc2626 !important;
}

.modal .btn-white {
    background: white !important;
    border: 1px solid var(--gray-300) !important;
    border-radius: var(--radius) !important;
    color: var(--gray-700) !important;
    padding: 0.625rem 1.25rem !important;
    font-weight: 500 !important;
    min-width: 120px;
}

.modal .btn-white:hover {
    background: var(--gray-50) !important;
    border-color: var(--gray-400) !important;
}

/* Survey modal table fix */
.modal table {
    border-collapse: separate;
    border-spacing: 0.5rem;
}

/* ========================================
   Community Section
   ======================================== */

/* Community post cards */
.community-post-card {
    background: white;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow);
    margin-bottom: 1rem;
    transition: all 0.2s ease;
}

.community-post-card:hover {
    box-shadow: var(--shadow-lg);
}

/* Community vote buttons */
.community-vote-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0.5rem;
    border-radius: var(--radius);
    color: var(--gray-400);
    background: var(--gray-100);
    border: none;
    cursor: pointer;
    transition: all 0.15s ease;
}

.community-vote-btn:hover,
.community-vote-btn.voted {
    color: var(--sage-600);
    background: var(--sage-100);
}

/* Community category badges */
.community-category-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0.625rem;
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 600;
    color: white;
}

/* Community comment styling */
.community-comment {
    padding: 1rem;
    border-bottom: 1px solid var(--gray-100);
}

.community-comment:last-child {
    border-bottom: none;
}

/* Community empty state */
.community-empty-state {
    text-align: center;
    padding: 3rem 1.5rem;
    background: white;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow);
}

.community-empty-state .icon {
    width: 80px;
    height: 80px;
    background: var(--gray-100);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.5rem;
}

.community-empty-state .icon i {
    font-size: 2rem;
    color: var(--gray-400);
}

/* ===================================
   Floating Navigation Menu (for iOS app)
   =================================== */

.floating-nav {
    position: fixed;
    bottom: 20px;
    left: 20px;
    z-index: 99998;
    font-family: 'Nunito', sans-serif;
}

/* Floating Menu Button */
.floating-nav-btn {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #045026 0%, #49ac33 100%);
    box-shadow: 0 4px 15px rgba(73, 172, 51, 0.4);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    border: none;
    outline: none;
    color: white;
    font-size: 1.25rem;
}

.floating-nav-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(73, 172, 51, 0.5);
}

.floating-nav-btn:focus {
    outline: none;
}

.floating-nav-btn .menu-icon {
    transition: transform 0.3s ease, opacity 0.2s ease;
}

.floating-nav-btn .close-icon {
    position: absolute;
    opacity: 0;
    transform: rotate(-90deg);
    transition: transform 0.3s ease, opacity 0.2s ease;
}

.floating-nav.open .floating-nav-btn .menu-icon {
    opacity: 0;
    transform: rotate(90deg);
}

.floating-nav.open .floating-nav-btn .close-icon {
    opacity: 1;
    transform: rotate(0deg);
}

/* Floating Menu Panel */
.floating-nav-panel {
    position: absolute;
    bottom: 65px;
    left: 0;
    width: 260px;
    max-height: 70vh;
    background: white;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    display: none;
    flex-direction: column;
    overflow: hidden;
    animation: floatingNavSlideUp 0.3s ease;
}

.floating-nav.open .floating-nav-panel {
    display: flex;
}

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

/* Panel Header */
.floating-nav-header {
    padding: 1rem 1.25rem;
    background: linear-gradient(135deg, #045026 0%, #49ac33 100%);
    color: white;
}

.floating-nav-header .user-name {
    font-weight: 600;
    font-size: 1rem;
    margin: 0;
}

.floating-nav-header .user-email {
    font-size: 0.75rem;
    opacity: 0.85;
    margin: 0;
}

/* Panel Body with scrollable nav items */
.floating-nav-body {
    flex: 1;
    overflow-y: auto;
    padding: 0.5rem 0;
}

/* Navigation Links */
.floating-nav-link {
    display: flex;
    align-items: center;
    padding: 0.75rem 1.25rem;
    color: var(--gray-700);
    text-decoration: none;
    transition: all 0.2s ease;
    font-size: 0.9375rem;
}

.floating-nav-link:hover {
    background: var(--gray-50);
    color: var(--primary);
    text-decoration: none;
}

.floating-nav-link i {
    width: 24px;
    margin-right: 0.75rem;
    font-size: 1rem;
    color: var(--gray-500);
    transition: color 0.2s ease;
}

.floating-nav-link:hover i {
    color: var(--primary);
}

.floating-nav-link .badge {
    margin-left: auto;
    font-size: 0.65rem;
    padding: 0.2rem 0.4rem;
}

/* Divider */
.floating-nav-divider {
    height: 1px;
    background: var(--gray-200);
    margin: 0.5rem 1rem;
}

/* Logout link special styling */
.floating-nav-link.logout {
    color: #dc2626;
}

.floating-nav-link.logout i {
    color: #dc2626;
}

.floating-nav-link.logout:hover {
    background: #fef2f2;
}

/* Mobile responsive */
@media (max-width: 480px) {
    .floating-nav-panel {
        width: calc(100vw - 40px);
        max-width: 300px;
    }
}

/* Hide floating nav on desktop - only show on mobile/app */
@media (min-width: 992px) {
    .floating-nav {
        display: none;
    }
}

/* App Mode - when running in Capacitor native app */
.app-mode .navbar-main {
    display: none !important;
}

.app-mode .floating-nav {
    display: block !important;
}

.app-mode .main-content {
    padding-top: 0 !important;
}

.app-mode .page-content {
    padding-top: env(safe-area-inset-top, 20px);
}

/* iOS Safe Area support */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
    .floating-nav {
        bottom: calc(20px + env(safe-area-inset-bottom));
        left: calc(20px + env(safe-area-inset-left));
    }

    /* Ensure chat widget also respects safe area */
    .chat-widget {
        bottom: calc(20px + env(safe-area-inset-bottom));
        right: calc(20px + env(safe-area-inset-right));
    }
}

/* Extra padding for app mode to account for status bar */
.app-mode .floating-nav-panel {
    max-height: calc(70vh - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px));
}
