/* Hey Owner Custom Styles - Mobile First */

:root {
    --ho-primary: #0066cc;
    --ho-secondary: #6c757d;
    --ho-success: #28a745;
    --ho-danger: #dc3545;
    --ho-warning: #ffc107;
    --ho-info: #17a2b8;
    --ho-dark: #343a40;
    --ho-light: #f8f9fa;
}

/* Force remove all gaps at top */
html,
body {
    margin: 0 !important;
    padding: 0 !important;
}

body,
body.ho-page {
    padding-top: 0 !important;
    margin-top: 0 !important;
}

/* Remove top spacing from wrapper */
.ho-wrapper {
    margin-top: 0 !important;
    padding-top: 0 !important;
}

/* Override WordPress admin styles */
#wpcontent {
    padding-left: 0 !important;
    padding-top: 0 !important;
    margin-top: 0 !important;
}

.ho-wrapper {
    background: #f8f9fa;
    min-height: 100vh;
    margin: 0;
    padding: 0;
}

/* Hide WordPress admin menu on HO pages */
.ho-page #adminmenumain {
    display: none;
}

.ho-page #wpadminbar {
    display: none;
}

.ho-page #wpcontent {
    margin-left: 0 !important;
}

.ho-page #wpfooter {
    display: none;
}

/* Touch-friendly buttons */
.btn-touch {
    min-height: 44px;
    min-width: 44px;
    padding: 0.75rem 1.25rem;
}

/* Bottom navigation for mobile */
.ho-bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: #fff;
    border-top: 1px solid #dee2e6;
    z-index: 1030;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
}

.ho-bottom-nav .nav-link {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0.5rem;
    color: #6c757d;
    font-size: 0.75rem;
    text-decoration: none;
    position: relative;
    border-radius: 0.5rem;
    transition: all 0.2s ease;
}

.ho-bottom-nav .nav-link i {
    font-size: 1.25rem;
    margin-bottom: 0.25rem;
}

.ho-bottom-nav .nav-link.active {
    background: rgba(0, 102, 204, 0.2);
    color: var(--ho-primary);
}

.ho-bottom-nav .nav-link .badge {
    position: absolute;
    top: 0.25rem;
    right: 0.5rem;
    font-size: 0.65rem;
    padding: 0.2em 0.4em;
}

/* Content with bottom nav spacing */
.content-with-bottom-nav {
    padding-bottom: 70px;
}

/* Desktop sidebar */
.ho-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 250px;
    background: #fff;
    border-right: 1px solid #dee2e6;
    overflow-y: auto;
    z-index: 1000;
}

.ho-sidebar .sidebar-header {
    padding: 1.5rem;
    border-bottom: 1px solid #dee2e6;
}

.ho-sidebar .sidebar-menu {
    padding: 1rem 0;
}

.ho-sidebar .menu-item {
    display: flex;
    align-items: center;
    padding: 0.5rem 1.5rem;
    color: #495057;
    text-decoration: none;
    transition: all 0.2s;
}

.ho-sidebar .menu-item:hover {
    background: #f8f9fa;
    color: var(--ho-primary);
}

.ho-sidebar .menu-item.active {
    background: #e7f3ff;
    color: var(--ho-primary);
    border-left: 3px solid var(--ho-primary);
}

.ho-sidebar .menu-item i {
    margin-right: 0.75rem;
    font-size: 1.1rem;
}

/* Main content area */
.ho-main-content {
    padding: 0rem 1rem 5rem;
    margin-top: 0 !important;
}

@media (min-width: 768px) {
    .ho-main-content {
        margin-left: 250px;
        margin-top: 0 !important;
        padding: 2rem;
    }
}

/* Top bar */
.ho-top-bar {
    background: #fff;
    border-bottom: 1px solid #dee2e6;
    padding: 1rem;
    margin: 0 -1rem 1rem -1rem;
}

@media (min-width: 768px) {
    .ho-top-bar {
        margin: 0 -2rem 2rem -2rem;
        padding: 1.5rem 2rem;
    }
}

.ho-top-bar .user-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.ho-top-bar .user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--ho-primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
}

/* Mobile Header Avatar */
.mobile-header-avatar {
    width: 40px;
    height: 40px;
    object-fit: cover;
    font-size: 14px;
    font-weight: bold;
    flex-shrink: 0;
}

.mobile-header-avatar img {
    width: 40px;
    height: 40px;
    object-fit: cover;
}

/* Cards */
.ho-card {
    background: #fff;
    border-radius: 0.5rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    margin-bottom: 1rem;
    transition: transform 0.2s;
}

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

.ho-card .card-header {
    background: transparent;
    border-bottom: 1px solid #dee2e6;
    padding: 1rem;
    font-weight: 600;
}

.ho-card .card-body {
    padding: 1rem;
}

/* Stat cards */
.stat-card {
    text-align: center;
    padding: 1.5rem 1rem;
}

.stat-card .stat-icon {
    font-size: 2rem;
    color: var(--ho-primary);
    margin-bottom: 0.5rem;
}

.stat-card .stat-value {
    font-size: 2rem;
    font-weight: bold;
    margin-bottom: 0.25rem;
}

.stat-card .stat-label {
    color: #6c757d;
    font-size: 0.875rem;
}

/* Tables - Mobile optimized */
.table-responsive {
    border-radius: 0.5rem;
    overflow: hidden;
}

.ho-table {
    background: #fff;
    margin-bottom: 0;
}

.ho-table th {
    background: #f8f9fa;
    font-weight: 600;
    border-bottom: 2px solid #dee2e6;
}

/* Stack table on mobile */
@media (max-width: 767px) {
    .table-mobile-stack thead {
        display: none;
    }

    .table-mobile-stack tbody tr {
        display: block;
        border: 1px solid #dee2e6;
        margin-bottom: 1rem;
        border-radius: 0.5rem;
        overflow: hidden;
    }

    .table-mobile-stack tbody td {
        display: flex;
        justify-content: space-between;
        padding: 0.75rem;
        border: none;
        border-bottom: 1px solid #f8f9fa;
    }

    .table-mobile-stack tbody td:last-child {
        border-bottom: none;
    }

    .table-mobile-stack tbody td:before {
        content: attr(data-label);
        font-weight: bold;
        margin-right: 1rem;
        color: #6c757d;
    }
}

/* Forms - Mobile optimized */
.ho-form .form-label {
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.ho-form .form-control,
.ho-form .form-select {
    min-height: 44px;
    border-radius: 0.5rem;
}

.ho-form .form-control:focus,
.ho-form .form-select:focus {
    border-color: var(--ho-primary);
    box-shadow: 0 0 0 0.25rem rgba(0, 102, 204, 0.25);
}

/* Modals - Bottom sheet style on mobile (like mobile apps) */
@media (max-width: 767px) {
    /* Override Bootstrap modal-dialog-centered to bottom position */
    .modal-dialog-centered,
    .modal-dialog-centered::before {
        display: block;
        min-height: 0;
    }

    /* All modals to bottom sheet */
    .modal .modal-dialog {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        margin: 0;
        max-width: 100%;
        min-height: auto;
        height: auto;
    }

    /* Slide animation */
    .modal.show .modal-dialog {
        animation: slideUp 0.3s ease-out;
    }

    .modal:not(.show) .modal-dialog {
        transform: translateY(100%);
    }

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

    .modal .modal-content {
        border: 0;
        border-radius: 20px 20px 0 0;
        max-height: 90vh;
        overflow: hidden;
        box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.2);
    }

    /* Modal header - Add drag handle */
    .modal .modal-header {
        position: relative;
        border-bottom: 1px solid #e9ecef;
        padding: 1rem 1rem 0.75rem;
    }

    .modal .modal-header::before {
        content: '';
        position: absolute;
        top: 8px;
        left: 50%;
        transform: translateX(-50%);
        width: 40px;
        height: 4px;
        background: #dee2e6;
        border-radius: 2px;
    }

    .modal .modal-title {
        margin-top: 12px;
        font-size: 14px !important;
        font-weight: 600;
    }

    .modal .btn-close {
        position: absolute;
        top: 16px;
        right: 1rem;
        margin: 0;
    }

    /* Modal body */
    .modal .modal-body {
        max-height: calc(90vh - 140px);
        overflow-y: auto;
        overflow-x: hidden;
        -webkit-overflow-scrolling: touch;
        padding: 1rem;
    }

    /* Modal footer */
    .modal .modal-footer {
        border-top: 1px solid #e9ecef;
        padding: 0.75rem 1rem;
        gap: 0.5rem;
    }

    .modal .modal-footer .btn {
        flex: 1;
        min-height: 44px;
    }

    /* Backdrop - darker for better mobile UX */
    .modal-backdrop.show {
        opacity: 0.6;
    }

    /* Smooth scrollbar for modal body */
    .modal .modal-body::-webkit-scrollbar {
        width: 4px;
    }

    .modal .modal-body::-webkit-scrollbar-track {
        background: transparent;
    }

    .modal .modal-body::-webkit-scrollbar-thumb {
        background: #dee2e6;
        border-radius: 2px;
    }

    .modal .modal-body::-webkit-scrollbar-thumb:hover {
        background: #adb5bd;
    }
}

/* Slide up animation for modal */
@keyframes slideUp {
    from {
        transform: translateY(100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Desktop modal - keep centered */
@media (min-width: 768px) {
    .modal .modal-dialog {
        position: relative;
        margin: 1.75rem auto;
    }
}

/* Swipe cards */
.swipe-card {
    transition: transform 0.2s;
    cursor: pointer;
}

.swipe-card:active {
    transform: scale(0.98);
}

/* Floating action button - Mobile App Style */
.ho-fab {
    position: fixed;
    bottom: 80px;
    right: 1rem;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--ho-primary) 0%, #004d99 100%);
    color: #fff;
    border: none;
    box-shadow: 0 6px 16px rgba(0, 102, 204, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    z-index: 1020;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
}

.ho-fab:hover {
    transform: scale(1.1);
    box-shadow: 0 8px 20px rgba(0, 102, 204, 0.5);
}

.ho-fab:active {
    transform: scale(0.95);
}

/* FAB ripple effect on click */
.ho-fab::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%) scale(0);
    transition: transform 0.5s;
}

.ho-fab:active::before {
    transform: translate(-50%, -50%) scale(2);
    opacity: 0;
}

@media (min-width: 768px) {
    .ho-fab {
        bottom: 2rem;
        right: 2rem;
        width: 64px;
        height: 64px;
        font-size: 1.75rem;
    }
}

/* Loading overlay - DISABLED */
/*
.ho-loading {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.ho-loading .spinner-border {
    width: 3rem;
    height: 3rem;
}
*/

/* Toast notifications */
.ho-toast-container {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 9999;
}

/* Login page */
.ho-login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--ho-primary);
    padding: 1rem;
}

.ho-login-card {
    background: #fff;
    border-radius: 1rem;
    padding: 2rem;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
}

.ho-login-card .logo {
    text-align: center;
    margin-bottom: 2rem;
}

.ho-login-card .logo h1 {
    color: var(--ho-primary);
    font-weight: bold;
    margin-bottom: 0.5rem;
}

.ho-login-card .logo p {
    color: #6c757d;
    font-size: 0.875rem;
}

.otp-input {
    font-size: 1.5rem;
    text-align: center;
    letter-spacing: 0.5rem;
    font-weight: bold;
}

/* Calendar view */
.ho-calendar {
    background: #fff;
    border-radius: 0.5rem;
    padding: 1rem;
}

.calendar-day {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #dee2e6;
    border-radius: 0.25rem;
    cursor: pointer;
    transition: all 0.2s;
}

.calendar-day:hover {
    background: #f8f9fa;
}

.calendar-day.today {
    background: var(--ho-primary);
    color: #fff;
    font-weight: bold;
}

.calendar-day.has-event {
    background: #e7f3ff;
}

/* Past date styling */
.calendar-day.past-date {
    background: #f8f9fa;
    color: #adb5bd;
}

.calendar-day.past-date.has-events {
    background: #e9ecef;
    color: #6c757d;
}

.calendar-day.past-date:hover {
    background: #e9ecef;
}

/* Week view past date */
.week-day.past-date {
    background: #f8f9fa;
    color: #adb5bd;
}

.week-day.past-date.has-events {
    background: #e9ecef;
    color: #6c757d;
}

/* Badge variations */
.badge {
    padding: 0.35em 0.65em;
    font-weight: 500;
}

/* Utility classes */
.text-muted {
    color: #6c757d !important;
}

.cursor-pointer {
    cursor: pointer;
}

/* Responsive utilities */
@media (max-width: 767px) {
    .mobile-hide {
        display: none !important;
    }
}

@media (min-width: 768px) {
    .desktop-hide {
        display: none !important;
    }
}

/* Animation */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeIn 0.3s ease-in;
}

/* Avatar styles */
.user-avatar-img {
    width: 40px;
    height: 40px;
    object-fit: cover;
}

/* Desktop Sidebar User Profile Card */
.sidebar-footer {
    position: absolute;
    bottom: 0;
    width: 100%;
    background: #fff;
    border-top: 1px solid #dee2e6;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.05);
}

.user-profile-card {
    padding: 1rem;
}

.user-profile-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #f0f0f0;
}

.user-profile-avatar {
    width: 50px;
    height: 50px;
    object-fit: cover;
    border: 2px solid #e9ecef;
}

.user-profile-avatar-placeholder {
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, var(--ho-primary), var(--ho-info));
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 1.25rem;
    border: 2px solid #e9ecef;
}

.user-profile-info {
    flex: 1;
    min-width: 0;
}

.user-profile-name {
    font-weight: 600;
    font-size: 0.9rem;
    color: #212529;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 0.25rem;
}

.user-profile-unit {
    font-size: 0.75rem;
    color: #6c757d;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 0.25rem;
}

.user-profile-unit i {
    font-size: 0.7rem;
    margin-right: 0.25rem;
}

.user-profile-actions {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

/* Mobile User Profile Card */
.mobile-user-profile-card {
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 0.5rem;
    margin-bottom: 1rem;
}

.mobile-user-avatar {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border: 3px solid #fff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.mobile-user-avatar-placeholder {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, var(--ho-primary), var(--ho-info));
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 2rem;
    border: 3px solid #fff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.mobile-user-name {
    font-weight: 600;
    font-size: 1.1rem;
    color: #212529;
    margin-top: 0.5rem;
}

.mobile-user-unit {
    font-size: 0.875rem;
}

.mobile-user-unit i {
    margin-right: 0.25rem;
}

/* Profile Page Avatar */
.profile-avatar-wrapper {
    position: relative;
    display: inline-block;
}

.profile-avatar,
.profile-avatar-placeholder {
    width: 150px;
    height: 150px;
    border: 4px solid #f8f9fa;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.profile-avatar {
    object-fit: cover;
}

.profile-avatar-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    font-weight: bold;
    background: linear-gradient(135deg, var(--ho-primary), var(--ho-info));
    color: white;
}

/* Mobile Typography - Prevent Text Stacking */
@media (max-width: 767px) {
    /* Headings */
    h1, .h1 {
        font-size: 14px !important;
        line-height: 1.3;
        margin-bottom: 0.5rem;
    }

    h2, .h2 {
        font-size: 13px !important;
        line-height: 1.3;
        margin-bottom: 0.5rem;
    }

    h3, .h3 {
        font-size: 12px !important;
        line-height: 1.3;
        margin-bottom: 0.4rem;
    }

    h4, .h4 {
        font-size: 11px !important;
        line-height: 1.3;
        margin-bottom: 0.4rem;
    }

    h5, .h5 {
        font-size: 10px !important;
        line-height: 1.3;
        margin-bottom: 0.3rem;
    }

    h6, .h6 {
        font-size: 9px !important;
        line-height: 1.3;
        margin-bottom: 0.3rem;
    }

    /* Body text */
    body, p, .form-label, .form-control, .form-select {
        font-size: 12px !important;
    }

    /* Small text */
    small, .small, .text-muted {
        font-size: 10px !important;
    }

    /* Top bar */
    .ho-top-bar h5 {
        font-size: 14px !important;
    }

    .ho-top-bar small {
        font-size: 10px !important;
    }

    /* Card headers */
    .ho-card .card-header {
        font-size: 12px !important;
        padding: 0.75rem;
    }

    .ho-card .card-body {
        padding: 0.75rem;
        font-size: 11px !important;
    }

    /* Buttons */
    .btn {
        font-size: 11px !important;
        padding: 0.5rem 0.75rem;
    }

    .btn-sm {
        font-size: 10px !important;
        padding: 0.35rem 0.6rem;
    }

    /* Form inputs */
    .form-control, .form-select {
        font-size: 12px !important;
        padding: 0.5rem 0.75rem;
        min-height: 38px;
    }

    .form-label {
        font-size: 11px !important;
        margin-bottom: 0.3rem;
    }

    /* Tables */
    .table {
        font-size: 11px !important;
    }

    .table th {
        font-size: 11px !important;
        padding: 0.5rem 0.4rem;
    }

    .table td {
        font-size: 10px !important;
        padding: 0.5rem 0.4rem;
    }

    /* Badges */
    .badge {
        font-size: 9px !important;
        padding: 0.25em 0.5em;
    }

    /* Modal */
    .modal-title {
        font-size: 13px !important;
    }

    .modal-body {
        font-size: 11px !important;
    }

    /* Stat cards */
    .stat-card .stat-value {
        font-size: 1.5rem !important;
    }

    .stat-card .stat-label {
        font-size: 10px !important;
    }

    /* List group */
    .list-group-item {
        font-size: 11px !important;
        padding: 0.75rem 1rem;
    }

    /* Icons adjust for smaller text */
    .bi {
        vertical-align: middle;
    }

    /* Offcanvas menu */
    .offcanvas-title {
        font-size: 14px !important;
    }

    .mobile-user-name {
        font-size: 13px !important;
    }

    .mobile-user-unit {
        font-size: 10px !important;
    }

    /* Team card mobile */
    .team-info h6 {
        font-size: 12px !important;
    }

    .team-info small {
        font-size: 10px !important;
    }

    /* Reduce padding/margins */
    .mb-3 {
        margin-bottom: 0.75rem !important;
    }

    .mb-2 {
        margin-bottom: 0.5rem !important;
    }

    .py-4 {
        padding-top: 1rem !important;
        padding-bottom: 1rem !important;
    }

    /* Grid spacing */
    .g-3 {
        --bs-gutter-x: 0.75rem;
        --bs-gutter-y: 0.75rem;
    }
}

/* Modal Loader Overlay */
.modal-loader-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.95);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    border-radius: 0.5rem;
}

.modal-loader-overlay.active {
    display: flex;
}

.modal-loader-content {
    text-align: center;
}

.modal-loader-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid var(--ho-primary, #0066cc);
    border-radius: 50%;
    animation: modal-spin 1s linear infinite;
    margin: 0 auto 15px;
}

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

.modal-loader-text {
    color: #333;
    font-size: 14px;
    font-weight: 500;
    margin-top: 10px;
}

/* Ensure modal content has position relative for overlay */
.modal-content {
    position: relative;
}

/* Print styles */
@media print {
    .ho-bottom-nav,
    .ho-sidebar,
    .ho-fab,
    .btn,
    .no-print,
    .modal-loader-overlay {
        display: none !important;
    }

    .ho-main-content {
        margin-left: 0 !important;
    }
}
