/* ============================================
   CONSISTENCY & DESIGN SYSTEM STYLES
   ============================================ */

/* ============================================
   TYPOGRAPHY - Default Text Color
   ============================================ */
body,
p,
div,
span,
label,
td,
th,
li,
ul,
ol {
    color: #002946;
}

/* Paragraphs - Main text color */
p {
    color: #002946;
    line-height: 1.6;
    margin-bottom: 1rem;
}

/* Headings inherit or use darker shade */
h1, h2, h3, h4, h5, h6 {
    color: #002946;
    font-weight: 600;
}

/* Small text */
small,
.small {
    color: #002946;
    font-size: 0.875rem;
}

/* Text muted should be lighter but still visible */
.text-muted {
    color: #6c757d !important;
}

/* ============================================
   FORM INPUTS - Consistency
   ============================================ */

/* Base input styling */
.form-control,
.form-select,
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="date"],
input[type="time"],
textarea {
    color: #002946;
    border: 1px solid #ced4da;
    border-radius: 4px;
    padding: 0.5rem 0.75rem;
    font-size: 0.95rem;
    transition: all 0.2s ease;
}

.form-control:focus,
.form-select:focus {
    border-color: #002946;
    box-shadow: 0 0 0 0.2rem rgba(0, 41, 70, 0.15);
    outline: none;
    color: #002946;
}

.form-control:hover:not(:disabled),
.form-select:hover:not(:disabled) {
    border-color: #002946;
}

/* Large inputs */
.form-control-lg,
.form-select-lg {
    font-size: 1.1rem;
    padding: 0.75rem 1rem;
    min-height: 48px;
}

/* Small inputs */
.form-control-sm,
.form-select-sm {
    font-size: 0.875rem;
    padding: 0.375rem 0.5rem;
}

/* Placeholder text */
.form-control::placeholder,
.form-select::placeholder {
    color: #6c757d;
    opacity: 0.7;
}

/* ============================================
   DROPDOWNS - Consistency
   ============================================ */

.form-select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' fill='%23002946' viewBox='0 0 24 24'%3E%3Cpath d='M7 10l5 5 5-5z' fill='%23002946'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 18px 18px;
    padding-right: 2.5rem;
    color: #002946;
    cursor: pointer;
    /* Remove default browser arrows */
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

/* Hide default browser arrow for Webkit browsers (Chrome, Safari, Edge) */
.form-select::-webkit-dropdown-button,
.form-select::-webkit-dropdown-arrow {
    display: none;
    -webkit-appearance: none;
}

/* Hide default browser arrow for Firefox */
.form-select {
    -moz-appearance: none !important;
    text-indent: 0.01px;
    text-overflow: '';
}

.form-select::-moz-focus-inner {
    border: 0;
}

/* Hide default browser arrow for IE10+ */
.form-select::-ms-expand {
    display: none;
}

/* Ensure no double arrows in Edge */
.form-select::-ms-value {
    background: transparent;
}

.form-select:focus {
    border-color: #002946;
    box-shadow: 0 0 0 0.2rem rgba(0, 41, 70, 0.15);
    outline: none;
}

.form-select:hover:not(:disabled) {
    border-color: #002946;
}

/* ============================================
   BUTTONS - Consistency
   ============================================ */

/* Base button styles */
.btn {
    font-weight: 500;
    border-radius: 4px;
    padding: 0.5rem 1rem;
    font-size: 0.95rem;
    transition: all 0.2s ease;
    border: 1px solid transparent;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.btn:focus {
    box-shadow: 0 0 0 0.2rem rgba(0, 41, 70, 0.25);
    outline: none;
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.btn:active {
    transform: translateY(0);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

/* Primary Button */
.btn-primary {
    background-color: #002946;
    border-color: #002946;
    color: #ffffff !important;
}

.btn-primary:hover {
    background-color: #001d33;
    border-color: #001d33;
    color: #ffffff !important;
}

.btn-primary:focus,
.btn-primary:active {
    background-color: #001524;
    border-color: #001524;
    color: #ffffff !important;
}

/* Ensure all text and icons in primary buttons are white */
.btn-primary,
.btn-primary *,
.btn-primary i,
.btn-primary span {
    color: #ffffff !important;
}

/* Secondary Button */
.btn-secondary {
    background-color: #6c757d;
    border-color: #6c757d;
    color: #ffffff;
}

.btn-secondary:hover {
    background-color: #5a6268;
    border-color: #5a6268;
    color: #ffffff;
}

/* Outline Primary */
.btn-outline-primary {
    color: #002946;
    border-color: #002946;
    background-color: transparent;
}

.btn-outline-primary:hover {
    background-color: #002946;
    border-color: #002946;
    color: #ffffff;
}

/* Outline Secondary */
.btn-outline-secondary {
    color: #6c757d;
    border-color: #6c757d;
    background-color: transparent;
}

.btn-outline-secondary:hover {
    background-color: #6c757d;
    border-color: #6c757d;
    color: #ffffff;
}

/* Success Button */
.btn-success {
    background-color: #28a745;
    border-color: #28a745;
    color: #ffffff;
}

.btn-success:hover {
    background-color: #218838;
    border-color: #218838;
    color: #ffffff;
}

/* Danger Button */
.btn-danger {
    background-color: #dc3545;
    border-color: #dc3545;
    color: #ffffff;
}

.btn-danger:hover {
    background-color: #c82333;
    border-color: #c82333;
    color: #ffffff;
}

/* Warning Button */
.btn-warning {
    background-color: #ffc107;
    border-color: #ffc107;
    color: #212529;
}

.btn-warning:hover {
    background-color: #e0a800;
    border-color: #e0a800;
    color: #212529;
}

/* Info Button */
.btn-info {
    background-color: #17a2b8;
    border-color: #17a2b8;
    color: #ffffff;
}

.btn-info:hover {
    background-color: #138496;
    border-color: #138496;
    color: #ffffff;
}

/* Edit Button - Consistent styling */
.btn-edit,
.btn.btn-edit,
a.btn-edit {
    background-color: #002946;
    border-color: #002946;
    color: #ffffff;
    padding: 0.375rem 0.75rem;
    font-size: 0.875rem;
}

.btn-edit:hover,
.btn.btn-edit:hover,
a.btn-edit:hover {
    background-color: #001d33;
    border-color: #001d33;
    color: #ffffff;
}

/* Button Sizes */
.btn-sm {
    padding: 0.25rem 0.5rem;
    font-size: 0.875rem;
    border-radius: 3px;
}

.btn-lg {
    padding: 0.75rem 1.5rem;
    font-size: 1.1rem;
    border-radius: 5px;
}

/* Button with Icon */
.btn i,
.btn .mdi {
    font-size: 1em;
    line-height: 1;
    vertical-align: middle;
}

.btn-sm i,
.btn-sm .mdi {
    font-size: 0.875rem;
}

.btn-lg i,
.btn-lg .mdi {
    font-size: 1.2rem;
}

/* Disabled Buttons */
.btn:disabled,
.btn.disabled {
    opacity: 0.65;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
}

/* ============================================
   CARDS - Consistency
   ============================================ */

.card {
    border: 1px solid #e9ecef;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    transition: all 0.2s ease;
}

.card:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.card-header {
    background-color: #f8f9fa;
    border-bottom: 1px solid #e9ecef;
    color: #002946;
    font-weight: 600;
    padding: 1rem 1.25rem;
}

.card-body {
    color: #002946;
    padding: 1.25rem;
}

.card-footer {
    background-color: #f8f9fa;
    border-top: 1px solid #e9ecef;
    color: #002946;
    padding: 0.75rem 1.25rem;
}

.card-title {
    color: #002946;
    font-weight: 600;
    margin-bottom: 0.75rem;
}

.card-text {
    color: #002946;
}

/* ============================================
   TABLES - Consistency
   ============================================ */

.table {
    color: #002946;
}

.table thead th {
    color: #002946;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.875rem;
    letter-spacing: 0.5px;
    border-bottom: 2px solid #dee2e6;
    background-color: #f8f9fa;
    padding: 0.75rem;
}

.table tbody td {
    color: #002946;
    padding: 0.75rem;
    vertical-align: middle;
}

.table tbody tr {
    transition: background-color 0.2s;
}

.table tbody tr:hover {
    background-color: #f8f9fa;
}

.table-striped tbody tr:nth-of-type(odd) {
    background-color: rgba(0, 0, 0, 0.02);
}

.table-bordered {
    border: 1px solid #dee2e6;
}

.table-bordered th,
.table-bordered td {
    border: 1px solid #dee2e6;
}

/* ============================================
   BADGES - Consistency
   ============================================ */

.badge {
    font-weight: 500;
    padding: 0.35em 0.65em;
    font-size: 0.85em;
    border-radius: 4px;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

.badge-primary {
    background-color: #002946;
    color: #ffffff;
}

.badge-success {
    background-color: #28a745;
    color: #ffffff;
}

.badge-danger {
    background-color: #dc3545;
    color: #ffffff;
}

.badge-warning {
    background-color: #ffc107;
    color: #212529;
}

.badge-info {
    background-color: #17a2b8;
    color: #ffffff;
}

.badge-secondary {
    background-color: #6c757d;
    color: #ffffff;
}

/* ============================================
   LABELS - Consistency
   ============================================ */

label,
.form-label {
    color: #002946;
    font-weight: 500;
    margin-bottom: 0.5rem;
    font-size: 0.95rem;
}

.form-label.required::after {
    content: " *";
    color: #dc3545;
}

/* ============================================
   ALERTS - Consistency
   ============================================ */

.alert {
    border-radius: 4px;
    border: 1px solid transparent;
    padding: 0.75rem 1rem;
    color: #002946;
}

.alert-success {
    background-color: #d4edda;
    border-color: #c3e6cb;
    color: #155724;
}

.alert-danger {
    background-color: #f8d7da;
    border-color: #f5c6cb;
    color: #721c24;
}

.alert-warning {
    background-color: #fff3cd;
    border-color: #ffeaa7;
    color: #856404;
}

.alert-info {
    background-color: #d1ecf1;
    border-color: #bee5eb;
    color: #0c5460;
}

/* ============================================
   LINKS - Consistency
   ============================================ */

a {
    color: #002946;
    text-decoration: none;
    transition: color 0.2s ease;
}

a:hover {
    color: #001d33;
    text-decoration: underline;
}

a.btn {
    text-decoration: none;
}

a.btn:hover {
    text-decoration: none;
}

/* ============================================
   FORM GROUPS - Consistency
   ============================================ */

.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
}

.form-text {
    font-size: 0.875rem;
    color: #6c757d;
    margin-top: 0.25rem;
}

.form-check-label {
    color: #002946;
    font-weight: 400;
    margin-left: 0.5rem;
}

.form-check-input:checked {
    background-color: #002946;
    border-color: #002946;
}

.form-check-input:focus {
    border-color: #002946;
    box-shadow: 0 0 0 0.2rem rgba(0, 41, 70, 0.25);
}

/* ============================================
   MODALS - Consistency
   ============================================ */

.modal-header {
    background-color: #f8f9fa;
    border-bottom: 1px solid #e9ecef;
    color: #002946;
    padding: 1rem 1.5rem;
}

.modal-title {
    color: #002946;
    font-weight: 600;
}

.modal-body {
    color: #002946;
    padding: 1.5rem;
}

.modal-footer {
    background-color: #f8f9fa;
    border-top: 1px solid #e9ecef;
    padding: 1rem 1.5rem;
}

/* ============================================
   NAVIGATION - Consistency
   ============================================ */

.nav-link {
    color: #002946;
    transition: color 0.2s ease;
}

.nav-link:hover {
    color: #001d33;
}

.nav-link.active {
    color: #002946;
    font-weight: 600;
}

/* ============================================
   PAGINATION - Consistency
   ============================================ */

.page-link {
    color: #002946;
    border-color: #dee2e6;
}

.page-link:hover {
    color: #001d33;
    background-color: #e9ecef;
    border-color: #dee2e6;
}

.page-item.active .page-link {
    background-color: #002946;
    border-color: #002946;
    color: #ffffff;
}

/* ============================================
   TOOLTIPS - Consistency
   ============================================ */

.tooltip-inner {
    background-color: #002946;
    color: #ffffff;
}

.tooltip.bs-tooltip-top .tooltip-arrow::before {
    border-top-color: #002946;
}

.tooltip.bs-tooltip-bottom .tooltip-arrow::before {
    border-bottom-color: #002946;
}

.tooltip.bs-tooltip-left .tooltip-arrow::before {
    border-left-color: #002946;
}

.tooltip.bs-tooltip-right .tooltip-arrow::before {
    border-right-color: #002946;
}

/* ============================================
   HELPER CLASSES
   ============================================ */

.text-primary-custom {
    color: #002946 !important;
}

.bg-primary-custom {
    background-color: #002946 !important;
    color: #ffffff !important;
}

.border-primary-custom {
    border-color: #002946 !important;
}

/* ============================================
   RESPONSIVE ADJUSTMENTS
   ============================================ */

@media (max-width: 768px) {
    /* Buttons in flex containers should respect flexbox and stack properly */
    .d-flex .btn,
    .d-flex.gap-2 .btn,
    .d-flex.gap-3 .btn,
    .d-flex.flex-column .btn,
    .d-flex.flex-md-row .btn {
        width: 100% !important;
        margin-bottom: 0.5rem;
    }
    
    /* Standalone buttons */
    .btn {
        width: 100%;
        margin-bottom: 0.5rem;
    }
    
    /* Buttons in btn-group */
    .btn-group .btn {
        width: 100% !important;
        margin-bottom: 0.5rem;
    }

    .btn-sm,
    .btn-lg {
        width: auto;
    }

    .form-control,
    .form-select {
        font-size: 16px; /* Prevent zoom on iOS */
    }
}

/* ============================================
   DROPDOWN Z-INDEX FIX - Prevent overlap
   ============================================ */

/* Ensure button containers stay above dropdowns */
.btn-container,
.filter-buttons,
.d-flex.gap-2[style*="z-index"] {
    position: relative !important;
    z-index: 10 !important;
}

/* Lower z-index for select dropdowns when focused */
.form-select:focus {
    z-index: 5;
    position: relative;
}

/* Prevent native select dropdown from overlapping buttons */
.row.g-3 .form-select {
    position: relative;
    z-index: 1;
}

/* Fix dropdown text wrapping and overflow */
.form-select {
    max-width: 100%;
    width: 100%;
    box-sizing: border-box;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Truncate selected text in dropdown */
.form-select:not([multiple]) {
    text-overflow: ellipsis;
    overflow: hidden;
}

/* Employee dropdown specific - allow text to wrap in options */
.employee-dropdown {
    max-width: 100%;
    width: 100%;
    box-sizing: border-box;
}

/* Ensure select dropdowns respect container width and don't overflow */
select.form-select {
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Prevent dropdown from expanding beyond container */
.col-12 .form-select,
.col-sm-6 .form-select,
.col-md-4 .form-select,
.col-lg-3 .form-select {
    width: 100%;
    max-width: 100%;
}

/* ============================================
   TOOLTIPS - Custom styling
   ============================================ */

/* Tooltip icon styling */
[data-bs-toggle="tooltip"],
.tooltip-trigger {
    cursor: help;
    color: #6c757d;
    opacity: 0.7;
    transition: opacity 0.2s;
}

[data-bs-toggle="tooltip"]:hover,
.tooltip-trigger:hover {
    opacity: 1;
    color: #002946;
}

/* Info icon next to labels */
.form-label .fa-info-circle {
    font-size: 0.85em;
    margin-left: 4px;
}

/* Custom tooltip styling */
.tooltip-inner {
    background-color: #002946;
    color: #ffffff;
    font-size: 0.875rem;
    padding: 0.5rem 0.75rem;
    border-radius: 4px;
    max-width: 300px;
    text-align: left;
}

/* Tooltip arrow color */
.tooltip.bs-tooltip-top .tooltip-arrow::before {
    border-top-color: #002946;
}

.tooltip.bs-tooltip-bottom .tooltip-arrow::before {
    border-bottom-color: #002946;
}

.tooltip.bs-tooltip-left .tooltip-arrow::before {
    border-left-color: #002946;
}

.tooltip.bs-tooltip-right .tooltip-arrow::before {
    border-right-color: #002946;
}

