/* ==========================================
   LUBEK - ENHANCED STYLES FOR ALL PAGES
   Forms, Buttons, Tables & Interactive Elements
   ========================================== */

/* ==========================================
   ENHANCED FORM STYLES - ALL PAGES
   ========================================== */

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

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: #1e293b;
    font-size: 0.95rem;
}

/* Form Controls - Enhanced */
.form-control,
.form-select,
textarea.form-control {
    display: block;
    width: 100%;
    padding: 0.75rem 1rem;
    font-size: 1rem;
    font-weight: 400;
    line-height: 1.5;
    color: #1e293b;
    background-color: #ffffff;
    background-clip: padding-box;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.form-control:focus,
.form-select:focus,
textarea.form-control:focus {
    color: #1e293b;
    background-color: #ffffff;
    border-color: #0a2463;
    outline: 0;
    box-shadow: 0 0 0 3px rgba(10, 36, 99, 0.1), 0 1px 2px rgba(0, 0, 0, 0.05);
}

.form-control::placeholder {
    color: #64748b;
    opacity: 0.7;
}

.form-control:disabled,
.form-control[readonly] {
    background-color: #f1f5f9;
    opacity: 0.6;
    cursor: not-allowed;
}

/* Select Elements */
.form-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: 2.5rem;
}

/* Textarea */
textarea.form-control {
    min-height: 120px;
    resize: vertical;
}

/* Form Validation Styles */
.form-control.is-valid,
.form-select.is-valid {
    border-color: #10b981;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 8'%3e%3cpath fill='%2310b981' d='M2.3 6.73L.6 4.53c-.4-1.04.46-1.4 1.1-.8l1.1 1.4 3.4-3.8c.6-.63 1.6-.27 1.2.7l-4 4.6c-.43.5-.8.4-1.1.1z'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right calc(0.375em + 0.1875rem) center;
    background-size: calc(0.75em + 0.375rem) calc(0.75em + 0.375rem);
    padding-right: calc(1.5em + 0.75rem);
}

.form-control.is-invalid,
.form-select.is-invalid {
    border-color: #ef4444;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' width='12' height='12' fill='none' stroke='%23ef4444'%3e%3ccircle cx='6' cy='6' r='4.5'/%3e%3cpath stroke-linejoin='round' d='M5.8 3.6h.4L6 6.5z'/%3e%3ccircle cx='6' cy='8.2' r='.6' fill='%23ef4444' stroke='none'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right calc(0.375em + 0.1875rem) center;
    background-size: calc(0.75em + 0.375rem) calc(0.75em + 0.375rem);
    padding-right: calc(1.5em + 0.75rem);
}

.valid-feedback {
    display: none;
    width: 100%;
    margin-top: 0.25rem;
    font-size: 0.875rem;
    color: #10b981;
}

.invalid-feedback {
    display: none;
    width: 100%;
    margin-top: 0.25rem;
    font-size: 0.875rem;
    color: #ef4444;
}

.form-control.is-valid ~ .valid-feedback,
.form-control.is-invalid ~ .invalid-feedback {
    display: block;
}

/* Checkbox and Radio Styles */
.form-check {
    display: block;
    min-height: 1.5rem;
    padding-left: 1.75rem;
    margin-bottom: 0.5rem;
}

.form-check-input {
    width: 1.25rem;
    height: 1.25rem;
    margin-top: 0.125rem;
    margin-left: -1.75rem;
    vertical-align: top;
    background-color: #ffffff;
    background-repeat: no-repeat;
    background-position: center;
    background-size: contain;
    border: 2px solid #cbd5e0;
    appearance: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.form-check-input[type="checkbox"] {
    border-radius: 0.375rem;
}

.form-check-input[type="radio"] {
    border-radius: 50%;
}

.form-check-input:checked {
    background-color: #0a2463;
    border-color: #0a2463;
}

.form-check-input:checked[type="checkbox"] {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3e%3cpath fill='none' stroke='%23fff' stroke-linecap='round' stroke-linejoin='round' stroke-width='3' d='M6 10l3 3l6-6'/%3e%3c/svg%3e");
}

.form-check-input:checked[type="radio"] {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'%3e%3ccircle r='2' fill='%23fff'/%3e%3c/svg%3e");
}

.form-check-input:focus {
    border-color: #1e3a8a;
    outline: 0;
    box-shadow: 0 0 0 3px rgba(10, 36, 99, 0.1);
}

.form-check-label {
    color: #1e293b;
    cursor: pointer;
}

/* Input Groups */
.input-group:focus-within .input-group-text {
    border-color: #0a2463;
    background-color: #0a2463;
    color: #ffffff;
}

/* ==========================================
   ENHANCED TABLE STYLES
   ========================================== */

.table {
    width: 100%;
    margin-bottom: 1rem;
    color: #1e293b;
    vertical-align: top;
    border-color: #e2e8f0;
}

.table > :not(caption) > * > * {
    padding: 0.75rem 1rem;
    background-color: transparent;
    border-bottom-width: 1px;
    box-shadow: inset 0 0 0 9999px transparent;
}

.table > thead {
    vertical-align: bottom;
}

.table > thead > tr > th {
    font-weight: 700;
    color: #1e293b;
    background-color: #f8fafc;
    border-bottom: 2px solid #e2e8f0;
}

.table > tbody > tr:hover {
    background-color: #f8fafc;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.table-striped > tbody > tr:nth-of-type(odd) {
    background-color: rgba(0, 0, 0, 0.02);
}

.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

@media (max-width: 767.98px) {
    .table-responsive {
        width: 100%;
        overflow-x: auto;
        border: 1px solid #e2e8f0;
        border-radius: 12px;
    }
    
    .table {
        min-width: 600px;
    }
}

/* ==========================================
   ENHANCED BUTTON STYLES
   ========================================== */

/* Button Loading State */
.btn.loading {
    color: transparent;
    pointer-events: none;
    position: relative;
}

.btn.loading::after {
    content: "";
    position: absolute;
    width: 16px;
    height: 16px;
    top: 50%;
    left: 50%;
    margin-left: -8px;
    margin-top: -8px;
    border: 2px solid currentColor;
    border-radius: 50%;
    border-right-color: transparent;
    animation: button-loading-spinner 0.6s linear infinite;
}

@keyframes button-loading-spinner {
    from {
        transform: rotate(0turn);
    }
    to {
        transform: rotate(1turn);
    }
}

/* Button Variants - Enhanced */
.btn-secondary {
    background: #1e293b;
    border-color: #1e293b;
    color: #ffffff;
}

.btn-secondary:hover {
    background: #334155;
    border-color: #334155;
    color: #ffffff;
    box-shadow: 0 8px 20px rgba(30, 41, 59, 0.3);
}

.btn-success {
    background: #10b981;
    border-color: #10b981;
    color: #ffffff;
}

.btn-success:hover {
    background: #059669;
    border-color: #059669;
    color: #ffffff;
    box-shadow: 0 8px 20px rgba(16, 185, 129, 0.3);
}

.btn-danger {
    background: #ef4444;
    border-color: #ef4444;
    color: #ffffff;
}

.btn-danger:hover {
    background: #dc2626;
    border-color: #dc2626;
    color: #ffffff;
    box-shadow: 0 8px 20px rgba(239, 68, 68, 0.3);
}

.btn-warning {
    background: #f59e0b;
    border-color: #f59e0b;
    color: #ffffff;
}

.btn-warning:hover {
    background: #d97706;
    border-color: #d97706;
    color: #ffffff;
    box-shadow: 0 8px 20px rgba(245, 158, 11, 0.3);
}

.btn-info {
    background: #3b82f6;
    border-color: #3b82f6;
    color: #ffffff;
}

.btn-info:hover {
    background: #2563eb;
    border-color: #2563eb;
    color: #ffffff;
    box-shadow: 0 8px 20px rgba(59, 130, 246, 0.3);
}

.btn-light {
    background: #f8fafc;
    border-color: #e2e8f0;
    color: #1e293b;
}

.btn-light:hover {
    background: #e2e8f0;
    border-color: #cbd5e0;
}

.btn-dark {
    background: #0f172a;
    border-color: #0f172a;
    color: #ffffff;
}

.btn-dark:hover {
    background: #0f172a;
    border-color: #0f172a;
    color: #ffffff;
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.3);
}

/* Button Sizes */
.btn-sm {
    padding: 0.375rem 0.875rem;
    font-size: 0.875rem;
    border-radius: 10px;
}

.btn-lg {
    padding: 0.875rem 2rem;
    font-size: 1.125rem;
    border-radius: 14px;
}

/* Button Block */
.btn-block {
    display: block;
    width: 100%;
}

/* ==========================================
   LOADING SPINNER
   ========================================== */

.spinner {
    display: inline-block;
    width: 1rem;
    height: 1rem;
    vertical-align: text-bottom;
    border: 0.15em solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: spinner-border 0.75s linear infinite;
}

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

.spinner-lg {
    width: 2rem;
    height: 2rem;
    border-width: 0.2em;
}

/* ==========================================
   ALERTS & TOASTS
   ========================================== */

.alert {
    position: relative;
    padding: 1rem 1.25rem;
    margin-bottom: 1rem;
    border: 2px solid transparent;
    border-radius: 12px;
    font-weight: 500;
}

.alert-success {
    color: #065f46;
    background-color: #d1fae5;
    border-color: #10b981;
}

.alert-danger {
    color: #991b1b;
    background-color: #fee2e2;
    border-color: #ef4444;
}

.alert-warning {
    color: #92400e;
    background-color: #fef3c7;
    border-color: #f59e0b;
}

.alert-info {
    color: #1e3a8a;
    background-color: #dbeafe;
    border-color: #3b82f6;
}

.alert-dismissible {
    padding-right: 3rem;
}

.alert-dismissible .btn-close {
    position: absolute;
    top: 0;
    right: 0;
    z-index: 2;
    padding: 1.25rem 1rem;
}

/* ==========================================
   BADGES
   ========================================== */

.badge {
    display: inline-block;
    padding: 0.35em 0.65em;
    font-size: 0.85em;
    font-weight: 700;
    line-height: 1;
    color: #ffffff;
    text-align: center;
    white-space: nowrap;
    vertical-align: baseline;
    border-radius: 0.375rem;
}

.badge-primary {
    background-color: #0a2463;
}

.badge-secondary {
    background-color: #1e293b;
}

.badge-success {
    background-color: #10b981;
}

.badge-danger {
    background-color: #ef4444;
}

.badge-warning {
    background-color: #f59e0b;
}

.badge-info {
    background-color: #3b82f6;
}

.badge-light {
    background-color: #f1f5f9;
    color: #1e293b;
}

.badge-dark {
    background-color: #0f172a;
}

/* ==========================================
   PAGINATION
   ========================================== */

.pagination {
    display: flex;
    padding-left: 0;
    list-style: none;
    border-radius: 12px;
}

.page-link {
    position: relative;
    display: block;
    padding: 0.5rem 0.75rem;
    margin-left: -1px;
    line-height: 1.25;
    color: #0a2463;
    background-color: #ffffff;
    border: 1px solid #e2e8f0;
    text-decoration: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.page-link:hover {
    z-index: 2;
    color: #1e3a8a;
    background-color: #f8fafc;
    border-color: #e2e8f0;
}

.page-link:focus {
    z-index: 3;
    outline: 0;
    box-shadow: 0 0 0 3px rgba(10, 36, 99, 0.1);
}

.page-item:first-child .page-link {
    margin-left: 0;
    border-top-left-radius: 12px;
    border-bottom-left-radius: 12px;
}

.page-item:last-child .page-link {
    border-top-right-radius: 12px;
    border-bottom-right-radius: 12px;
}

.page-item.active .page-link {
    z-index: 3;
    color: #ffffff;
    background-color: #0a2463;
    border-color: #0a2463;
}

.page-item.disabled .page-link {
    color: #64748b;
    pointer-events: none;
    background-color: #ffffff;
    border-color: #e2e8f0;
}

/* ==========================================
   BREADCRUMBS
   ========================================== */

.breadcrumb {
    display: flex;
    flex-wrap: wrap;
    padding: 0.75rem 1rem;
    margin-bottom: 1rem;
    list-style: none;
    background-color: #f8fafc;
    border-radius: 12px;
}

.breadcrumb-item + .breadcrumb-item {
    padding-left: 0.5rem;
}

.breadcrumb-item + .breadcrumb-item::before {
    display: inline-block;
    padding-right: 0.5rem;
    color: #64748b;
    content: "/";
}

.breadcrumb-item.active {
    color: #475569;
}

/* ==========================================
   MODALS - ENHANCED
   ========================================== */

.modal-content {
    border-radius: 20px;
    border: none;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.modal-header {
    border-bottom: 2px solid #f1f5f9;
    padding: 1.5rem;
    background: linear-gradient(135deg, #0a2463 0%, #1e3a8a 100%);
    color: #ffffff;
    border-top-left-radius: 20px;
    border-top-right-radius: 20px;
}

.modal-header .modal-title {
    color: #ffffff;
    font-weight: 700;
}

.modal-header .btn-close {
    filter: brightness(0) invert(1);
    opacity: 0.8;
}

.modal-header .btn-close:hover {
    opacity: 1;
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    border-top: 2px solid #f1f5f9;
    padding: 1rem 1.5rem;
    background-color: #f8fafc;
    border-bottom-left-radius: 20px;
    border-bottom-right-radius: 20px;
}

/* ==========================================
   TOOLTIPS
   ========================================== */

.tooltip {
    position: absolute;
    z-index: 1070;
    display: block;
    margin: 0;
    font-size: 0.875rem;
    word-wrap: break-word;
    opacity: 0.9;
}

.tooltip-inner {
    max-width: 200px;
    padding: 0.5rem 0.75rem;
    color: #ffffff;
    text-align: center;
    background-color: #0f172a;
    border-radius: 12px;
}

/* ==========================================
   PROGRESS BARS
   ========================================== */

.progress {
    display: flex;
    height: 1rem;
    overflow: hidden;
    font-size: 0.75rem;
    background-color: #f1f5f9;
    border-radius: 12px;
}

.progress-bar {
    display: flex;
    flex-direction: column;
    justify-content: center;
    overflow: hidden;
    color: #ffffff;
    text-align: center;
    white-space: nowrap;
    background-color: #0a2463;
    transition: width 0.6s ease;
}

.progress-bar-striped {
    background-image: linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);
    background-size: 1rem 1rem;
}

.progress-bar-animated {
    animation: progress-bar-stripes 1s linear infinite;
}

@keyframes progress-bar-stripes {
    0% {
        background-position: 1rem 0;
    }
    100% {
        background-position: 0 0;
    }
}

/* ==========================================
   RESPONSIVE UTILITIES
   ========================================== */

/* Mobile optimizations */
@media (max-width: 575.98px) {
    .form-control,
    .form-select,
    .btn {
        font-size: 16px; /* Prevents zoom on iOS */
    }
    
    .modal-dialog {
        margin: 0.5rem;
    }
    
    .table {
        font-size: 0.875rem;
    }
}

/* Tablet optimizations */
@media (min-width: 576px) and (max-width: 991.98px) {
    .modal-lg {
        max-width: 800px;
    }
}

/* Desktop optimizations */
@media (min-width: 992px) {
    .modal-xl {
        max-width: 1140px;
    }
}

/* ==========================================
   SECTION TITLE BACKGROUNDS - REMOVE ALL
   ========================================== */

/* Ensure section titles and their containers have NO backgrounds */
.section-title,
h2.section-title,
h1.section-title,
.text-center .section-title,
.col-12 .section-title,
section .section-title,
.categories-section .section-title,
.facility-section .section-title,
.about-section .section-title,
.distributor-section .section-title {
    background: none !important;
    background-color: transparent !important;
    box-shadow: none !important;
}

/* Remove backgrounds from ALL title wrapper containers */
.text-center.mb-5,
.text-center.mb-4,
.text-center.mb-3,
.col-12.text-center,
.col-12.text-center.mb-5,
.col-12.text-center.mb-4,
section .row .col-12,
section .row .col-12.text-center,
section .container > .row > .col-12,
section .container .row .col-12.text-center {
    background: transparent !important;
    background-color: transparent !important;
}

/* Section subtitles should also have no background */
.section-subtitle,
p.section-subtitle {
    background: none !important;
    background-color: transparent !important;
}

/* Ensure ALL headings inside sections have no background */
section h1,
section h2,
section h3,
section h4,
.categories-section h2,
.facility-section h2,
.about-section h2,
.distributor-section h2,
.products-section h2,
.contact-section h2 {
    background: none !important;
    background-color: transparent !important;
    box-shadow: none !important;
}

/* Remove any box or border that might appear as background */
.section-title::before,
.section-title::after {
    background-color: transparent !important;
}

/* Override Bootstrap row and col defaults */
.container .row,
.container-fluid .row,
section .row {
    background: transparent !important;
}

.row > .col-12,
.row > .col-lg-12,
.row > .col-md-12,
.row > .col-sm-12 {
    background: transparent !important;
}

/* Override any div backgrounds inside sections */
section > .container,
section > .container-fluid,
section .container > div,
section .container-fluid > div {
    background: transparent !important;
}

/* Specifically target homepage section wrappers */
.categories-section .container,
.categories-section .row,
.categories-section .col-12,
.facility-section .container,
.facility-section .row,
.about-section .container,
.about-section .row,
.distributor-section .container,
.distributor-section .row {
    background: transparent !important;
    background-color: transparent !important;
}

/* ==========================================
   ACCESSIBILITY IMPROVEMENTS
   ========================================== */

/* Focus visible for keyboard navigation */
*:focus-visible {
    outline: 2px solid #0a2463;
    outline-offset: 2px;
}

/* Skip link for screen readers */
.skip-link {
    position: absolute;
    top: -40px;
    left: 0;
    background: #0a2463;
    color: white;
    padding: 8px;
    text-decoration: none;
    z-index: 100;
}

.skip-link:focus {
    top: 0;
}

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

/* Reduced motion for users who prefer it */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* ==========================================
   PRINT STYLES
   ========================================== */

@media print {
    /* Hide non-essential elements */
    .navbar,
    .footer,
    .btn,
    .form-control,
    .alert,
    .modal,
    .tooltip {
        display: none !important;
    }
    
    /* Optimize colors for printing */
    * {
        color: #000 !important;
        background: #fff !important;
        box-shadow: none !important;
    }
    
    /* Show links */
    a[href]:after {
        content: " (" attr(href) ")";
    }
    
    /* Page breaks */
    h1, h2, h3 {
        page-break-after: avoid;
    }
    
    img {
        page-break-inside: avoid;
    }
}

