/*
 * Modern Admin Panel - Santa Casa da Misericórdia da Covilhã
 * Fixed Left Sidebar Layout
 */

/* Reset e Base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #2c5aa0;
    --primary-dark: #1e3d6f;
    --secondary-color: #34495e;
    --accent-color: #3498db;
    --success-color: #27ae60;
    --warning-color: #f39c12;
    --danger-color: #e74c3c;
    --info-color: #17a2b8;

    --sidebar-bg: #1a252f;
    --sidebar-hover: #243447;
    --sidebar-active: #ffffff;
    --sidebar-text: #b8c5d1;
    --sidebar-text-muted: #7a8a99;
    --sidebar-border: #2d3e50;

    --content-bg: #f8f9fa;
    --card-bg: #ffffff;
    --border-color: #dee2e6;
    --text-color: #2c3e50;
    --text-muted: #6c757d;

    --header-height: 70px;
    --sidebar-width: 280px;
    --border-radius: 8px;
    --box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    --box-shadow-hover: 0 4px 20px rgba(0,0,0,0.15);
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: var(--content-bg);
    color: var(--text-color);
    line-height: 1.6;
    font-size: 14px;
}

/* DataTables Styling Fixes */
.dataTables_wrapper {
    width: 100%;
    overflow-x: auto;
    margin-top: 0.5rem;
}

/* Keep Bootstrap's default row and column spacing for DataTables controls */

.dataTables_wrapper .dataTables_length,
.dataTables_wrapper .dataTables_filter,
.dataTables_wrapper .dataTables_info,
.dataTables_wrapper .dataTables_paginate {
    padding: 0.75rem 0;
}

.dataTables_wrapper .dataTables_length {
    float: left;
    padding: 0.2rem 0.6rem 0.1rem 0.6rem !important; /* extra-compact */
    font-size: 0.875rem;
    color: var(--text-color);
    font-weight: 500;
    line-height: 1.3;
}

.dataTables_wrapper .dataTables_length label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0;
    font-weight: 500;
}

.dataTables_wrapper .dataTables_length select {
    padding: 0.25rem 0.5rem; /* compact */
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: 0.875rem;
    background-color: var(--card-bg);
    color: var(--text-color);
    min-width: 70px;
    margin: 0 0.25rem;
}

.dataTables_wrapper .dataTables_filter {
    float: right;
    text-align: right;
    padding: 0.2rem 1rem 0.1rem 0.6rem; /* add right padding */
}

.dataTables_wrapper .dataTables_filter label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0;
    font-weight: 500;
    font-size: 0.875rem;
    color: var(--text-color);
}

.dataTables_wrapper .dataTables_filter input {
    margin-left: 0.5rem;
    padding: 0.25rem 0.5rem; /* compact input */
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: 0.875rem;
    background-color: var(--card-bg);
    color: var(--text-color);
    min-width: 200px;
    transition: var(--transition);
}

.dataTables_wrapper .dataTables_filter input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.16rem rgba(44, 90, 160, 0.22);
}

/* Ensure consistent right padding on users table search filter */
#users-table_wrapper .dataTables_filter {
    padding-right: 1.25rem !important; /* match card-body padding */
}

.dataTables_wrapper .dataTables_info {
    clear: both;
    float: left;
    padding: 0.25rem 0.75rem 0.25rem 0.75rem !important; /* compact */
    color: var(--text-muted);
    font-size: 0.875rem;
    font-weight: 500;
    line-height: 1.35;
    margin-top: 0.25rem;
}

.dataTables_wrapper .dataTables_paginate {
    float: right;
    text-align: right;
    padding: 0.15rem 0 0.15rem 0.5rem; /* extra-compact */
    margin-top: 0.15rem;
}

.dataTables_wrapper .dataTables_paginate .paginate_button {
    box-sizing: border-box;
    display: inline-block;
    min-width: 1rem;
    padding: 0.15rem 0.4rem; /* extra-compact buttons */
    margin-left: 2px;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
    color: var(--text-color);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background: var(--card-bg);
    transition: var(--transition);
    font-size: 0.75rem;
    line-height: 1.1;
}

.dataTables_wrapper .dataTables_paginate .paginate_button:hover {
    color: var(--primary-color);
    border: 1px solid var(--primary-color);
    background: rgba(44, 90, 160, 0.1);
}

.dataTables_wrapper .dataTables_paginate .paginate_button.current {
    color: white;
    border: 1px solid var(--primary-color);
    background: var(--primary-color);
}

.dataTables_wrapper .dataTables_paginate .paginate_button.disabled {
    cursor: default;
    color: var(--text-muted);
    border: 1px solid transparent;
    background: transparent;
}

.dataTables_wrapper .dataTables_paginate .paginate_button.disabled:hover {
    color: var(--text-muted);
    border: 1px solid transparent;
    background: transparent;
}

/* Table responsive fixes */
.table-responsive {
    border: none;
    overflow-x: visible;
    margin-top: 0.5rem;
    margin-bottom: 0.5rem;
}

.table-responsive .table {
    margin-bottom: 0;
    min-width: 100%;
}

/* DataTable wrapper spacing */
.dataTables_wrapper .dataTables_length,
.dataTables_wrapper .dataTables_filter {
    margin-bottom: 0.25rem; /* extra-compact */
}

.dataTables_wrapper .dataTables_info,
.dataTables_wrapper .dataTables_paginate {
    margin-top: 0.15rem; /* extra-compact */
}

/* DataTable specific table styling */
table.dataTable {
    width: 100% !important;
    border-collapse: separate;
    border-spacing: 0;
}

/* Users table specific overrides (ensure highest specificity) */
#users-table_wrapper .dataTables_length,
#users-table_wrapper .dataTables_info {
    padding: 0.4rem 0.75rem !important; /* compact users page */
}


/* Ensure padding when inside Bootstrap card body */
.card .card-body #users-table_wrapper .dataTables_length,
.card .card-body #users-table_wrapper .dataTables_info {
    padding: 0.4rem 0.75rem !important;
}

table.dataTable thead th {
    border-bottom: 2px solid var(--border-color);
    padding: 1rem 0.75rem;
    font-weight: 600;
    color: var(--text-color);
    background-color: var(--content-bg);
}

table.dataTable tbody td {
    padding: 0.45rem 0.5rem; /* compact row height */
    border-top: 1px solid var(--border-color);
    vertical-align: middle;
    line-height: 1.2;
}

/* Prevent wrapping for date/time columns and keep items inline */
#users-table tbody td:nth-child(5),
#users-table tbody td:nth-child(6) {
    white-space: nowrap !important;
}

#users-table tbody td:nth-child(5) br,
#users-table tbody td:nth-child(6) br {
    display: none;
}

#users-table tbody td:nth-child(5) *,
#users-table tbody td:nth-child(6) * {
    display: inline;
    vertical-align: baseline;
    margin-right: 0.25rem;
    line-height: 1.2;
}


table.dataTable tbody tr:hover {
    background-color: rgba(44, 90, 160, 0.05);
}

/* Users table: compact username in a single line and remove avatar */
#users-table tbody td:first-child .avatar-xs,
#users-table tbody td:first-child .avatar-title { display: none !important; }
#users-table tbody td:first-child .d-flex { gap: 0 !important; }
#users-table tbody td:first-child h5,
#users-table tbody td:first-child p {
    display: inline !important;
    margin: 0 !important;
    white-space: nowrap !important;
    line-height: 1.2 !important;
}
#users-table tbody td:first-child h5 { font-size: 0.875rem; font-weight: 600; }
#users-table tbody td:first-child p { font-size: 0.75rem; color: var(--text-muted); margin-left: 0.35rem !important; }

/* Pagination color consistency (brand blue #2c5aa0) */
.dataTables_wrapper .dataTables_paginate .paginate_button:hover {
    color: #2c5aa0 !important;
    border: 1px solid #2c5aa0 !important;
    background: rgba(44, 90, 160, 0.10) !important;
}
.dataTables_wrapper .dataTables_paginate .paginate_button.current,
.dataTables_wrapper .dataTables_paginate .paginate_button.current:hover,
.dataTables_wrapper .dataTables_paginate .paginate_button:active {
    color: #ffffff !important;
    border: 1px solid #2c5aa0 !important;
    background: #2c5aa0 !important;
}

/* Remove horizontal scroll */
.dataTables_scrollX {
    overflow-x: visible !important;
}

.dataTables_scrollBody {
    overflow-x: visible !important;
}

/* Responsive table adjustments */
@media (max-width: 768px) {
    .dataTables_wrapper .dataTables_length,
    .dataTables_wrapper .dataTables_filter {
        float: none;
        text-align: left;
        margin-bottom: 1rem;
    }

    .dataTables_wrapper .dataTables_info,
    .dataTables_wrapper .dataTables_paginate {
        float: none;
        text-align: center;
        margin-top: 1rem;
    }
}

/* Layout Container */
.admin-container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.admin-sidebar {
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    overflow-y: auto;
    z-index: 1000;
    transition: var(--transition);
}

.sidebar-header {
    padding: 2rem 1.5rem;
    border-bottom: 1px solid var(--sidebar-border);
    text-align: center;
}

.sidebar-logo {
    color: #ffffff;
    font-size: 1.3rem;
    font-weight: 700;
    text-decoration: none;
    line-height: 1.2;
    display: block;
}

/* Enhanced logo styling for better visibility */
.leftside-menu .logo {
    display: block;
    padding: 1.5rem 1.5rem 1rem 1.5rem; /* Added top padding for breathing room */
    text-align: center;
    border-bottom: 1px solid var(--sidebar-border);
}

.leftside-menu .logo img {
    max-width: 100%;
    height: auto;
    transition: all 0.3s ease;
}

/* Ensure logos maintain aspect ratio on smaller screens */
@media (max-width: 768px) {
    .leftside-menu .logo {
        padding: 1rem 1rem 0.75rem 1rem; /* Reduced padding on mobile */
    }

    .leftside-menu .logo-lg img {
        max-height: 35px; /* Slightly smaller on mobile */
    }

    .leftside-menu .logo-sm img {
        max-height: 35px; /* Slightly smaller on mobile */
    }
}

/* Enhanced active navigation styling for better contrast - Force white background */
.leftside-menu .side-nav .nav-link.active,
.leftside-menu .side-nav .side-nav-link.active,
.side-nav .side-nav-link.active {
    background-color: #ffffff !important;
    color: #1a252f !important;
    font-weight: 600 !important;
    border-radius: 6px !important;
    margin: 2px 8px !important;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1) !important;
}

/* Ensure icons in active nav items are also dark */
.leftside-menu .side-nav .nav-link.active i,
.leftside-menu .side-nav .side-nav-link.active i,
.side-nav .side-nav-link.active i {
    color: #1a252f !important;
}

.sidebar-subtitle {
    color: var(--sidebar-text-muted);
    font-size: 0.85rem;
    margin-top: 0.5rem;
    font-weight: 400;
}

.sidebar-nav {
    padding: 1rem 0;
}

.nav-section {
    margin-bottom: 2rem;
}

.nav-section-title {
    color: var(--sidebar-text-muted);
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    padding: 0 1.5rem;
    margin-bottom: 1rem;
}

.nav-item {
    margin-bottom: 0.125rem;
}

.nav-link {
    display: flex;
    align-items: center;
    padding: 0.875rem 1.5rem;
    color: var(--sidebar-text);
    text-decoration: none;
    transition: var(--transition);
    position: relative;
    font-weight: 500;
    font-size: 0.9rem;
    border-radius: 0;
}

/* Sidebar navigation hover - only apply to sidebar nav-links */
.leftside-menu .nav-link:hover,
.side-nav .nav-link:hover {
    background-color: var(--sidebar-hover);
    color: #ffffff;
}

/* Topbar dropdown hover effects - clean and professional */
.topbar-menu .nav-link:hover {
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    transition: all 0.2s ease;
}

/* Specific hover for notification dropdown */
.notification-list .nav-link:hover {
    background-color: rgba(44, 90, 160, 0.1);
    border-radius: 6px;
}

/* Specific hover for user dropdown */
.nav-user:hover {
    background-color: rgba(44, 90, 160, 0.1);
    border-radius: 6px;
}

/* Active navigation indicator - left border accent */
.leftside-menu .side-nav .side-nav-link.active::before,
.side-nav .side-nav-link.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background-color: #2c5aa0 !important;
    border-radius: 0 4px 4px 0;
}

/* Override any theme-specific active states */
.leftside-menu .side-nav .side-nav-item .side-nav-link.active {
    background-color: #ffffff !important;
    color: #1a252f !important;
}

.nav-icon {
    width: 18px;
    height: 18px;
    margin-right: 0.875rem;
    opacity: 0.7;
    font-size: 0.9rem;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Main Content */
.admin-main {
    flex: 1;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Header */
.admin-header {
    background: var(--card-bg);
    height: var(--header-height);
    border-bottom: 2px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
    position: sticky;
    top: 0;
    z-index: 999;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.header-title {
    font-size: 1.4rem;
    font-weight: 600;
    color: var(--primary-color);
    margin: 0;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.user-menu {
    position: relative;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 0.875rem;
    padding: 0.625rem 1.125rem;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: var(--transition);
    border: 1px solid transparent;
}

.user-info:hover {
    background-color: var(--content-bg);
    border-color: var(--border-color);
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    font-size: 0.95rem;
    box-shadow: 0 2px 8px rgba(44, 90, 160, 0.3);
}

.user-details {
    display: flex;
    flex-direction: column;
    line-height: 1.3;
}

.user-name {
    font-weight: 600;
    color: var(--text-color);
    font-size: 0.95rem;
}

.user-role {
    color: var(--text-muted);
    font-size: 0.8rem;
    font-weight: 500;
}

.dropdown-arrow {
    color: var(--text-muted);
    font-size: 0.7rem;
    margin-left: 0.5rem;
    transition: var(--transition);
}

.user-info:hover .dropdown-arrow {
    color: var(--primary-color);
}

.user-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow-hover);
    min-width: 220px;
    display: none;
    z-index: 1001;
    margin-top: 0.5rem;
    opacity: 0;
    transform: translateY(-10px);
    transition: var(--transition);
}

.user-dropdown.show {
    display: block;
    opacity: 1;
    transform: translateY(0);
}

.dropdown-item {
    display: block;
    padding: 0.875rem 1.25rem;
    color: var(--text-color);
    text-decoration: none;
    transition: var(--transition);
    border-bottom: 1px solid var(--border-color);
    font-size: 0.9rem;
    font-weight: 500;
}

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

.dropdown-item:hover {
    background-color: var(--primary-color);
    color: #ffffff;
}

/* Content Area */
.admin-content {
    flex: 1;
    padding: 2rem;
    background-color: var(--content-bg);
}

/* Page Header */
.page-header {
    margin-bottom: 2.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.page-title {
    font-size: 2.25rem;
    font-weight: 700;
    color: var(--text-color);
    margin-bottom: 0.75rem;
    line-height: 1.2;
}

.page-subtitle {
    color: var(--text-muted);
    font-size: 1.1rem;
    font-weight: 400;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

/* Widget Cards */
.widget-flat {
    border: 1px solid #e3e6f0;
    border-radius: 0.35rem;
    box-shadow: 0 0.15rem 1.75rem 0 rgba(58, 59, 69, 0.15);
    transition: all 0.3s;
}

.widget-flat:hover {
    transform: translateY(-2px);
    box-shadow: 0 0.25rem 2rem 0 rgba(58, 59, 69, 0.2);
}

.widget-icon {
    width: 3rem;
    height: 3rem;
    border-radius: 0.75rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: #6c757d;
    background-color: rgba(108, 117, 125, 0.08);
    border: 1px solid rgba(108, 117, 125, 0.1);
    transition: all 0.3s ease;
}

.widget-icon.bg-primary {
    color: #2c5aa0;
    background-color: rgba(44, 90, 160, 0.08);
    border-color: rgba(44, 90, 160, 0.15);
}

.widget-icon.bg-success {
    color: #198754;
    background-color: rgba(25, 135, 84, 0.08);
    border-color: rgba(25, 135, 84, 0.15);
}

.widget-icon.bg-info {
    color: #0dcaf0;
    background-color: rgba(13, 202, 240, 0.08);
    border-color: rgba(13, 202, 240, 0.15);
}

.widget-icon.bg-warning {
    color: #ffc107;
    background-color: rgba(255, 193, 7, 0.08);
    border-color: rgba(255, 193, 7, 0.15);
}

.widget-icon.bg-danger {
    color: #dc3545;
    background-color: rgba(220, 53, 69, 0.08);
    border-color: rgba(220, 53, 69, 0.15);
}

/* Hover effects for widget icons */
.widget-flat:hover .widget-icon {
    transform: scale(1.05);
    box-shadow: 0 0.25rem 0.75rem rgba(0, 0, 0, 0.1);
}

.widget-flat:hover .widget-icon.bg-primary {
    background-color: rgba(44, 90, 160, 0.12);
    border-color: rgba(44, 90, 160, 0.2);
}

.widget-flat:hover .widget-icon.bg-success {
    background-color: rgba(25, 135, 84, 0.12);
    border-color: rgba(25, 135, 84, 0.2);
}

.widget-flat:hover .widget-icon.bg-info {
    background-color: rgba(13, 202, 240, 0.12);
    border-color: rgba(13, 202, 240, 0.2);
}

.widget-flat:hover .widget-icon.bg-warning {
    background-color: rgba(255, 193, 7, 0.12);
    border-color: rgba(255, 193, 7, 0.2);
}

.stat-card {
    background: var(--card-bg);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    box-shadow: var(--box-shadow);
    transition: var(--transition);
    border-left: 4px solid var(--primary-color);
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--box-shadow-hover);
}

.stat-card.success {
    border-left-color: var(--success-color);
}

.stat-card.warning {
    border-left-color: var(--warning-color);
}

.stat-card.danger {
    border-left-color: var(--danger-color);
}

.stat-card.info {
    border-left-color: var(--info-color);
}

.stat-value {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--text-color);
    margin-bottom: 0.5rem;
}

.stat-label {
    color: var(--text-muted);
    font-size: 0.9rem;
    font-weight: 500;
}

/* Cards */
.card {
    background: var(--card-bg);
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    margin-bottom: 1.5rem;
    overflow: hidden;
    transition: var(--transition);
}

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

.card-header {
    background: var(--card-bg);
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.card-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-color);
    margin: 0;
}

.card-body {
    padding: 1.5rem;
}

/* Forms */
.form-group {
    margin-bottom: 1.5rem;
}

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--text-color);
}

.form-control {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: 1rem;
    transition: var(--transition);
    background: var(--card-bg);
}

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

/* Clean Form Validation - Base States */
.form-control.is-valid {
    border-color: var(--success-color);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-control.is-invalid {
    border-color: var(--danger-color);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

/* Clean Validation Messages */
.invalid-feedback {
    display: none;
    color: var(--danger-color);
    font-size: 0.875rem;
    font-weight: 500;
    margin-top: 0.5rem;
    line-height: 1.4;
}

.invalid-feedback.show {
    display: block;
}

.valid-feedback {
    display: none;
    color: var(--success-color);
    font-size: 0.875rem;
    font-weight: 500;
    margin-top: 0.5rem;
    line-height: 1.4;
}

.valid-feedback.show {
    display: block;
}

/* Focus states for validation */
.form-control:focus.is-valid {
    border-color: var(--success-color);
    box-shadow: 0 0 0 3px rgba(40, 167, 69, 0.15);
}

.form-control:focus.is-invalid {
    border-color: var(--danger-color);
    box-shadow: 0 0 0 3px rgba(231, 76, 60, 0.15);
}

/* Tooltip de erro de campo */
.field-error-tooltip {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--danger-color);
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 12px;
    z-index: 1000;
    margin-top: 4px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    display: flex;
    align-items: center;
    gap: 6px;
    animation: fadeInTooltip 0.3s ease-in-out;
}

.field-error-tooltip::before {
    content: '';
    position: absolute;
    top: -4px;
    left: 12px;
    width: 0;
    height: 0;
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    border-bottom: 4px solid var(--danger-color);
}

.field-error-tooltip i {
    font-size: 11px;
}

/* Animações para tooltips */
@keyframes fadeInTooltip {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

/* Dropdown Fixes */
.dropdown-menu {
    border: 1px solid var(--border-color);
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    border-radius: 8px;
    padding: 0.5rem 0;
    z-index: 1050;
    transition: opacity 0.15s ease, transform 0.15s ease;
}

/* Let Bootstrap handle the show/hide states naturally */

/* Fix for notification dropdown */
.notification-list .dropdown-menu {
    min-width: 320px;
    max-width: 400px;
}

/* Fix for user dropdown */
.nav-user + .dropdown-menu {
    min-width: 200px;
}

/* Prevent dark overlay issues - but allow Bootstrap's natural behavior */
.dropdown-backdrop {
    display: none !important;
}

/* Remove any modal backdrop that might interfere */
.modal-backdrop {
    display: none !important;
}

/* Ensure dropdown toggles are clickable */
[data-bs-toggle="dropdown"] {
    cursor: pointer !important;
    pointer-events: auto !important;
}

/* Ensure dropdowns appear above other content */
.topbar-menu .dropdown {
    position: relative;
    z-index: 1051;
}

.topbar-menu .dropdown-menu {
    z-index: 1052;
}

/* Fix any overlay issues */
body.dropdown-open {
    overflow: visible !important;
}

/* Ensure proper dropdown positioning */
.dropdown-menu-end {
    right: 0 !important;
    left: auto !important;
}

/* Dropdown animation handled by Bootstrap */

/* Notification System */
.notification-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    max-width: 420px;
    pointer-events: none;
}

.notification-container .toast {
    pointer-events: auto;
    margin-bottom: 10px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    border-radius: 8px;
    animation: slideInRight 0.3s ease-out;
    min-width: 350px;
}

.notification-container .toast.show {
    display: block !important;
    opacity: 1 !important;
    visibility: visible !important;
}

.notification-container .toast.hiding {
    animation: slideOutRight 0.3s ease-in;
}

/* Force toast visibility - override any Bootstrap conflicts */
.notification-container .toast {
    display: block !important;
    opacity: 1 !important;
    visibility: visible !important;
    position: relative !important;
    transform: none !important;
}

/* Custom toast styles to avoid Bootstrap conflicts */
.notification-container .custom-toast {
    display: block !important;
    opacity: 1 !important;
    visibility: visible !important;
    position: relative !important;
    margin-bottom: 10px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    min-width: 350px;
    animation: slideInRight 0.3s ease-out;
    color: white;
    pointer-events: auto;
}

.notification-container .custom-toast.hiding {
    animation: slideOutRight 0.3s ease-in;
    opacity: 0;
    transform: translateX(100%);
}

.notification-container .toast .toast-body {
    padding: 1rem;
    word-wrap: break-word;
}

.notification-container .toast .btn-close {
    padding: 0.5rem;
    margin: 0;
    flex-shrink: 0;
}

.notification-container .toast .d-flex {
    min-height: 48px;
}

/* Notification animations */
@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOutRight {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

/* Progress animation for notifications */
.notification-progress {
    margin-top: 8px;
    display: flex;
    align-items: center;
}

.progress-dots {
    display: flex;
    gap: 4px;
    align-items: center;
}

.progress-dots .dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.7);
    animation: dotPulse 1.4s infinite ease-in-out;
}

.progress-dots .dot:nth-child(1) {
    animation-delay: -0.32s;
}

/* Enhanced Form Validation Styles */
.field-validation-icon {
    transition: all 0.2s ease-in-out;
}

/* Duplicate validation styles removed - using unified styles above */

/* Password Strength Indicator */
.password-strength-indicator {
    animation: fadeIn 0.3s ease-in-out;
}

.password-strength-indicator .progress {
    transition: all 0.3s ease-in-out;
}

/* CAPTCHA styles removed - replaced with modern rate limiting system */

.password-strength-indicator .progress-bar {
    transition: all 0.3s ease-in-out;
}

/* Password Toggle Button */
.position-relative .btn-link {
    color: #6c757d;
    text-decoration: none;
    padding: 0.375rem 0.5rem;
}

.position-relative .btn-link:hover {
    color: #495057;
}

.position-relative .btn-link:focus {
    box-shadow: none;
    outline: 2px solid #0d6efd;
    outline-offset: 2px;
}

/* Loading Button Animation */
.spinner-border-sm {
    animation: spinner-border 0.75s linear infinite;
}

@keyframes spinner-border {
    to {
        transform: rotate(360deg);
    }
}

/* Enhanced Authentication Form */
.authentication-form {
    animation: fadeInUp 0.6s ease-out;
}

.authentication-form .form-control {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.authentication-form .form-control:focus {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(13, 110, 253, 0.15);
    border-color: #0d6efd;
}

.authentication-form .form-control:hover:not(:focus) {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

/* Button Loading States */
.btn.loading {
    position: relative;
    pointer-events: none;
    opacity: 0.8;
}

.btn.loading .btn-text {
    opacity: 0;
}

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

/* Enhanced Loading Spinner */
.spinner-border-sm {
    width: 1rem;
    height: 1rem;
    border-width: 0.15em;
    animation: spinner-border 0.75s linear infinite;
}

@keyframes spinner-border {
    to {
        transform: rotate(360deg);
    }
}

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

/* Form Field Animations */
.form-floating > label {
    transition: all 0.2s ease-in-out;
}

.form-control:focus ~ label,
.form-control:not(:placeholder-shown) ~ label {
    transform: scale(0.85) translateY(-0.5rem) translateX(0.15rem);
}

/* Validation Animations */
.field-validation-icon {
    animation: bounceIn 0.3s ease-out;
}

@keyframes bounceIn {
    0% {
        opacity: 0;
        transform: scale(0.3);
    }
    50% {
        opacity: 1;
        transform: scale(1.05);
    }
    70% {
        transform: scale(0.9);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

/* CAPTCHA Container Animation */
.h-captcha, .g-recaptcha {
    animation: slideInUp 0.4s ease-out;
    transition: all 0.3s ease-in-out;
}

/* Toast Notification Enhancements */
.notification-container .toast {
    animation: slideInRight 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.notification-container .toast.hiding {
    animation: slideOutRight 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Enhanced Login Form States */
.authentication-form.form-loading {
    opacity: 0.8;
    pointer-events: none;
}

.authentication-form.form-loading .form-control {
    background-color: #f8f9fa;
}

.authentication-form .form-control.is-invalid {
    border-color: #dc3545;
    box-shadow: 0 0 0 0.2rem rgba(220, 53, 69, 0.25);
}

.authentication-form .form-control.is-valid {
    border-color: #198754;
    box-shadow: 0 0 0 0.2rem rgba(25, 135, 84, 0.25);
}

.authentication-form .invalid-feedback {
    display: block;
    font-size: 0.875rem;
    color: #dc3545;
    margin-top: 0.25rem;
}

.authentication-form .form-control:focus {
    border-color: #86b7fe;
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.25);
}

/* Loading button animation */
.btn .spinner-border-sm {
    width: 0.875rem;
    height: 0.875rem;
    animation: spinner-border 0.75s linear infinite;
}

@keyframes spinner-border {
    to {
        transform: rotate(360deg);
    }
}

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

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

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

/* Pulse animation for important elements */
@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(13, 110, 253, 0.7);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(13, 110, 253, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(13, 110, 253, 0);
    }
}

.pulse {
    animation: pulse 2s infinite;
}

/* Micro-interactions */
.form-check-input:checked {
    animation: checkmark 0.3s ease-in-out;
}

@keyframes checkmark {
    0% {
        transform: scale(0.8);
    }
    50% {
        transform: scale(1.1);
    }
    100% {
        transform: scale(1);
    }
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    opacity: 0;
    transition: opacity 0.3s ease-in-out;
}

.loading-overlay.show {
    opacity: 1;
}

.loading-content {
    background: white;
    padding: 2rem;
    border-radius: 12px;
    text-align: center;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
    animation: scaleIn 0.3s ease-out;
}

.loading-message {
    color: #6c757d;
    font-weight: 500;
}

@keyframes scaleIn {
    from {
        transform: scale(0.8);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

/* Enhanced Button States */
.btn:not(:disabled):hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.btn:active {
    transform: translateY(0);
}

.btn.loading {
    transform: none !important;
}

/* Form Focus Ring Enhancement */
.form-control:focus,
.form-select:focus,
.form-check-input:focus {
    outline: 2px solid rgba(13, 110, 253, 0.25);
    outline-offset: 2px;
}

/* Enhanced Login Interface */
.authentication-bg {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    position: relative;
}

.authentication-bg::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><pattern id="grain" width="100" height="100" patternUnits="userSpaceOnUse"><circle cx="50" cy="50" r="1" fill="rgba(255,255,255,0.1)"/></pattern></defs><rect width="100" height="100" fill="url(%23grain)"/></svg>');
    opacity: 0.3;
}

.account-pages {
    position: relative;
    z-index: 1;
}

.login-logo-container {
    text-align: center;
    margin-bottom: 2rem;
    animation: fadeInDown 0.8s ease-out;
}

.login-logo-large {
    max-height: 80px;
    width: auto;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.1));
    transition: transform 0.3s ease;
}

.login-logo-large:hover {
    transform: scale(1.05);
}

/* Enhanced Card Design */
.authentication-form .card {
    border: none;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
    background: rgba(255, 255, 255, 0.95);
    overflow: hidden;
}

.authentication-form .card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #667eea, #764ba2);
}

/* Enhanced Form Styling */
.authentication-form h4 {
    color: #2c3e50;
    font-weight: 700;
    margin-bottom: 1.5rem;
    text-align: center;
    position: relative;
}

.authentication-form h4::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 50%;
    transform: translateX(-50%);
    width: 50px;
    height: 3px;
    background: linear-gradient(90deg, #667eea, #764ba2);
    border-radius: 2px;
}

.authentication-form .form-label {
    font-weight: 600;
    color: #495057;
    margin-bottom: 0.5rem;
}

.authentication-form .form-control {
    border: 2px solid #e9ecef;
    border-radius: 12px;
    padding: 0.75rem 1rem;
    font-size: 0.95rem;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(5px);
}

.authentication-form .form-control:focus {
    border-color: #667eea;
    background: rgba(255, 255, 255, 0.95);
    box-shadow: 0 0 0 0.2rem rgba(102, 126, 234, 0.15);
}

.authentication-form .btn-primary {
    background: var(--primary-color);
    border: none;
    border-radius: 12px;
    padding: 0.75rem 1.5rem;
    font-weight: 600;
    font-size: 1rem;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

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

.authentication-form .btn-primary:hover::before {
    left: 100%;
}

.authentication-form .btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.3);
}

/* Responsive Design Enhancements */
@media (max-width: 768px) {
    .authentication-bg {
        padding: 1rem;
    }

    .account-pages {
        padding-top: 1rem !important;
        padding-bottom: 1rem !important;
    }

    .authentication-form .card {
        border-radius: 16px;
        margin: 0;
    }

    .login-logo-large {
        max-height: 60px;
    }

    .authentication-form h4 {
        font-size: 1.5rem;
    }

    .authentication-form .form-control {
        padding: 0.875rem 1rem;
        font-size: 16px; /* Prevent zoom on iOS */
    }

    .authentication-form .btn-primary {
        padding: 1rem 1.5rem;
        font-size: 1.1rem;
    }
}

@media (max-width: 576px) {
    .authentication-form .card .row {
        margin: 0;
    }

    .authentication-form .card .col-lg-6 {
        padding: 1.5rem;
    }

    .login-logo-container {
        margin-bottom: 1.5rem;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .authentication-form .card {
        background: rgba(33, 37, 41, 0.95);
        color: #fff;
    }

    .authentication-form h4 {
        color: #fff;
    }

    .authentication-form .form-label {
        color: #adb5bd;
    }

    .authentication-form .form-control {
        background: rgba(52, 58, 64, 0.8);
        border-color: #495057;
        color: #fff;
    }

    .authentication-form .form-control:focus {
        background: rgba(52, 58, 64, 0.95);
        border-color: #667eea;
    }
}

/* Accessibility Enhancements */
.authentication-form .form-control:focus {
    outline: 2px solid #667eea;
    outline-offset: 2px;
}

.authentication-form .btn:focus {
    outline: 2px solid #667eea;
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .authentication-form .form-control {
        border-width: 3px;
    }

    .authentication-form .btn-primary {
        background: #0056b3;
        border: 2px solid #004085;
    }
}

.progress-dots .dot:nth-child(2) {
    animation-delay: -0.16s;
}

.progress-dots .dot:nth-child(3) {
    animation-delay: 0s;
}

@keyframes dotPulse {
    0%, 80%, 100% {
        transform: scale(0.8);
        opacity: 0.5;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Enhanced notification message styling */
.notification-message {
    line-height: 1.4;
    flex-grow: 1;
}

/* Enhanced confirmation modal */
#confirmation-modal .modal-dialog {
    max-width: 400px;
}

#confirmation-modal .modal-content {
    border-radius: 12px;
    border: none;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
}

/* Modern Notification Badge Styling */
.noti-icon-badge {
    position: absolute !important;
    top: 8px !important;
    right: -2px !important;
    min-width: 16px !important;
    height: 16px !important;
    padding: 0 !important;
    font-size: 10px !important;
    font-weight: 600 !important;
    line-height: 16px !important;
    text-align: center !important;
    border-radius: 8px !important;
    border: 2px solid #fff !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    z-index: 10 !important;
}

/* Hide badge when count is 0 */
.noti-icon-badge:empty,
.noti-icon-badge[data-count="0"] {
    display: none !important;
}

/* Badge color variants */
.noti-icon-badge.text-bg-pink {
    background-color: #e91e63 !important;
    color: #fff !important;
}

.noti-icon-badge.text-bg-purple {
    background-color: #9c27b0 !important;
    color: #fff !important;
}

.noti-icon-badge.text-bg-danger {
    background-color: #dc3545 !important;
    color: #fff !important;
}

.noti-icon-badge.text-bg-warning {
    background-color: #ffc107 !important;
    color: #000 !important;
}

.noti-icon-badge.text-bg-success {
    background-color: #198754 !important;
    color: #fff !important;
}

.noti-icon-badge.text-bg-info {
    background-color: #0dcaf0 !important;
    color: #000 !important;
}

/* Animation for new notifications */
@keyframes notificationPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

.noti-icon-badge.new-notification {
    animation: notificationPulse 0.6s ease-in-out;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .noti-icon-badge {
        min-width: 14px !important;
        height: 14px !important;
        font-size: 9px !important;
        line-height: 14px !important;
        border-radius: 7px !important;
        top: 6px !important;
        right: -1px !important;
    }
}

/* Notification dropdown improvements */
.notification-list .dropdown-menu {
    border: none;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    border-radius: 12px;
    overflow: hidden;
}

.notification-list .notify-item {
    transition: background-color 0.2s ease;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.notification-list .notify-item:last-child {
    border-bottom: none;
}

.notification-list .notify-item:hover {
    background-color: rgba(0, 0, 0, 0.02);
}

.notification-list .notify-item.unread-noti {
    background-color: rgba(13, 110, 253, 0.05);
    border-left: 3px solid #0d6efd;
}

.notification-list .notify-item.read-noti {
    opacity: 0.8;
    border-left: 3px solid transparent;
}

.notification-list .notify-item.read-noti:hover {
    opacity: 1;
}

/* Notification click feedback */
.notification-list .notify-item {
    cursor: pointer;
    transition: all 0.3s ease;
}

.notification-list .notify-item:active {
    transform: scale(0.98);
}

/* Notification icon in topbar hover effect */
.notification-list .nav-link {
    position: relative;
    transition: all 0.3s ease;
}

.notification-list .nav-link:hover {
    transform: scale(1.05);
}

.notification-list .nav-link:hover .noti-icon-badge {
    transform: scale(1.1);
}

#confirmation-modal .modal-header {
    border-bottom: 1px solid #e9ecef;
    padding: 1.25rem 1.5rem 1rem;
}

#confirmation-modal .modal-body {
    padding: 1rem 1.5rem 1.25rem;
}

#confirmation-modal .modal-footer {
    border-top: 1px solid #e9ecef;
    padding: 1rem 1.5rem 1.25rem;
    gap: 0.5rem;
}

#confirmation-modal .btn {
    border-radius: 6px;
    font-weight: 500;
    padding: 0.5rem 1.25rem;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: var(--border-radius);
    font-size: 0.9rem;
    font-weight: 600;
    text-decoration: none;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    line-height: 1;
    position: relative;
    overflow: hidden;
}

.btn:hover {
    transform: translateY(-1px);
}

/* Enhanced Primary Button - Professional Santa Casa Branding */
.btn-primary {
    background: var(--primary-color);
    color: white;
    border: none;
    font-weight: 600;
    letter-spacing: 0.5px;
    text-transform: none;
    box-shadow: 0 2px 8px rgba(44, 90, 160, 0.25);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

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

.btn-primary:hover {
    background: var(--primary-dark);
    box-shadow: 0 6px 20px rgba(44, 90, 160, 0.4);
    transform: translateY(-2px);
}

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

.btn-primary:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(44, 90, 160, 0.3);
}

.btn-primary:focus {
    box-shadow: 0 0 0 3px rgba(44, 90, 160, 0.3);
}

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

.btn-success:hover {
    background: #229954;
    box-shadow: 0 4px 12px rgba(39, 174, 96, 0.3);
}

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

.btn-warning:hover {
    background: #e67e22;
    box-shadow: 0 4px 12px rgba(243, 156, 18, 0.3);
}

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

.btn-danger:hover {
    background: #c0392b;
    box-shadow: 0 4px 12px rgba(231, 76, 60, 0.3);
}

.btn-secondary {
    background: var(--content-bg);
    color: var(--text-color);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: #e9ecef;
    border-color: #adb5bd;
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.8rem;
}

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

/* Tables */
.table-responsive {
    overflow-x: auto;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    background: var(--card-bg);
}

.table {
    width: 100%;
    border-collapse: collapse;
    margin: 0;
}

.table th,
.table td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
}

.table th {
    background-color: var(--content-bg);
    font-weight: 600;
    color: var(--text-color);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.table tbody tr {
    transition: var(--transition);
}

.table tbody tr:hover {
    background-color: rgba(52, 152, 219, 0.05);
}

/* Alerts */
.alert {
    padding: 1rem 1.5rem;
    border-radius: var(--border-radius);
    margin-bottom: 1.5rem;
    border-left: 4px solid;
    background: var(--card-bg);
    box-shadow: var(--box-shadow);
}

.alert-success {
    border-left-color: var(--success-color);
    background-color: rgba(39, 174, 96, 0.1);
    color: #155724;
}

.alert-warning {
    border-left-color: var(--warning-color);
    background-color: rgba(243, 156, 18, 0.1);
    color: #856404;
}

.alert-danger {
    border-left-color: var(--danger-color);
    background-color: rgba(231, 76, 60, 0.1);
    color: #721c24;
}

.alert-info {
    border-left-color: var(--info-color);
    background-color: rgba(23, 162, 184, 0.1);
    color: #0c5460;
}

/* Utility Classes */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-left { text-align: left; }

.text-primary { color: var(--primary-color); }
.text-success { color: var(--success-color); }
.text-warning { color: var(--warning-color); }
.text-danger { color: var(--danger-color); }
.text-muted { color: var(--text-muted); }

.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mb-4 { margin-bottom: 2rem; }

.mt-0 { margin-top: 0; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }

.d-none { display: none; }
.d-block { display: block; }
.d-flex { display: flex; }
.justify-content-between { justify-content: space-between; }
.align-items-center { align-items: center; }

/* Badge */
.badge {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1;
    text-align: center;
    white-space: nowrap;
    vertical-align: baseline;
    border-radius: 0.375rem;
}

.badge-primary { background-color: var(--primary-color); color: white; }
.badge-success { background-color: var(--success-color); color: white; }
.badge-warning { background-color: var(--warning-color); color: white; }
.badge-danger { background-color: var(--danger-color); color: white; }
.badge-secondary { background-color: var(--text-muted); color: white; }

/* Login Page Improvements */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--accent-color) 100%);
    padding: 2rem;
}

/* Authentication Background - Lighter and more welcoming */
body.authentication-bg {
    background: linear-gradient(135deg,
        rgba(44, 90, 160, 0.85) 0%,
        rgba(52, 152, 219, 0.75) 50%,
        rgba(44, 62, 80, 0.8) 100%) !important;
    background-size: cover !important;
    position: relative;
}

/* Add subtle overlay pattern for texture */
body.authentication-bg::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image:
        radial-gradient(circle at 25% 25%, rgba(255,255,255,0.1) 0%, transparent 50%),
        radial-gradient(circle at 75% 75%, rgba(255,255,255,0.05) 0%, transparent 50%);
    pointer-events: none;
    z-index: 0;
}

.login-card {
    background: var(--card-bg);
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow-hover);
    padding: 3rem;
    width: 100%;
    max-width: 420px;
}

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

.login-logo h1 {
    color: var(--primary-color);
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}
/* Consistent organization subtitle styling in auth pages */
.login-logo .org-subtitle {
    color: var(--primary-color);
    font-weight: 600;
    font-size: 1rem;
    margin-top: 0.25rem;
}


.login-logo p {
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* Enhanced Logo Container */
.login-logo-container {
    text-align: center;
    margin-bottom: 2.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid #e9ecef;
}

.login-logo-container img {
    max-width: 280px;
    height: auto;
    margin-bottom: 1rem;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.1));
}

.login-logo-large {
    max-width: 280px;
    height: auto;
}

.password-strength {
    margin-top: 0.5rem;
}

.password-strength-bar {
    height: 4px;
    background: var(--content-bg);
    border-radius: 2px;
    overflow: hidden;
}

.password-strength-fill {
    height: 100%;
    transition: var(--transition);
    border-radius: 2px;
}

.password-strength-weak { background: var(--danger-color); width: 25%; }
.password-strength-fair { background: var(--warning-color); width: 50%; }
.password-strength-good { background: var(--accent-color); width: 75%; }
.password-strength-strong { background: var(--success-color); width: 100%; }

/* Loading */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255,255,255,.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Mobile Menu Toggle */
.mobile-menu-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--card-bg);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.5rem;
}

.mobile-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 999;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .admin-sidebar {
        transform: translateX(-100%);
    }

    .admin-sidebar.open {
        transform: translateX(0);
    }

    .admin-main {
        margin-left: 0;
    }

    .mobile-menu-toggle {
        display: block;
    }

    .stats-grid {
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
        gap: 1rem;
    }
}

@media (max-width: 768px) {
    .admin-content {
        padding: 1rem;
    }

    .page-title {
        font-size: 1.5rem;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .header-title {
        font-size: 1.25rem;
    }

    .user-details {
        display: none;
    }

    .table th,
    .table td {
        padding: 0.5rem;
        font-size: 0.85rem;
    }

    .btn {
        padding: 0.5rem 1rem;
        font-size: 0.85rem;
    }

    .login-card {
        padding: 2rem;
        margin: 1rem;
    }

    .login-logo-container img {
        max-width: 200px;
    }

    .sidebar-header {
        padding: 1rem;
    }

    .nav-link {
        padding: 1rem 1.5rem;
        font-size: 0.9rem;
    }
}

@media (max-width: 480px) {
    .admin-content {
        padding: 0.75rem;
    }

    .card-body {
        padding: 1rem;
    }

    .stat-card {
        padding: 1rem;
    }

    .stat-value {
        font-size: 2rem;
    }

    .login-card {
        padding: 1.5rem;
    }

    .login-logo-container img {
        max-width: 150px;
    }
}

/* Authentication Pages Specific Styling */
.account-pages {
    position: relative;
    z-index: 1;
}

.account-pages .card {
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.2);
    border: none;
    border-radius: 12px;
    overflow: hidden;
    backdrop-filter: blur(10px);
}

/* Enhanced form styling for auth pages */
.authentication-form .form-label {
    font-weight: 600;
    color: var(--text-color);
    margin-bottom: 0.75rem;
    font-size: 0.95rem;
}

.authentication-form .form-control {
    padding: 0.875rem 1rem;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.3s ease;
    background-color: #fafbfc;
    color: var(--text-color);
}

.authentication-form .form-control:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(44, 90, 160, 0.1);
    background-color: #ffffff;
}

.authentication-form .form-control::placeholder {
    color: #9ca3af;
    font-size: 0.95rem;
}

/* Enhanced button styling for auth pages */
.authentication-form .btn {
    padding: 0.875rem 2rem;
    font-size: 1rem;
    font-weight: 600;
    border-radius: 8px;
    text-transform: none;
    letter-spacing: 0.3px;
}

/* Footer styling for auth pages */
.footer.footer-alt {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    text-align: center;
    padding: 1.5rem;
    background: transparent;
    border: none;
}

.footer.footer-alt .text-light {
    color: rgba(255, 255, 255, 0.8) !important;
    font-size: 0.9rem;
    font-weight: 500;
}

/* Link styling improvements */
.text-dark.link-offset-3 {
    color: var(--primary-color) !important;
    text-decoration: none !important;
    font-weight: 600;
    transition: all 0.3s ease;
}

.text-dark.link-offset-3:hover {
    color: var(--primary-dark) !important;
    text-decoration: none !important;
    transform: translateX(-2px);
}

/* Alert improvements for auth pages */
.alert {
    border-radius: 8px;
    border: none;
    padding: 1rem 1.25rem;
    margin-bottom: 1.5rem;
    font-weight: 500;
}

.alert-danger {
    background-color: rgba(231, 76, 60, 0.1);
    color: #c0392b;
    border-left: 4px solid var(--danger-color);
}

.alert-success {
    background-color: rgba(39, 174, 96, 0.1);
    color: #27ae60;
    border-left: 4px solid var(--success-color);
}

/* Responsive improvements for mobile */
@media (max-width: 576px) {
    .login-logo-container img {
        max-width: 180px;
    }

    .authentication-form .form-control {
        padding: 0.75rem;
        font-size: 0.95rem;
    }

    .authentication-form .btn {
        padding: 0.75rem 1.5rem;
        font-size: 0.95rem;
    }
}

/* Search Results */
.search-result-item:last-child {
    border-bottom: none !important;
}

.search-results .highlight {
    background-color: #fff3cd;
    padding: 0.1rem 0.2rem;
    border-radius: 0.2rem;
}

/* Fix for Typeahead.js Search Input Duplication Issue */
.app-search .twitter-typeahead {
    display: block !important;
    width: 100%;
}

.app-search .tt-hint {
    display: none !important; /* Hide the hint input that causes duplication */
}

.app-search .tt-input {
    background-color: transparent !important;
    border: none !important;
}

.app-search .tt-menu {
    width: 100%;
    max-width: 320px;
    background-color: #fff;
    border: 1px solid #dee2e6;
    border-radius: 0.375rem;
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
    margin-top: 0.25rem;
    padding: 0.5rem 0;
    z-index: 1060;
    max-height: 300px;
    overflow-y: auto;
    /* Fix for border clipping issue */
    border-radius: 0.5rem !important;
    overflow: visible !important;
}

.app-search .tt-suggestion {
    padding: 0.5rem 1rem;
    cursor: pointer;
    border-radius: 0 !important; /* Ensure suggestions don't have conflicting border-radius */
}

.app-search .tt-suggestion:hover,
.app-search .tt-suggestion.tt-cursor {
    background-color: #f8f9fa;
    color: #495057;
}

.app-search .tt-suggestion:first-child {
    border-top-left-radius: 0.5rem;
    border-top-right-radius: 0.5rem;
}

.app-search .tt-suggestion:last-child {
    border-bottom-left-radius: 0.5rem;
    border-bottom-right-radius: 0.5rem;
}

/* Fix for search dropdown positioning and border clipping */
.app-search {
    position: relative !important;
    overflow: visible !important; /* Changed from hidden to visible */
}

.app-search form {
    position: relative;
    overflow: visible !important; /* Ensure dropdown is not clipped */
}

.app-search .form-control {
    position: relative;
    z-index: 1;
}

/* Mobile search dropdown fixes */
.dropdown-menu.dropdown-lg {
    border-radius: 0.5rem !important;
    overflow: visible !important;
    border: 1px solid #dee2e6 !important;
}

.dropdown-menu.dropdown-lg .form-control {
    border-radius: 0.375rem !important;
}

/* Search focus enhancement */
.app-search.search-focused .form-control {
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.25);
    border-color: #86b7fe;
}

.app-search.search-focused .btn {
    border-color: #86b7fe;
}

/* Ensure no duplicate text elements are visible */
.app-search .tt-hint,
.app-search .twitter-typeahead .tt-hint {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
}

/* Fix for any remaining border clipping issues */
.app-search .input-group,
.app-search .dropdown-menu {
    border-radius: 0.5rem;
    overflow: visible;
}

.app-search .dropdown-menu-animated {
    border-radius: 0.5rem !important;
    border: 1px solid rgba(0, 0, 0, 0.15) !important;
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15) !important;
}

/* Additional responsive improvements for widgets */
@media (max-width: 768px) {
    .widget-flat .card-body {
        padding: 1rem;
    }

    .widget-icon {
        width: 2.5rem;
        height: 2.5rem;
        font-size: 1.25rem;
        border-radius: 0.625rem;
    }

    .search-result-item {
        padding: 1rem 0 !important;
    }
}

/* ===== SWEETALERT2 CUSTOM STYLING ===== */
.swal2-admin-popup {
    border-radius: var(--border-radius) !important;
    box-shadow: var(--box-shadow-hover) !important;
    font-family: inherit !important;
}

.swal2-admin-title {
    color: var(--text-color) !important;
    font-weight: 600 !important;
    font-size: 1.25rem !important;
}

.swal2-admin-content {
    color: var(--text-muted) !important;
    font-size: 0.95rem !important;
}

.swal2-destructive .swal2-icon.swal2-warning {
    border-color: var(--danger-color) !important;
    color: var(--danger-color) !important;
}

.swal2-confirm {
    border-radius: var(--border-radius) !important;
    font-weight: 500 !important;
    padding: 0.5rem 1.5rem !important;
    font-size: 0.9rem !important;
}

.swal2-cancel {
    border-radius: var(--border-radius) !important;
    font-weight: 500 !important;
    padding: 0.5rem 1.5rem !important;
    font-size: 0.9rem !important;
}

.swal2-popup .swal2-styled:focus {
    box-shadow: none !important;
}

/* Dark backdrop for better contrast */
.swal2-backdrop-show {
    background-color: rgba(0, 0, 0, 0.6) !important;
}

/* SweetAlert2 responsive adjustments */
@media (max-width: 768px) {
    .swal2-admin-popup {
        width: 90% !important;
        margin: 0 auto !important;
    }

    .swal2-admin-title {
        font-size: 1.1rem !important;
    }

    .swal2-admin-content {
        font-size: 0.9rem !important;
    }
}

/* Modal consistency and layering (Bootstrap 5) */
.modal { z-index: 1050 !important; }
.modal-backdrop { z-index: 1040 !important; background-color: #000; }
.modal-backdrop.show { opacity: 0.70; }

/* Modal header icon color align with brand */
.modal .modal-header i { color: var(--primary-color); }



/* Fix: ensure Bootstrap modal backdrop is visible and dark */
.modal-backdrop { display: block !important; background-color: #000 !important; }
.modal-backdrop.fade { opacity: 0; }
.modal-backdrop.show { opacity: 0.60 !important; }

/* Fix: modal centering and avoid full-height stretching */
.modal-dialog { margin: 1.75rem auto !important; }
.modal-dialog-centered { display: flex !important; align-items: center !important; min-height: calc(100% - 3.5rem) !important; }
.modal-dialog-centered .modal-content { max-height: calc(100vh - 3.5rem) !important; overflow: auto !important; }

@media (max-width: 576px) {
  .modal-dialog { margin: 1rem auto !important; }
  .modal-dialog-centered { min-height: calc(100% - 2rem) !important; }
  .modal-dialog-centered .modal-content { max-height: calc(100vh - 2rem) !important; }
}
