:root {
    --primary-color: #667eea;
    --secondary-color: #764ba2;
    --bottom-nav-height: 60px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    -webkit-text-size-adjust: 100%;
    -webkit-tap-highlight-color: transparent;
}

.sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    width: 250px;
    min-width: 250px;
    flex-shrink: 0;
}

.sidebar .nav-link {
    border-radius: 8px;
    margin-bottom: 4px;
    transition: background-color 0.2s;
}

.sidebar .nav-link[data-bs-toggle="collapse"] .bi-chevron-down,
.offcanvas .nav-link[data-bs-toggle="collapse"] .bi-chevron-down {
    transition: transform 0.2s;
}

.sidebar .nav-link[data-bs-toggle="collapse"].collapsed .bi-chevron-down,
.offcanvas .nav-link[data-bs-toggle="collapse"].collapsed .bi-chevron-down {
    transform: rotate(-90deg);
}

.sidebar .nav-link.active,
.offcanvas .nav-link.active {
    background-color: rgba(255, 255, 255, 0.15);
}

.sidebar .nav-link:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.hero {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
}

.card {
    border: none;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
    transition: box-shadow 0.2s;
}

.card:hover {
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.12);
}

.table th {
    font-weight: 600;
    background-color: #f8f9fa;
    border-bottom: 2px solid #dee2e6;
}

.btn {
    border-radius: 8px;
    font-weight: 500;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    border: none;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #5a6fd6, #6a4190);
}

.form-control, .form-select {
    border-radius: 8px;
    padding: 0.625rem 1rem;
}

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

.alert {
    border: none;
    border-radius: 12px;
}

.badge {
    font-weight: 500;
    padding: 0.5em 0.8em;
}

.modal-content {
    border: none;
    border-radius: 16px;
}

.modal-header {
    border-bottom: 1px solid #f0f0f0;
}

.modal-footer {
    border-top: 1px solid #f0f0f0;
}

.navbar-brand {
    font-weight: 700;
}

.stat-card {
    text-align: center;
    padding: 1rem;
}

.price-original {
    text-decoration: line-through;
    color: #999;
    font-size: 0.9em;
}

.price-discounted {
    color: #28a745;
    font-weight: bold;
}

.mobile-bottom-nav {
    display: none;
}

@media (max-width: 991.98px) {
    .sidebar {
        display: none !important;
    }

    .p-4 {
        padding: 1rem !important;
    }

    .p-3 {
        padding: 0.75rem !important;
    }

    h1, .h1 { font-size: 1.5rem; }
    h2, .h2 { font-size: 1.3rem; }
    h3, .h3 { font-size: 1.15rem; }
    h4, .h4 { font-size: 1.05rem; }

    .btn {
        min-height: 44px;
        min-width: 44px;
        padding: 0.5rem 1rem;
        font-size: 0.9rem;
    }

    .btn-sm {
        min-height: 38px;
        min-width: 38px;
        padding: 0.375rem 0.75rem;
        font-size: 0.8rem;
    }

    .btn-group .btn,
    .btn-group .btn-sm {
        min-width: auto;
    }

    .nav-link {
        min-height: 44px;
        display: flex;
        align-items: center;
    }

    .form-control, .form-select {
        font-size: 16px !important;
        min-height: 44px;
        padding: 0.5rem 0.75rem;
    }

    textarea.form-control {
        min-height: 80px;
    }

    .form-check-input {
        width: 1.25em;
        height: 1.25em;
    }

    .form-check-label {
        padding-left: 0.25rem;
        line-height: 1.5;
    }

    .table {
        font-size: 0.85rem;
    }

    .table th, .table td {
        padding: 0.5rem 0.4rem;
        white-space: nowrap;
    }

    .table .btn {
        min-height: 34px;
        min-width: 34px;
        padding: 0.25rem 0.5rem;
        font-size: 0.75rem;
    }

    .table .btn-sm {
        min-height: 30px;
        min-width: 30px;
        padding: 0.2rem 0.4rem;
    }

    .table-responsive {
        border-radius: 8px;
        -webkit-overflow-scrolling: touch;
    }

    .card {
        margin-bottom: 0.75rem;
    }

    .card-body {
        padding: 0.75rem;
    }

    .card-header {
        padding: 0.6rem 0.75rem;
    }

    .card-footer {
        padding: 0.6rem 0.75rem;
    }

    .modal-dialog {
        margin: 0;
        max-width: 100%;
        min-height: 100vh;
    }

    .modal-content {
        border-radius: 0;
        min-height: 100vh;
    }

    .modal-dialog-centered {
        min-height: 100vh;
        align-items: stretch;
    }

    .modal-dialog-centered .modal-content {
        min-height: auto;
        border-radius: 12px;
        margin: 1rem;
    }

    .modal-lg, .modal-xl {
        max-width: 100%;
    }

    .modal-body {
        padding: 1rem;
    }

    .modal-header {
        padding: 0.75rem 1rem;
    }

    .modal-footer {
        padding: 0.75rem 1rem;
    }

    .modal-footer .btn {
        flex: 1;
    }

    .stat-card {
        padding: 0.5rem;
    }

    .stat-card h2,
    .stat-card .h2 {
        font-size: 1.25rem;
    }

    .badge {
        font-size: 0.7em;
        padding: 0.35em 0.6em;
    }

    .alert {
        padding: 0.6rem 0.8rem;
        font-size: 0.9rem;
        border-radius: 8px;
    }

    .d-flex.gap-2 {
        gap: 0.35rem !important;
    }

    .row > [class*="col-"] {
        margin-bottom: 0.5rem;
    }

    .offcanvas {
        max-width: 85vw;
    }

    .dropdown-menu {
        font-size: 0.9rem;
    }

    .dropdown-item {
        padding: 0.5rem 1rem;
        min-height: 40px;
        display: flex;
        align-items: center;
    }

    .pagination .page-link {
        min-width: 40px;
        min-height: 40px;
        display: flex;
        align-items: center;
        justify-content: center;
        padding: 0.25rem 0.5rem;
        font-size: 0.85rem;
    }

    .mobile-bottom-nav {
        display: flex;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        height: var(--bottom-nav-height);
        background: #fff;
        border-top: 1px solid #dee2e6;
        z-index: 1050;
        box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
        justify-content: space-around;
        align-items: center;
        padding: 0 0.25rem;
        padding-bottom: env(safe-area-inset-bottom, 0);
    }

    .mobile-bottom-nav a {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        text-decoration: none;
        color: #6c757d;
        font-size: 0.65rem;
        padding: 0.25rem 0.5rem;
        border-radius: 8px;
        transition: color 0.2s;
        min-width: 0;
        flex: 1;
    }

    .mobile-bottom-nav a i {
        font-size: 1.25rem;
        margin-bottom: 2px;
    }

    .mobile-bottom-nav a.active,
    .mobile-bottom-nav a:hover {
        color: var(--primary-color);
    }

    .mobile-bottom-nav a.active {
        font-weight: 600;
    }

    .has-bottom-nav {
        padding-bottom: calc(var(--bottom-nav-height) + 10px) !important;
    }

    .container {
        padding-left: 0.75rem;
        padding-right: 0.75rem;
    }

    .mb-4 {
        margin-bottom: 1rem !important;
    }

    .mb-3 {
        margin-bottom: 0.75rem !important;
    }

    .flex-grow-1 > .p-4,
    .flex-grow-1 > div > .p-4 {
        padding: 0.75rem !important;
    }

    .input-group .form-control {
        min-width: 0;
    }

    .tab-content {
        padding: 0.5rem 0;
    }

    .nav-tabs .nav-link {
        padding: 0.5rem 0.75rem;
        font-size: 0.85rem;
    }

    .nav-pills .nav-link {
        padding: 0.5rem 0.75rem;
        font-size: 0.85rem;
    }

    .breadcrumb {
        font-size: 0.8rem;
        padding: 0.5rem 0;
    }

    .list-group-item {
        padding: 0.6rem 0.75rem;
    }
}

@media (max-width: 575.98px) {
    .p-4 {
        padding: 0.65rem !important;
    }

    h1, .h1 { font-size: 1.3rem; }
    h2, .h2 { font-size: 1.15rem; }
    h3, .h3 { font-size: 1.05rem; }

    .table {
        font-size: 0.8rem;
    }

    .table th, .table td {
        padding: 0.35rem 0.3rem;
    }

    .card-body {
        padding: 0.6rem;
    }

    .btn-group {
        flex-wrap: wrap;
        gap: 0.25rem;
    }

    .d-flex.justify-content-between {
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .d-flex.justify-content-between > * {
        flex-shrink: 1;
        min-width: 0;
    }

    .mobile-stack-xs {
        flex-direction: column !important;
    }

    .mobile-stack-xs > * {
        width: 100% !important;
    }

    .modal-dialog-centered .modal-content {
        margin: 0.5rem;
    }

    .pagination {
        flex-wrap: wrap;
        justify-content: center;
        gap: 0.15rem;
    }

    .pagination .page-link {
        min-width: 36px;
        min-height: 36px;
        font-size: 0.8rem;
    }
}

@media (hover: none) and (pointer: coarse) {
    .btn:active {
        transform: scale(0.97);
        transition: transform 0.1s;
    }

    .nav-link:active,
    .list-group-item:active,
    .dropdown-item:active {
        background-color: rgba(0, 0, 0, 0.05);
    }

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

    ::-webkit-scrollbar-thumb {
        background: rgba(0, 0, 0, 0.2);
        border-radius: 4px;
    }
}
