/**
 * TOGA TEX BD ERP - Custom Styles
 * Professional styling for the ERP application
 */

:root {
    --brand-red: #dc2626;
    --brand-blue: #113875;
    --brand-navy: #0b2a5b;
    --primary-color: #0b2a5b;
    --secondary-color: #475569;
    --success-color: #059669;
    --warning-color: #d97706;
    --danger-color: #dc2626;
    --info-color: #0284c7;
    --light-color: #f8fafc;
    --dark-color: #0f172a;
}

/* Bootstrap Overrides - Corporate Dark Blue Standard */
.bg-primary {
    background-color: var(--brand-navy) !important;
}

.text-primary {
    color: var(--brand-navy) !important;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f5f5f5;
}

.navbar-brand {
    font-weight: bold;
    color: white !important;
    text-transform: uppercase;
}

.card {
    border: none;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    margin-bottom: 1.5rem;
}

.card-header {
    background-color: var(--primary-color);
    color: white;
    font-weight: 600;
}

.myerp-form {
    background: white;
    padding: 1.5rem;
    border-radius: 8px;
    margin-bottom: 2rem;
}

.form-group {
    margin-bottom: 1rem;
}

/* Custom Confirmation Dialog */
.confirm-dialog-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.confirm-dialog-overlay.show {
    opacity: 1;
    visibility: visible;
}

.confirm-dialog {
    background: white;
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    max-width: 400px;
    width: 90%;
    transform: scale(0.8);
    transition: transform 0.3s ease;
}

.confirm-dialog-overlay.show .confirm-dialog {
    transform: scale(1);
}

.confirm-dialog-header {
    padding: 1.5rem;
    border-bottom: 1px solid #e3e6f0;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.confirm-dialog-icon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
}

.confirm-dialog-icon.danger {
    background-color: #fee;
    color: var(--danger-color);
}

.confirm-dialog-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--dark-color);
    margin: 0;
}

.confirm-dialog-body {
    padding: 1.5rem;
    color: #6c757d;
    line-height: 1.5;
}

.confirm-dialog-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid #e3e6f0;
    display: flex;
    gap: 0.5rem;
    justify-content: flex-end;
}

.btn-confirm {
    min-width: 100px;
}

/* Delete button hover effect */
.btn-danger:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(220, 53, 69, 0.3);
}

/* Table row selection */
.table tbody tr.selected {
    background-color: #e3f2fd;
}

.table tbody tr:hover {
    background-color: #f8f9fa;
}

/* Loading spinner */
.spinner-border-sm {
    width: 1rem;
    height: 1rem;
}

.form-group label {
    font-weight: 600;
    color: var(--dark-color);
    margin-bottom: 0.5rem;
}

.form-control {
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 0.75rem;
    transition: border-color 0.15s ease-in-out;
}

.form-control:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(209, 0, 0, 0.25);
}

/* Standard ERP Buttons: Corporate theme for primary/submit actions */
.btn-primary,
.btn-submit,
.btn-save,
.btn-excel,
.btn-export,
.btn-action-primary,
button[type="submit"] {
    background: linear-gradient(135deg, #0b2a5b 0%, #113875 100%) !important;
    background-color: #0b2a5b !important;
    border: 1px solid #0b2a5b !important;
    color: #ffffff !important;
    box-shadow: 0 2px 6px rgba(11, 42, 91, 0.22);
}

.btn-primary:hover,
.btn-submit:hover,
.btn-save:hover,
.btn-excel:hover,
.btn-export:hover,
.btn-action-primary:hover,
button[type="submit"]:hover {
    background: linear-gradient(135deg, #082046 0%, #0d2e62 100%) !important;
    background-color: #082046 !important;
    border-color: #082046 !important;
    color: #ffffff !important;
    box-shadow: 0 4px 12px rgba(11, 42, 91, 0.35) !important;
    transform: translateY(-1px);
}

.btn-primary:focus,
.btn-primary:active,
button[type="submit"]:focus,
button[type="submit"]:active {
    background: #061a38 !important;
    border-color: #061a38 !important;
    color: #ffffff !important;
    box-shadow: 0 0 0 0.2rem rgba(11, 42, 91, 0.25) !important;
}

.btn:disabled,
.btn.disabled,
button[type="submit"]:disabled {
    background: #1e3a6e !important;
    border-color: #1e3a6e !important;
    color: #ffffff !important;
    opacity: 0.65 !important;
    cursor: not-allowed !important;
    transform: none !important;
    box-shadow: none !important;
}

.btn-primary *,
.btn-submit *,
.btn-save *,
.btn-excel *,
.btn-export *,
.btn-action-primary *,
button[type="submit"] * {
    color: #ffffff !important;
}

/* Semantic Danger / Delete Action Buttons: Red with high contrast */
.btn-danger,
.btn-outline-danger {
    background: #dc2626 !important;
    background-color: #dc2626 !important;
    border-color: #b91c1c !important;
    color: #ffffff !important;
}
.btn-danger:hover,
.btn-outline-danger:hover {
    background: #b91c1c !important;
    background-color: #b91c1c !important;
    border-color: #991b1b !important;
    color: #ffffff !important;
}
.btn-danger *,
.btn-outline-danger * {
    color: #ffffff !important;
}

/* Semantic Success / Add Action Buttons: Green with high contrast */
.btn-success,
.btn-outline-success {
    background: #059669 !important;
    background-color: #059669 !important;
    border-color: #047857 !important;
    color: #ffffff !important;
}
.btn-success:hover,
.btn-outline-success:hover {
    background: #047857 !important;
    background-color: #047857 !important;
    border-color: #065f46 !important;
    color: #ffffff !important;
}
.btn-success *,
.btn-outline-success * {
    color: #ffffff !important;
}

/* Semantic Warning Buttons: Amber */
.btn-warning,
.btn-outline-warning {
    background: #d97706 !important;
    background-color: #d97706 !important;
    border-color: #b45309 !important;
    color: #ffffff !important;
}
.btn-warning *,
.btn-outline-warning * {
    color: #ffffff !important;
}

/* White and Light Background Buttons: High Contrast Dark Text & Icons (No white-on-white) */
.btn.bg-white,
.btn.bg-light,
.btn-light,
.btn-outline-secondary {
    background: #ffffff !important;
    background-color: #ffffff !important;
    border: 1px solid #cbd5e1 !important;
    color: #1e293b !important;
}
.btn.bg-white *,
.btn.bg-light *,
.btn-light *,
.btn-outline-secondary * {
    color: #1e293b !important;
}

/* ============================================================== */
/* ERP WINDOW CONTROLS (MINIMIZE, MAXIMIZE / RESTORE, CLOSE)       */
/* Standardized: 28x28px, 6px radius, unified styling across all pages */
/* ============================================================== */
.win-ctrl-btn,
.modal-control-btn,
.btn-win-ctrl,
.ctrl-btn,
.btn-window-control {
    width: 28px !important;
    height: 28px !important;
    min-width: 28px !important;
    min-height: 28px !important;
    max-width: 28px !important;
    max-height: 28px !important;
    padding: 0 !important;
    margin: 0 2px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    border-radius: 6px !important;
    font-size: 0.8rem !important;
    line-height: 1 !important;
    cursor: pointer !important;
    transition: all 0.18s ease-in-out !important;
    box-shadow: none !important;
    transform: none !important;
    text-decoration: none !important;
    position: relative !important;
    box-sizing: border-box !important;
}

.win-ctrl-btn:hover,
.modal-control-btn:hover,
.btn-win-ctrl:hover,
.ctrl-btn:hover,
.btn-window-control:hover {
    transform: translateY(-1px) !important;
}

/* Minimize Button Unified Appearance: Amber / Gold */
.win-ctrl-btn.btn-min-screen,
.modal-control-btn[title*="Minimize"],
.modal-control-btn.btn-min-screen,
.btn-win-ctrl[title*="Minimize"],
.btn-win-ctrl#btn-user-modal-minimize,
.ctrl-btn.btn-min {
    background: rgba(245, 158, 11, 0.22) !important;
    border: 1px solid rgba(245, 158, 11, 0.75) !important;
    color: #fef08a !important;
}
.win-ctrl-btn.btn-min-screen *,
.modal-control-btn[title*="Minimize"] *,
.btn-win-ctrl[title*="Minimize"] *,
.btn-win-ctrl#btn-user-modal-minimize * {
    color: #fef08a !important;
}
.win-ctrl-btn.btn-min-screen:hover,
.modal-control-btn[title*="Minimize"]:hover,
.modal-control-btn.btn-min-screen:hover,
.btn-win-ctrl[title*="Minimize"]:hover,
.btn-win-ctrl#btn-user-modal-minimize:hover,
.ctrl-btn.btn-min:hover {
    background: #f59e0b !important;
    border-color: #d97706 !important;
    color: #ffffff !important;
    box-shadow: 0 0 10px rgba(245, 158, 11, 0.6) !important;
    transform: translateY(-1px) !important;
}
.win-ctrl-btn.btn-min-screen:hover *,
.modal-control-btn[title*="Minimize"]:hover *,
.btn-win-ctrl[title*="Minimize"]:hover *,
.btn-win-ctrl#btn-user-modal-minimize:hover * {
    color: #ffffff !important;
}

/* Maximize Button Unified Appearance: Sky Blue / Cyan */
.win-ctrl-btn.btn-max-screen,
.modal-control-btn[title*="Maximize"],
.modal-control-btn.btn-max-screen,
.btn-win-ctrl[title*="Maximize"],
.btn-win-ctrl#btn-user-modal-maximize,
.ctrl-btn.btn-max {
    background: rgba(14, 165, 233, 0.22) !important;
    border: 1px solid rgba(14, 165, 233, 0.75) !important;
    color: #bae6fd !important;
}
.win-ctrl-btn.btn-max-screen *,
.modal-control-btn[title*="Maximize"] *,
.btn-win-ctrl[title*="Maximize"] *,
.btn-win-ctrl#btn-user-modal-maximize * {
    color: #bae6fd !important;
}
.win-ctrl-btn.btn-max-screen:hover,
.modal-control-btn[title*="Maximize"]:hover,
.modal-control-btn.btn-max-screen:hover,
.btn-win-ctrl[title*="Maximize"]:hover,
.btn-win-ctrl#btn-user-modal-maximize:hover,
.ctrl-btn.btn-max:hover {
    background: #0ea5e9 !important;
    border-color: #0284c7 !important;
    color: #ffffff !important;
    box-shadow: 0 0 10px rgba(14, 165, 233, 0.6) !important;
    transform: translateY(-1px) !important;
}
.win-ctrl-btn.btn-max-screen:hover *,
.modal-control-btn[title*="Maximize"]:hover *,
.btn-win-ctrl[title*="Maximize"]:hover *,
.btn-win-ctrl#btn-user-modal-maximize:hover * {
    color: #ffffff !important;
}

/* Close Window Control Button: Crimson / Red */
.win-ctrl-btn.btn-close-screen,
.modal-control-btn[title*="Close"],
.modal-control-btn.btn-close-screen,
.modal-controls .modal-control-btn:last-child,
.modal-control-btn.text-white,
.btn-win-ctrl.btn-win-close,
.btn-win-ctrl[title*="Close"],
.ctrl-btn.btn-close-os {
    background: rgba(239, 68, 68, 0.22) !important;
    border: 1px solid rgba(239, 68, 68, 0.75) !important;
    color: #fecaca !important;
}
.win-ctrl-btn.btn-close-screen *,
.modal-control-btn[title*="Close"] *,
.modal-controls .modal-control-btn:last-child *,
.modal-control-btn.text-white *,
.btn-win-ctrl.btn-win-close *,
.btn-win-ctrl[title*="Close"] * {
    color: #fecaca !important;
}
.win-ctrl-btn.btn-close-screen:hover,
.modal-control-btn[title*="Close"]:hover,
.modal-control-btn.btn-close-screen:hover,
.modal-controls .modal-control-btn:last-child:hover,
.modal-control-btn.text-white:hover,
.btn-win-ctrl.btn-win-close:hover,
.btn-win-ctrl[title*="Close"]:hover,
.ctrl-btn.btn-close-os:hover {
    background: #ef4444 !important;
    border-color: #dc2626 !important;
    color: #ffffff !important;
    box-shadow: 0 0 10px rgba(239, 68, 68, 0.6) !important;
    transform: translateY(-1px) !important;
}
.win-ctrl-btn.btn-close-screen:hover *,
.modal-control-btn[title*="Close"]:hover *,
.modal-controls .modal-control-btn:last-child:hover *,
.modal-control-btn.text-white:hover *,
.btn-win-ctrl.btn-win-close:hover *,
.btn-win-ctrl[title*="Close"]:hover * {
    color: #ffffff !important;
}

/* Icon centering for dot-based ctrl-btn legacy markup */
.ctrl-btn.btn-min::after {
    content: '−' !important;
    position: static !important;
    opacity: 1 !important;
    color: #fef08a !important;
    font-size: 13px !important;
    font-weight: bold !important;
}
.ctrl-btn.btn-min:hover::after {
    color: #ffffff !important;
}
.ctrl-btn.btn-max::after {
    content: '◱' !important;
    position: static !important;
    opacity: 1 !important;
    color: #bae6fd !important;
    font-size: 11px !important;
    font-weight: bold !important;
}
.ctrl-btn.btn-max:hover::after {
    color: #ffffff !important;
}
.ctrl-btn.btn-close-os::after {
    content: '×' !important;
    position: static !important;
    opacity: 1 !important;
    color: #fecaca !important;
    font-size: 14px !important;
    font-weight: bold !important;
}
.ctrl-btn.btn-close-os:hover::after {
    color: #ffffff !important;
}

.table {
    background: white;
}

/* All Table Headers: Dark Blue with White Text */
table thead th,
.table thead th,
thead th,
table th,
.table th,
thead.table-light th,
thead.table-dark th,
.table-light th,
.table-dark th,
.data-table th,
.report-table th,
.table-excel thead th,
.excel-table th,
.excel-table thead th,
.um-table-head th,
.perm-sub-table thead th,
.table-payroll th,
.table-payroll thead th,
#employeeRegisterTable thead th,
.emp-table-responsive thead th,
#budgetTable thead th,
table.table-bordered thead th,
table.table-hover thead th,
.table-responsive table thead th,
.sticky-checkbox,
.sticky-sn,
.sticky-action,
th.sticky-col-1,
th.sticky-col-2 {
    background: linear-gradient(135deg, #0b2a5b 0%, #113875 100%) !important;
    background-color: #0b2a5b !important;
    border: 1px solid rgba(255, 255, 255, 0.22) !important;
    font-weight: bold !important;
    color: #ffffff !important;
    text-align: center;
    vertical-align: middle;
    text-transform: uppercase;
    font-size: 11px !important;
    letter-spacing: normal;
    padding: 6px 8px !important;
}

table thead th *,
.table thead th *,
thead th *,
table th *,
.table th *,
.table-payroll th *,
.um-table-head th *,
.data-table th *,
.excel-table th * {
    color: #ffffff !important;
}

.table tbody tr:hover {
    background-color: #f8f9fa;
}

.container {
    max-width: 1200px;
}

.alert {
    border-radius: 8px;
}

.badge {
    font-size: 0.75em;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .container {
        padding: 0 15px;
    }

    .card-body {
        padding: 1rem;
    }

    .table {
        font-size: 0.875rem;
    }
}

/* Utility Classes */
.text-purple {
    color: #6f42c1 !important;
}

.bg-purple {
    background-color: #6f42c1 !important;
}

/* ============================================================== */
/* BROWSER COMPATIBILITY & CROSS-ENGINE NORMALIZATION              */
/* Supports: Chrome, Edge, Safari, Firefox, Opera, Mobile WebKit    */
/* ============================================================== */

/* 1. Sticky positioning with WebKit prefix */
.sticky-top,
.table thead th,
.table th,
.sticky-checkbox,
.sticky-sn,
.sticky-action,
th.sticky-col-1,
th.sticky-col-2 {
    position: -webkit-sticky !important;
    position: sticky !important;
}

/* 2. Cross-browser scrollbars (Firefox & WebKit engines) */
* {
    scrollbar-width: thin;
    scrollbar-color: #94a3b8 #f1f5f9;
}

::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: #94a3b8;
    border-radius: 4px;
    border: 2px solid #f1f5f9;
}

::-webkit-scrollbar-thumb:hover {
    background: #64748b;
}

/* 3. Form input appearance and touch normalization */
input, select, textarea, button {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

select {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23343a40' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M2 5l6 6 6-6'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 16px 12px;
    padding-right: 2rem !important;
}

/* 4. Tap highlight & text-size adjust for mobile Safari / iOS / Android */
html {
    -webkit-text-size-adjust: 100%;
    -ms-text-size-adjust: 100%;
}

button, a {
    -webkit-tap-highlight-color: transparent;
}

/* 5. Backdrop filter vendor prefix for modern glassmorphism */
.modal-content,
.top-navbar,
.card-header {
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
}
