/* Bootstrap 5 Compatible Responsive Styles */

/* Base styles */
html, body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    height: 100%;
}

#app {
    height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Breadcrumb and Page Header Styling */
.breadcrumb {
    background: none;
    padding: 0;
    margin: 0;
    font-size: 0.875rem;
}

.breadcrumb-item + .breadcrumb-item::before {
    content: "/";
    color: #6c757d;
    font-weight: normal;
}

.breadcrumb-item a {
    color: #6c757d;
    text-decoration: none;
    transition: color 0.15s ease;
}

.breadcrumb-item a:hover {
    color: #0d6efd;
    text-decoration: underline;
}

.breadcrumb-item.active {
    color: #495057;
    font-weight: 500;
}

/* Page header grouping */
.page-header {
    border-bottom: 1px solid #dee2e6;
    padding-bottom: 1rem;
    margin-bottom: 2rem;
}

/* Desktop Sidebar */
.sidebar {
    background: linear-gradient(180deg, #0d47a1 0%, #1565c0 50%, #1976d2 100%);
    width: 280px;
    min-height: 100vh;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1000;
    transition: transform 0.3s ease;
}

.sidebar-header {
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    min-height: 60px;
    display: flex;
    align-items: center;
}

.sidebar .nav-link {
    color: rgba(255, 255, 255, 0.8) !important;
    padding: 0.75rem 1rem;
    border-radius: 0.375rem;
    margin: 0.125rem 0;
    transition: all 0.2s ease;
}

.sidebar .nav-link:hover {
    background-color: rgba(255, 255, 255, 0.1);
    color: white !important;
    transform: translateX(4px);
}

.sidebar .nav-link.active {
    background-color: rgba(255, 255, 255, 0.2);
    color: white !important;
    font-weight: 600;
}

/* Main content area for desktop */
.main-content {
    margin-left: 280px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Full-width pages (for marketing pages like homepage, pricing) */
.full-width-page {
    margin-left: 0 !important;
}

.full-width-page .top-bar {
    display: none; /* Hide the authenticated top bar */
}

.top-bar {
    min-height: 60px;
    border-bottom: 1px solid #dee2e6;
    background: white;
    position: sticky;
    top: 0;
    z-index: 100;
}

.content {
    flex: 1;
    background-color: #f8f9fa;
}

/* Timer specific styles */
.timer-panel {
    background: white;
    border-radius: 0.5rem;
}

.timer-display {
    font-family: 'SF Mono', 'Monaco', 'Cascadia Code', 'Roboto Mono', 'Courier New', monospace;
    font-weight: 600;
    letter-spacing: 0.1em;
}

.timer-status {
    font-family: monospace;
    font-size: 0.9rem;
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    background-color: #f8f9fa;
}

/* Budget indicator styles */
.budget-indicator {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background-color: #f8f9fa;
}

.budget-icon {
    font-size: 0.75rem;
}

/* Favorite star styles */
.favorite-star {
    color: #dee2e6;
    border: none !important;
    background: none !important;
    padding: 0 !important;
    text-decoration: none !important;
    transition: all 0.2s ease;
}

.favorite-star:hover {
    color: #ffc107;
    transform: scale(1.1);
}

.favorite-star.favorite-active {
    color: #ffc107;
}

.favorite-star:focus {
    box-shadow: none;
    outline: none;
}

/* Card enhancements */
.card {
    border: none;
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
    transition: box-shadow 0.15s ease-in-out;
}

.card:hover {
    box-shadow: 0 0.25rem 0.5rem rgba(0, 0, 0, 0.1);
}

.card-header {
    background-color: white;
    border-bottom: 1px solid rgba(0, 0, 0, 0.125);
    font-weight: 600;
}

/* Account Type Selection Styles - FIXED */
.form-check-card {
    position: relative;
}

.form-check-card .form-check-input {
    position: absolute;
    top: 10px;
    right: 10px;
    opacity: 0;
    z-index: 1;
    width: 20px;
    height: 20px;
    pointer-events: auto; /* Allow pointer events for accessibility */
}

.form-check-card .card {
    cursor: pointer;
    transition: all 0.2s ease;
    border: 2px solid #dee2e6;
    background-color: #fff;
    position: relative;
}

.form-check-card .form-check-input:checked + .card {
    border-color: #0d6efd;
    background-color: #f8f9ff;
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.25);
}

.form-check-card .card:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    transform: translateY(-2px);
}

.form-check-card .form-check-input:checked + .card:hover {
    box-shadow: 0 2px 8px rgba(13, 110, 253, 0.3);
}

/* Add a visual indicator for checked state */
    .form-check-card .form-check-input:checked + .card::after {
        content: '\2713';
        position: absolute;
        top: 10px;
        right: 15px;
        color: #0d6efd;
        font-weight: bold;
        font-size: 16px;
        background: white;
        border-radius: 50%;
        width: 24px;
        height: 24px;
        display: flex;
        align-items: center;
        justify-content: center;
        border: 2px solid #0d6efd;
    }

/* Form enhancements */
.form-floating > .form-control:focus {
    border-color: #0d6efd;
    box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.15);
}

.form-floating > label {
    color: #6c757d;
}

/* Button enhancements */
.btn {
    font-weight: 500;
    border-radius: 0.375rem;
    transition: all 0.15s ease-in-out;
}

.btn-lg {
    padding: 0.75rem 1.5rem;
    font-size: 1.125rem;
}

/* Table responsive enhancements */
.table-responsive {
    border-radius: 0.375rem;
}

.table th {
    font-weight: 600;
    border-top: none;
    background-color: #f8f9fa;
    position: sticky;
    top: 0;
    z-index: 10;
}

/* Error UI */
#blazor-error-ui {
    background: #fff3cd;
    border: 1px solid #ffeaa7;
    border-radius: 0.375rem;
    color: #664d03;
    display: none;
    position: fixed;
    bottom: 1rem;
    left: 1rem;
    right: 1rem;
    z-index: 1050;
    padding: 1rem;
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    font-weight: bold;
}

/* Mobile Styles */
@media (max-width: 991.98px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .main-content {
        margin-left: 0;
    }

    .content {
        padding: 1rem !important;
    }
}

@media (max-width: 767.98px) {
    .card-body {
        padding: 1rem !important;
    }

    .card-header {
        padding: 0.75rem 1rem;
    }

    .btn-lg {
        padding: 0.75rem 1rem;
        font-size: 1rem;
    }

    .timer-display {
        font-size: 1.5rem !important;
    }

    /* Stack form elements on mobile */
    .row.g-3 > .col-12:not(:last-child) {
        margin-bottom: 1rem;
    }

    /* Optimize modals for mobile */
    .modal-dialog {
        margin: 1rem;
        max-width: none;
    }

    .modal-lg {
        max-width: none;
    }

    /* Better table display on mobile */
    .table-responsive {
        font-size: 0.875rem;
    }

    .table td, .table th {
        padding: 0.5rem;
        vertical-align: middle;
    }

    /* Adjust navbar for mobile */
    .navbar-brand {
        font-size: 1.125rem;
    }

    /* Optimize offcanvas */
    .offcanvas {
        max-width: 280px;
    }

    .offcanvas .nav-link {
        padding: 0.75rem 1rem;
        border-radius: 0;
        color: #212529 !important;
    }

    .offcanvas .nav-link:hover {
        background-color: #f8f9fa;
        transform: none;
    }

    /* Account type cards on mobile */
    .form-check-card .card:hover {
        transform: none;
    }

    /* Mobile breadcrumb adjustments */
    .breadcrumb {
        font-size: 0.8rem;
    }

    .breadcrumb-item + .breadcrumb-item::before {
        content: "›";
        font-size: 1.1em;
    }
}

@media (max-width: 575.98px) {
    .content {
        padding: 0.75rem !important;
    }

    .card {
        margin-bottom: 1rem;
    }

    .btn {
        font-size: 0.875rem;
    }

    .h3 {
        font-size: 1.25rem;
    }

    /* Further optimize forms for very small screens */
    .form-floating > .form-control {
        font-size: 1rem;
    }

    .modal-dialog {
        margin: 0.5rem;
    }

    /* Adjust grid spacing */
    .row.g-3 {
        --bs-gutter-x: 1rem;
        --bs-gutter-y: 1rem;
    }

    .row.g-lg-4 {
        --bs-gutter-x: 1rem;
        --bs-gutter-y: 1rem;
    }

    /* Very small screen breadcrumb */
    .breadcrumb {
        font-size: 0.75rem;
        margin-bottom: 0.5rem;
    }
}

/* Print styles */
@media print {
    .sidebar,
    .top-bar,
    .btn,
    .modal,
    .offcanvas {
        display: none !important;
    }

    .main-content {
        margin-left: 0 !important;
    }

    .content {
        padding: 0 !important;
        background: white !important;
    }

    .card {
        border: 1px solid #000 !important;
        box-shadow: none !important;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .card {
        border: 2px solid #000;
    }

    .btn {
        border-width: 2px;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Dark mode support (if needed in future) */
@media (prefers-color-scheme: dark) {
    /* This can be implemented when dark mode is required */
}

/* Focus improvements for accessibility */
.btn:focus,
.form-control:focus,
.form-select:focus {
    outline: 2px solid #0d6efd;
    outline-offset: 2px;
}

/* Loading states */
.loading {
    opacity: 0.6;
    pointer-events: none;
}

.spinner-border-sm {
    width: 1rem;
    height: 1rem;
}

/* Custom scrollbar for webkit browsers */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* Timer pulse animation */
@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.3; }
    100% { opacity: 1; }
}

.pulse-icon {
    animation: pulse 2s infinite;
}

/* Timer status badge animation */
.badge {
    transition: all 0.3s ease;
}

.badge.bg-success {
    animation: fadeIn 0.5s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: scale(0.8); }
    to { opacity: 1; transform: scale(1); }
}

/* Report page specific styles */
.report-header {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 0.5rem;
    padding: 1.5rem;
    margin-bottom: 2rem;
    border: 1px solid #dee2e6;
}

.report-title {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.report-title h1 {
    margin: 0;
    font-weight: 600;
}

.report-breadcrumb {
    margin: 0;
    padding: 0;
    background: none;
}

.report-breadcrumb .breadcrumb-item {
    font-size: 0.9rem;
}

.report-breadcrumb .breadcrumb-item a {
    color: #6c757d;
    text-decoration: none;
    font-weight: 500;
}

.report-breadcrumb .breadcrumb-item a:hover {
    color: #0d6efd;
}

.report-breadcrumb .breadcrumb-item.active {
    color: #495057;
    font-weight: 600;
}

/* Maintenance pages consistent styling */
.maintenance-header {
    margin-bottom: 1.5rem;
}

.maintenance-title h1 {
    font-weight: 600;
    color: #495057;
}

.maintenance-title small {
    font-weight: 400;
    color: #6c757d;
}

/* Enhanced card styling for forms */
.form-card {
    border: none;
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
    border-radius: 0.5rem;
}

.form-card .card-header {
    background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
    border-bottom: 1px solid #dee2e6;
    font-weight: 600;
    color: #495057;
}

/* Tips card styling */
.tips-card {
    background: linear-gradient(135deg, #f8f9ff 0%, #ffffff 100%);
    border: 1px solid #e3f2fd;
}

.tips-card .card-header {
    background: rgba(13, 110, 253, 0.1);
    border-bottom: 1px solid rgba(13, 110, 253, 0.2);
}

/* Status badges enhancement */
.status-badge {
    font-weight: 500;
    font-size: 0.75rem;
    padding: 0.375rem 0.75rem;
    border-radius: 0.375rem;
}

/* Action buttons group enhancement */
.action-buttons {
    gap: 0.5rem;
}

.action-buttons .btn {
    transition: all 0.2s ease;
}

.action-buttons .btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 0.25rem 0.5rem rgba(0, 0, 0, 0.15);
}

/* Profile and Settings page styling */
.profile-card {
    transition: all 0.3s ease;
}

.profile-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
}

.profile-avatar {
    width: 64px;
    height: 64px;
    background: linear-gradient(135deg, #007bff 0%, #0056b3 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.5rem;
    font-weight: 600;
}

.currency-input {
    position: relative;
}

.currency-symbol {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: #6c757d;
    font-weight: 500;
}

.currency-input input {
    padding-left: 2.5rem;
}

/* User dropdown styling */
.user-dropdown {
    border: 1px solid rgba(255, 255, 255, 0.3) !important;
    transition: all 0.2s ease;
    font-size: 0.875rem;
    padding: 0.375rem 0.75rem;
}

.user-dropdown:hover {
    background-color: rgba(255, 255, 255, 0.1) !important;
    border-color: rgba(255, 255, 255, 0.5) !important;
}

.user-dropdown:focus,
.user-dropdown:active {
    box-shadow: 0 0 0 0.2rem rgba(255, 255, 255, 0.25) !important;
    background-color: rgba(255, 255, 255, 0.1) !important;
    border-color: rgba(255, 255, 255, 0.5) !important;
}

.dropdown-menu {
    border: none !important;
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15) !important;
    border-radius: 0.5rem !important;
    padding: 0.5rem 0 !important;
    min-width: 220px !important;
    margin-top: 0.25rem !important;
    z-index: 1050 !important;
}

/* Force dropdown visibility */
.dropdown-menu.show {
    display: block !important;
    opacity: 1 !important;
    visibility: visible !important;
}

.dropdown-menu:not(.show) {
    display: none !important;
}

.dropdown-header {
    font-weight: 600 !important;
    color: #495057 !important;
    padding: 0.5rem 1rem !important;
    font-size: 0.875rem !important;
}

.dropdown-item {
    padding: 0.5rem 1rem !important;
    transition: all 0.2s ease !important;
    border-radius: 0 !important;
    font-size: 0.875rem !important;
    display: flex !important;
    align-items: center !important;
    text-decoration: none !important;
    color: #212529 !important;
}

.dropdown-item:hover,
.dropdown-item:focus {
    background-color: #f8f9fa !important;
    padding-left: 1.25rem !important;
    transform: none !important;
    color: #212529 !important;
    text-decoration: none !important;
}

.dropdown-item.text-danger {
    color: #dc3545 !important;
}

.dropdown-item.text-danger:hover {
    background-color: #f8d7da !important;
    color: #721c24 !important;
}

.dropdown-divider {
    margin: 0.25rem 0 !important;
    border-color: #dee2e6 !important;
}

/* Dropdown toggle fixes for Blazor */
.dropdown-toggle::after {
    margin-left: 0.5em !important;
    vertical-align: 0.125em !important;
}

.dropdown-toggle:focus {
    box-shadow: none !important;
}

/* Fix navbar dropdowns */
.navbar-nav .dropdown-toggle {
    cursor: pointer !important;
}

.navbar-nav .dropdown-menu {
    border: none !important;
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075) !important;
    border-radius: 0.375rem !important;
}

.navbar-nav .dropdown-item {
    font-size: 0.875rem !important;
    padding: 0.5rem 1rem !important;
    transition: all 0.2s ease !important;
}

.navbar-nav .dropdown-item:hover {
    background-color: #f8f9fa !important;
    padding-left: 1.25rem !important;
}

/* Ensure dropdowns are clickable */
.dropdown-toggle[data-bs-toggle="dropdown"] {
    cursor: pointer !important;
    text-decoration: none !important;
}

.dropdown-toggle[data-bs-toggle="dropdown"]:hover {
    text-decoration: none !important;
}

/* Fix form button in dropdown */
.dropdown-item.border-0 {
    border: none !important;
    background: transparent !important;
    text-align: left !important;
    width: 100% !important;
    cursor: pointer !important;
    font-family: inherit !important;
}

.dropdown-item.border-0:hover {
    background-color: #f8d7da !important;
}

/* Dropdown positioning fix */
.dropdown {
    position: relative;
}

.dropdown-menu-end {
    --bs-position: end;
    right: 0;
    left: auto;
}

/* Force Bootstrap dropdown behavior */
.dropdown.show .dropdown-menu {
    display: block !important;
}

/* Fix navbar height consistency */
.navbar {
    min-height: 56px !important;
    padding-top: 0.5rem !important;
    padding-bottom: 0.5rem !important;
}

.navbar-brand {
    font-size: 1.25rem !important;
    font-weight: 600 !important;
}

.navbar-nav .nav-link {
    padding: 0.5rem 0.75rem !important;
    font-size: 0.875rem !important;
    font-weight: 500 !important;
}

/* Ensure consistent button sizing */
.btn-sm {
    padding: 0.25rem 0.5rem !important;
    font-size: 0.875rem !important;
    border-radius: 0.25rem !important;
}

.btn-outline-light {
    border-color: rgba(255, 255, 255, 0.3) !important;
}

.btn-outline-light:hover {
    background-color: rgba(255, 255, 255, 0.1) !important;
    border-color: rgba(255, 255, 255, 0.5) !important;
}

/* Mobile responsiveness for navbar */
@media (max-width: 991.98px) {
    .navbar-collapse {
        background-color: rgba(33, 37, 41, 0.95);
        border-radius: 0.375rem;
        margin-top: 0.5rem;
        padding: 1rem;
    }
    
    .user-dropdown {
        width: 100%;
        text-align: left;
        justify-content: flex-start;
    }
    
    .dropdown-menu {
        width: 100%;
        position: static !important;
        transform: none !important;
        box-shadow: none !important;
        border: 1px solid #dee2e6 !important;
        border-radius: 0.375rem !important;
        margin-top: 0.5rem !important;
    }
    
    .navbar-collapse .dropdown-item {
        color: rgba(255, 255, 255, 0.8) !important;
    }
    
    .navbar-collapse .dropdown-item:hover {
        color: rgba(255, 255, 255, 1) !important;
    }
}

/* Modal z-index fixes */
.modal {
    z-index: 1055 !important;
}

.modal-backdrop {
    z-index: 1050 !important;
}

.modal.show {
    display: block !important;
}

.modal-backdrop.show {
    opacity: 0.5;
}

/* Ensure modal appears above everything else */
.modal-dialog {
    z-index: 1056;
    position: relative;
}