/* Microsoft Fluent Design System inspired styles */
:root {
    --primary-color: #0078d4;
    --secondary-color: #005a9e;
    --accent-color: #50e6ff;
    --text-primary: #323130;
    --text-secondary: #605e5c;
    --text-tertiary: #8a8886;
    --bg-primary: #ffffff;
    --bg-secondary: #faf9f8;
    --bg-tertiary: #f3f2f1;
    --border-color: #edebe9;
    --shadow-sm: 0 1.6px 3.6px 0 rgba(0, 0, 0, 0.132), 0 0.3px 0.9px 0 rgba(0, 0, 0, 0.108);
    --shadow-md: 0 3.2px 7.2px 0 rgba(0, 0, 0, 0.132), 0 0.6px 1.8px 0 rgba(0, 0, 0, 0.108);
    --shadow-lg: 0 6.4px 14.4px 0 rgba(0, 0, 0, 0.132), 0 1.2px 3.6px 0 rgba(0, 0, 0, 0.108);
}

html {
    font-size: 14px;
    scroll-behavior: smooth;
}

@media (min-width: 768px) {
    html {
        font-size: 16px;
    }
}

body {
    margin: 0;
    font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, 'Roboto', 'Helvetica Neue', sans-serif;
    font-size: 14px;
    line-height: 1.5;
    color: var(--text-primary);
    background-color: var(--bg-secondary);
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    color: var(--text-primary);
    margin-top: 0;
    margin-bottom: 0.75rem;
}

h1 { font-size: 2rem; line-height: 2.5rem; }
h2 { font-size: 1.75rem; line-height: 2.25rem; }
h3 { font-size: 1.5rem; line-height: 2rem; }
h4 { font-size: 1.25rem; line-height: 1.75rem; }
h5 { font-size: 1.125rem; line-height: 1.5rem; }
h6 { font-size: 1rem; line-height: 1.5rem; }

/* Mobile Typography Adjustments */
@media (max-width: 767.98px) {
    h1 { font-size: 1.5rem; line-height: 2rem; }
    h2 { font-size: 1.375rem; line-height: 1.875rem; }
    h3 { font-size: 1.25rem; line-height: 1.75rem; }
    h4 { font-size: 1.125rem; line-height: 1.5rem; }
}

.fw-semibold { font-weight: 600; }

/* Navigation */
.navbar {
    padding: 0.5rem 0;
    background-color: var(--bg-primary);
}

.navbar-brand {
    font-size: 1.25rem;
    color: var(--text-primary);
    font-weight: 600;
}

/* Mobile Navigation Improvements */
@media (max-width: 991.98px) {
    .navbar-brand {
        font-size: 1rem;
    }
    
    .navbar-brand .small {
        display: none; /* Hide "Ladies Tailoring" subtitle on mobile */
    }
    
    .navbar-collapse {
        background-color: var(--bg-primary);
        padding: 1rem 0;
        margin: 0 -1rem;
        padding-left: 1rem;
        padding-right: 1rem;
        box-shadow: var(--shadow-md);
    }
    
    .navbar-nav .nav-link {
        padding: 0.75rem 1rem;
        border-bottom: 1px solid var(--border-color);
    }
    
    .navbar-nav .dropdown-menu {
        border: none;
        box-shadow: none;
        padding-left: 1rem;
        margin-top: 0;
        background-color: var(--bg-tertiary);
        position: static !important;
        transform: none !important;
        border-radius: 0;
    }
    
    .navbar-nav .dropdown-item {
        padding: 0.5rem 1rem;
        border-bottom: 1px solid var(--border-color);
    }
    
    .navbar-nav .dropdown-item:last-child {
        border-bottom: none;
    }
    
    /* Ensure dropdown is visible when open */
    .navbar-nav .dropdown-menu.show {
        display: block;
        animation: slideDown 0.2s ease-out;
    }
    
    @keyframes slideDown {
        from {
            opacity: 0;
            max-height: 0;
        }
        to {
            opacity: 1;
            max-height: 500px;
        }
    }
    
    /* Dropdown toggle arrow */
    .navbar-nav .dropdown-toggle::after {
        transition: transform 0.2s ease;
    }
    
    .navbar-nav .dropdown-toggle[aria-expanded="true"]::after {
        transform: rotate(180deg);
    }
}
.navbar-light .navbar-nav .nav-link {
    color: var(--text-secondary);
    padding: 0.5rem 1rem;
    font-weight: 400;
    transition: color 0.15s ease-in-out;
}

.navbar-light .navbar-nav .nav-link:hover {
    color: var(--primary-color);
}

.navbar .dropdown-menu {
    border: none;
    box-shadow: var(--shadow-md);
    border-radius: 4px;
    padding: 0.5rem 0;
    margin-top: 0.5rem;
}

.dropdown-item {
    padding: 0.5rem 1.5rem;
    font-size: 14px;
    color: var(--text-primary);
    transition: background-color 0.15s ease-in-out;
}

.dropdown-item:hover {
    background-color: var(--bg-tertiary);
    color: var(--text-primary);
}

.dropdown-header {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
    padding: 0.5rem 1.5rem 0.25rem;
}

/* Cards */
.card {
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background-color: var(--bg-primary);
    box-shadow: var(--shadow-sm);
    margin-bottom: 1.5rem;
}

.card-header {
    background-color: var(--bg-primary);
    border-bottom: 1px solid var(--border-color);
    padding: 1rem 1.5rem;
    font-weight: 600;
    font-size: 1rem;
}

.card-body {
    padding: 1.5rem;
}

/* Mobile Card Adjustments */
@media (max-width: 767.98px) {
    .card-body {
        padding: 1rem;
    }
    
    .card-header {
        padding: 0.75rem 1rem;
        font-size: 0.95rem;
    }
}

/* Tables */
.table {
    margin-bottom: 0;
    color: var(--text-primary);
}

.table thead th {
    border-bottom: 2px solid var(--border-color);
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    padding: 0.75rem 1rem;
}

.table tbody td {
    padding: 0.875rem 1rem;
    vertical-align: middle;
    border-bottom: 1px solid var(--border-color);
}

.table-hover tbody tr:hover {
    background-color: var(--bg-tertiary);
}

/* Mobile Table Improvements */
@media (max-width: 767.98px) {
    .table thead th,
    .table tbody td {
        padding: 0.5rem;
        font-size: 0.875rem;
    }
    
    .table thead th {
        font-size: 0.7rem;
    }
    
    /* Make table responsive with horizontal scroll */
    .table-responsive {
        -webkit-overflow-scrolling: touch;
        border-radius: 4px;
    }
    
    /* Stack table data for mobile - card view */
    .mobile-stack-table thead {
        display: none;
    }
    
    .mobile-stack-table tbody tr {
        display: block;
        margin-bottom: 1rem;
        border: 1px solid var(--border-color);
        border-radius: 4px;
        background-color: var(--bg-primary);
        box-shadow: var(--shadow-sm);
    }
    
    .mobile-stack-table tbody td {
        display: flex;
        justify-content: space-between;
        padding: 0.75rem 1rem;
        border: none;
        border-bottom: 1px solid var(--border-color);
    }
    
    .mobile-stack-table tbody td:last-child {
        border-bottom: none;
    }
    
    .mobile-stack-table tbody td::before {
        content: attr(data-label);
        font-weight: 600;
        color: var(--text-secondary);
        margin-right: 1rem;
    }
}

/* Buttons */
.btn {
    padding: 0.5rem 1.25rem;
    font-size: 14px;
    font-weight: 600;
    border-radius: 4px;
    border: none;
    transition: all 0.15s ease-in-out;
    touch-action: manipulation; /* Improve touch responsiveness */
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background-color: var(--secondary-color);
}

.btn-secondary {
    background-color: var(--bg-tertiary);
    color: var(--text-primary);
}

.btn-secondary:hover {
    background-color: var(--border-color);
}

.btn-outline-secondary {
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    background-color: transparent;
}

.btn-outline-secondary:hover {
    background-color: var(--bg-tertiary);
    color: var(--text-primary);
    border-color: var(--border-color);
}

.btn-sm {
    padding: 0.375rem 0.875rem;
    font-size: 13px;
}

.btn-lg {
    padding: 0.75rem 1.75rem;
    font-size: 15px;
}

/* Mobile Button Adjustments */
@media (max-width: 767.98px) {
    .btn {
        padding: 0.625rem 1rem;
        font-size: 0.875rem;
        min-height: 44px; /* iOS touch target size */
    }
    
    .btn-sm {
        padding: 0.5rem 0.75rem;
        font-size: 0.8125rem;
        min-height: 38px;
    }
    
    .btn-group {
        flex-wrap: wrap;
        gap: 0.25rem;
    }
    
    .btn-group .btn {
        margin-bottom: 0.25rem;
    }
    
    /* Make full-width buttons on mobile when needed */
    .btn-mobile-block {
        display: block;
        width: 100%;
        margin-bottom: 0.5rem;
    }
    
    /* Stack button groups vertically on mobile */
    .btn-group-vertical-mobile {
        flex-direction: column;
    }
    
    .btn-group-vertical-mobile .btn {
        width: 100%;
    }
}

/* Forms */
.form-control {
    border: 1px solid var(--border-color);
    border-radius: 2px;
    padding: 0.5rem 0.75rem;
    font-size: 14px;
    color: var(--text-primary);
    background-color: var(--bg-primary);
    transition: border-color 0.15s ease-in-out;
}

.form-control:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 1px var(--primary-color);
    outline: none;
}

.form-select {
    border: 1px solid var(--border-color);
    border-radius: 2px;
    padding: 0.5rem 2rem 0.5rem 0.75rem;
    font-size: 14px;
    color: var(--text-primary);
}

.form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 1px var(--primary-color);
}

.form-label {
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
    font-size: 14px;
}

.input-group-text {
    background-color: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    font-size: 14px;
}

/* Mobile Form Improvements */
@media (max-width: 767.98px) {
    .form-control,
    .form-select {
        font-size: 16px; /* Prevent zoom on iOS */
        min-height: 44px; /* iOS touch target size */
    }
    
    .form-label {
        font-size: 0.875rem;
    }
    
    /* Stack form columns on mobile */
    .row.g-3 > [class*="col-"] {
        margin-bottom: 1rem;
    }
}

/* Badges */
.badge {
    padding: 0.375rem 0.625rem;
    font-size: 12px;
    font-weight: 600;
    border-radius: 2px;
}

/* Mobile Badge Adjustments */
@media (max-width: 767.98px) {
    .badge {
        padding: 0.3rem 0.5rem;
        font-size: 0.75rem;
    }
}

/* Shadows */
.shadow-sm {
    box-shadow: var(--shadow-sm) !important;
}

.shadow {
    box-shadow: var(--shadow-md) !important;
}

.shadow-lg {
    box-shadow: var(--shadow-lg) !important;
}

/* Borders */
.border {
    border: 1px solid var(--border-color) !important;
}

.border-top, .border-bottom {
    border-color: var(--border-color) !important;
}

/* Backgrounds */
.bg-light {
    background-color: var(--bg-tertiary) !important;
}

/* Text colors */
.text-muted {
    color: var(--text-tertiary) !important;
}

.text-secondary {
    color: var(--text-secondary) !important;
}

/* Alerts */
.alert {
    border-radius: 4px;
    border: 1px solid transparent;
    padding: 1rem 1.5rem;
}

.alert-info {
    background-color: #f3f2ff;
    border-color: #d1d1ff;
    color: #323130;
}

.alert-success {
    background-color: #f1faf1;
    border-color: #c8e6c9;
    color: #323130;
}

.alert-warning {
    background-color: #fff4e5;
    border-color: #ffe0b2;
    color: #323130;
}

.alert-danger {
    background-color: #fef2f2;
    border-color: #fecaca;
    color: #323130;
}

/* Mobile Alert Adjustments */
@media (max-width: 767.98px) {
    .alert {
        padding: 0.75rem 1rem;
        font-size: 0.875rem;
    }
}

/* Search and Filter Bar */
.filter-bar {
    background-color: var(--bg-primary);
    border-bottom: 1px solid var(--border-color);
    padding: 1rem 0;
    margin-bottom: 1.5rem;
}

/* Mobile-Specific Utility Classes */
@media (max-width: 767.98px) {
    /* Container padding adjustments */
    .container-fluid {
        padding-left: 0.75rem !important;
        padding-right: 0.75rem !important;
    }
    
    /* Hide elements on mobile */
    .mobile-hide {
        display: none !important;
    }
    
    /* Show only on mobile */
    .mobile-only {
        display: block !important;
    }
    
    /* Reduce spacing on mobile */
    .mb-3, .my-3 {
        margin-bottom: 1rem !important;
    }
    
    .mb-4, .my-4 {
        margin-bottom: 1.5rem !important;
    }
    
    /* Action buttons spacing */
    .d-flex.justify-content-between {
        flex-wrap: wrap;
        gap: 0.5rem;
    }
    
    .d-flex.justify-content-between > * {
        flex-shrink: 0;
    }
    
    /* Search input full width on mobile */
    form[role="search"] {
        width: 100%;
        margin-bottom: 0.5rem;
    }
    
    form[role="search"] .form-control {
        width: 100%;
    }
}

@media (min-width: 768px) {
    .mobile-only {
        display: none !important;
    }
}

/* Touch-friendly improvements */
@media (hover: none) and (pointer: coarse) {
    /* Increase clickable areas for touch devices */
    a, button, .btn, .nav-link, .dropdown-item {
        min-height: 44px;
        display: inline-flex;
        align-items: center;
    }
    
    /* Improve dropdown touch targets */
    .dropdown-menu {
        min-width: 200px;
    }
    
    .dropdown-item {
        padding: 0.75rem 1.5rem;
    }
}

/* Pagination Mobile Improvements */
@media (max-width: 767.98px) {
    .pagination {
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .pagination .page-item {
        margin: 0.125rem;
    }
    
    .pagination .page-link {
        padding: 0.375rem 0.625rem;
        font-size: 0.875rem;
        min-width: 38px;
        min-height: 38px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
}

/* Modal Mobile Improvements */
@media (max-width: 767.98px) {
    .modal-dialog {
        margin: 0.5rem;
    }
    
    .modal-content {
        border-radius: 8px;
    }
    
    .modal-header,
    .modal-footer {
        padding: 0.75rem 1rem;
    }
    
    .modal-body {
        padding: 1rem;
    }
}

/* Responsive Tables - Alternative approach */
@media (max-width: 991.98px) {
    /* Hide less important columns on tablets */
    .table th.tablet-hide,
    .table td.tablet-hide {
        display: none;
    }
}

/* Fixed positioning for mobile */
@media (max-width: 767.98px) {
    /* Sticky headers on mobile */
    .sticky-mobile-header {
        position: sticky;
        top: 0;
        z-index: 1000;
        background-color: var(--bg-primary);
        box-shadow: var(--shadow-sm);
    }
}

/* Bengali Font Support */
.bengali-text, 
[lang="bn"],
.card-body[style*="Noto Sans Bengali"] {
    font-family: 'Noto Sans Bengali', 'SolaimanLipi', Arial, sans-serif !important;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

/* Ensure UTF-8 rendering */
body {
    unicode-bidi: embed;
}

/* Accessibility improvements for mobile */
@media (max-width: 767.98px) {
    /* Ensure focus is visible on touch devices */
    *:focus-visible {
        outline: 2px solid var(--primary-color);
        outline-offset: 2px;
    }
    
    /* Improve select dropdown on mobile */
    select.form-select {
        appearance: auto;
        -webkit-appearance: menulist;
    }
}

/* Loading states for better UX on mobile */
.loading {
    opacity: 0.6;
    pointer-events: none;
    position: relative;
}

.loading::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid var(--primary-color);
    border-top-color: transparent;
    border-radius: 50%;
    animation: spinner 0.6s linear infinite;
}

@keyframes spinner {
    to { transform: rotate(360deg); }
}