/* General Styles */
body {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

main {
    flex: 1;
}

/* DataTables Responsive Styles */
.dataTables_wrapper {
    padding: 1rem 0;
}

.dtr-details {
    width: 100%;
}

/* Card Styles */
.card {
    margin-bottom: 1.5rem;
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
}

.card-header {
    background-color: #f8f9fa;
    border-bottom: 1px solid rgba(0, 0, 0, 0.125);
}

/* Form Styles */
.form-group {
    margin-bottom: 1rem;
}

/* Dashboard Stats */
.stats-card {
    transition: transform 0.2s;
}

.stats-card:hover {
    transform: translateY(-5px);
}

.stats-icon {
    font-size: 2rem;
    opacity: 0.7;
}

/* Responsive Adjustments */
@media (max-width: 768px) {
    .container-fluid {
        padding-left: 0.5rem;
        padding-right: 0.5rem;
    }
    
    .card {
        margin-bottom: 1rem;
    }
    
    .btn-group {
        display: flex;
        flex-direction: column;
    }
    
    .btn-group .btn {
        margin-bottom: 0.5rem;
        border-radius: 0.25rem !important;
    }
    
    .dataTables_wrapper .dataTables_length,
    .dataTables_wrapper .dataTables_filter {
        text-align: left;
        margin-bottom: 1rem;
    }
}

/* Print Styles */
@media print {
    .navbar,
    .footer,
    .no-print {
        display: none !important;
    }
    
    .container-fluid {
        padding: 0;
        margin: 0;
    }
    
    .card {
        border: none;
        box-shadow: none;
    }
    
    .table {
        width: 100% !important;
    }
}

/* Utility Classes */
.cursor-pointer {
    cursor: pointer;
}

.text-truncate-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Modal Adjustments */
.modal-header {
    background-color: #f8f9fa;
}

.modal-footer {
    background-color: #f8f9fa;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* Remove any dark borders from table containers */
.table-responsive,
.card > .table-responsive,
.card-body .table {
    border: none !important;
    box-shadow: none !important;
}

/* Remove dark bottom borders from all table rows */
.table tbody tr td,
.table tbody tr:last-child td,
.table tbody tr:last-child th {
    border-bottom: none !important;
}

/* Override Bootstrap table bordered styles */
.table-bordered tbody tr:last-child td,
.table-bordered tbody tr:last-child th {
    border-bottom: none !important;
}

/* Remove box shadow from avatar icons in tables - ALL SCREENS */
.table .avatar-circle,
.table .bi-person-circle,
.table .bi-person,
.table .bi-people,
.table .bi-people-fill,
.table td i.bi-person-circle,
.table td i.bi-person,
.table td .d-flex.align-items-center i,
.table td .avatar-circle i,
.table td [class*="person"] {
    box-shadow: none !important;
    background: transparent !important;
}

/* Target parent containers that might have shadows - ALL SCREENS */
.table td .d-flex.align-items-center,
.table td .avatar-circle,
.table td .rounded-circle,
.table td div:has(> i.bi-person-circle),
.table td div:has(> i.bi-person) {
    box-shadow: none !important;
    background: transparent !important;
    border: none !important;
}

/* --- Tenants Page Custom Styles --- */
.tenants-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.tenants-header h4 {
    font-weight: 600;
    letter-spacing: 0.5px;
}

.tenants-table {
    background: #fff;
    border-radius: 0.5rem;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}

.tenants-table th {
    background: #f4f6fa;
    font-weight: 600;
    letter-spacing: 0.03em;
    border-bottom: 2px solid #e9ecef;
}

.tenants-table td {
    vertical-align: middle;
    border-bottom: 1px solid #f1f1f1;
    padding-top: 0.85rem;
    padding-bottom: 0.85rem;
}

.tenants-table tr:hover {
    background: #f8fafc;
    transition: background 0.2s;
}

.tenants-actions .btn {
    min-width: 36px;
    min-height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    margin-right: 0.25rem;
    border-radius: 50% !important;
    transition: background 0.15s, color 0.15s;
}

.tenants-actions .btn:last-child {
    margin-right: 0;
}

.tenants-actions .btn-outline-primary:hover {
    background: #e7f1ff;
    color: #0d6efd;
}

.tenants-actions .btn-outline-danger:hover {
    background: #ffe7e7;
    color: #dc3545;
}

@media (max-width: 576px) {
    .tenants-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
    .tenants-table th, .tenants-table td {
        font-size: 0.7rem;
        padding: 0.35rem 0.3rem;
    }
    .tenants-table th {
        font-size: 0.65rem;
        letter-spacing: 0.2px;
        font-weight: 600;
    }
}

/* Mobile Table Responsiveness - Global */
@media (max-width: 768px) {
    /* Make all tables horizontally scrollable on mobile */
    .table-responsive-sm,
    .table-responsive,
    .card > .table-responsive,
    div[class*="table-responsive"] {
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch !important;
        display: block !important;
        width: 100% !important;
        max-width: 100vw !important;
        border: none !important;
        box-shadow: none !important;
    }

    /* Remove bottom borders from tables */
    .table-responsive .table,
    .table-responsive table,
    .card-body .table,
    .card-body table {
        border-bottom: none !important;
    }

    .table-responsive .table tbody tr:last-child td,
    .card-body .table tbody tr:last-child td {
        border-bottom: none !important;
    }

    /* Force card-body to allow scrolling when it contains tables */
    .card-body {
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch !important;
        padding: 0.5rem !important;
    }

    /* Ensure tables within cards can scroll */
    .card-body .table,
    .card-body table,
    .table-responsive .table,
    .table-responsive table,
    .table-responsive-sm .table,
    .table-responsive-sm table {
        min-width: 650px !important;
        width: 100% !important;
        margin-bottom: 0 !important;
        table-layout: auto !important;
    }

    /* Reduce font sizes globally on mobile */
    body {
        font-size: 0.875rem;
    }

    h1, .h1 {
        font-size: 1.5rem;
    }

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

    h3, .h3 {
        font-size: 1.1rem;
    }

    h4, .h4 {
        font-size: 1rem;
    }

    h5, .h5 {
        font-size: 0.9rem;
    }

    .card-title {
        font-size: 0.95rem;
    }

    /* Table cell padding reduction - stronger selectors for headers */
    .table > tbody > tr > td,
    .table > thead > tr > th,
    .table th,
    .table td {
        padding: 0.5rem 0.5rem !important;
        font-size: 0.85rem !important;
        white-space: nowrap !important;
    }

    .table > thead > tr > th,
    .table thead th,
    .table th {
        font-size: 0.8rem !important;
        letter-spacing: 0.3px !important;
        font-weight: 600 !important;
        text-transform: uppercase !important;
        text-align: center !important;
        vertical-align: middle !important;
    }

    /* Badge and button size reduction */
    .badge {
        font-size: 0.7rem;
        padding: 0.3em 0.5em;
    }

    .btn-sm {
        padding: 0.25rem 0.4rem;
        font-size: 0.75rem;
    }

    /* DataTables mobile adjustments */
    .dataTables_wrapper {
        font-size: 0.8rem;
    }

    .dataTables_wrapper .dataTables_info,
    .dataTables_wrapper .dataTables_paginate {
        font-size: 0.75rem;
    }

    .dataTables_wrapper .dataTables_paginate .paginate_button {
        padding: 0.25rem 0.5rem;
        font-size: 0.75rem;
    }

    /* Form elements reduction */
    .form-control,
    .form-select {
        font-size: 0.85rem;
    }

    .form-label {
        font-size: 0.8rem;
        margin-bottom: 0.25rem;
    }

    /* Navigation text reduction */
    .nav-link {
        font-size: 0.85rem;
    }

    .nav-link i {
        font-size: 1rem;
    }

    /* Stats cards text reduction */
    .stat-card h2 {
        font-size: 1.25rem;
    }

    .stat-card .card-title {
        font-size: 0.8rem;
    }

    /* Ensure horizontal scroll is visible */
    .table-responsive::-webkit-scrollbar {
        height: 6px;
    }

    .table-responsive::-webkit-scrollbar-thumb {
        background-color: #888;
        border-radius: 3px;
    }

    /* Card body padding reduction for mobile */
    .card-body {
        padding: 0.75rem;
    }

    .card-header {
        padding: 0.75rem;
    }

    /* Tenant table specific - reduce avatars */
    .tenants-table .rounded-circle {
        width: 28px;
        height: 28px;
        font-size: 0.7rem;
    }

    /* Remove box shadow from avatar icons in tables */
    .table .avatar-circle,
    .table .bi-person-circle,
    .table .bi-person,
    .table .bi-people,
    .table .bi-people-fill,
    .table td i.bi-person-circle,
    .table td i.bi-person,
    .table td .d-flex.align-items-center i,
    .table td .avatar-circle i,
    .table td [class*="person"] {
        box-shadow: none !important;
        background: transparent !important;
    }

    /* Target parent containers that might have shadows */
    .table td .d-flex.align-items-center,
    .table td .avatar-circle,
    .table td .rounded-circle,
    .table td div:has(> i.bi-person-circle),
    .table td div:has(> i.bi-person) {
        box-shadow: none !important;
        background: transparent !important;
        border: none !important;
    }
}

/* Extra small devices */
@media (max-width: 576px) {
    .table > thead > tr > th,
    .table > tbody > tr > td,
    .table th,
    .table td {
        padding: 0.4rem 0.4rem !important;
        font-size: 0.8rem !important;
    }

    .table > thead > tr > th,
    .table thead th,
    .table th {
        font-size: 0.75rem !important;
        letter-spacing: 0.2px !important;
        text-align: center !important;
    }

    .btn {
        font-size: 0.75rem;
    }

    body {
        font-size: 0.8rem;
    }
}

/* Custom Dropdown Styles - Orange Theme */
.form-select,
select.form-control,
select {
    cursor: pointer;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-select:hover,
select.form-control:hover,
select:hover {
    border-color: #ff6b35;
}

.form-select:focus,
select.form-control:focus,
select:focus {
    border-color: #ff6b35;
    box-shadow: 0 0 0 0.2rem rgba(255, 107, 53, 0.25);
}

/* Style dropdown options - works in modern browsers */
.form-select option,
select.form-control option,
select option {
    padding: 8px 12px;
    cursor: pointer;
    background-color: white;
    color: #333;
}

.form-select option:hover,
.form-select option:focus,
.form-select option:active,
.form-select option:checked,
select.form-control option:hover,
select.form-control option:focus,
select.form-control option:active,
select.form-control option:checked,
select option:hover,
select option:focus,
select option:active,
select option:checked {
    background-color: #ff6b35 !important;
    background: #ff6b35 !important;
    color: white !important;
}

/* For Webkit browsers (Chrome, Safari, Edge) - custom scrollbar for dropdowns */
.form-select::-webkit-scrollbar,
select.form-control::-webkit-scrollbar,
select::-webkit-scrollbar {
    width: 8px;
}

.form-select::-webkit-scrollbar-track,
select.form-control::-webkit-scrollbar-track,
select::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.form-select::-webkit-scrollbar-thumb,
select.form-control::-webkit-scrollbar-thumb,
select::-webkit-scrollbar-thumb {
    background: #ff6b35;
    border-radius: 4px;
}

/* Enhanced select wrapper for custom styling */
.select-wrapper {
    position: relative;
}

.select-wrapper::after {
    content: '\f282';
    font-family: 'bootstrap-icons';
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: #ff6b35;
    pointer-events: none;
    font-size: 0.8rem;
}

/* Dropdown menu styles (for Bootstrap dropdowns) */
.dropdown-menu {
    border-radius: 8px;
    border: 1px solid rgba(255, 107, 53, 0.2);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.dropdown-item {
    padding: 8px 16px;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.dropdown-item:hover,
.dropdown-item:focus,
.dropdown-item:active {
    background-color: #ff6b35 !important;
    color: white !important;
}

/* Custom styled select with orange theme */
.custom-select-orange {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    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='%23ff6b35' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 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;
}

/* For Firefox - option styling */
@-moz-document url-prefix() {
    .form-select option,
    select.form-control option,
    select option {
        background-color: white;
        color: #333;
    }

    .form-select option:hover,
    .form-select option:checked,
    select.form-control option:hover,
    select.form-control option:checked,
    select option:hover,
    select option:checked {
        background-color: #ff6b35 !important;
        color: white !important;
    }
}