/* ===========================
   RESET & BASE STYLES
   =========================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: #f5f5f5;
    line-height: 1.6;
}

.hidden {
    display: none !important;
}

/* ===========================
   LOGIN MODAL
   =========================== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    padding: 20px;
}

.modal-overlay.hidden {
    display: none;
}

.login-modal {
    background: white;
    border-radius: 10px;
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.2);
    width: 100%;
    max-width: 400px;
    padding: 40px;
    animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.login-header {
    text-align: center;
    margin-bottom: 30px;
}

.login-header h1 {
    color: #333;
    font-size: 24px;
    margin-bottom: 10px;
}

/* ===========================
   FORMS
   =========================== */
.form-group {
    margin-bottom: 20px;
}

label {
    display: block;
    margin-bottom: 5px;
    color: #555;
    font-weight: 500;
    font-size: 14px;
}

input[type="text"],
input[type="email"],
input[type="password"] {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 16px;
}

input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus {
    outline: none;
    border-color: #94a9d7;
}

.submit-button {
    width: 100%;
    padding: 12px;
    background-color: #94a9d7;
    color: white;
    border: none;
    border-radius: 5px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
}

.submit-button:hover {
    background-color: #7a8fc3;
}

.submit-button:disabled {
    background-color: #ccc;
    cursor: not-allowed;
}

/* ===========================
   MESSAGES & FEEDBACK
   =========================== */
.message {
    padding: 10px;
    border-radius: 5px;
    font-size: 14px;
    margin-bottom: 15px;
    display: none;
}

.error-message {
    background-color: #fee;
    color: #c33;
}

.success-message {
    background-color: #efe;
    color: #3c3;
}

.loading {
    display: none;
    text-align: center;
    color: #666;
}

/* ===========================
   HEADER
   =========================== */
.header {
    background: white;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    padding: 20px 0;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content {
    max-width: 1300px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header h1 {
    color: #333;
    font-size: 24px;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 20px;
}

.user-email {
    color: #666;
    font-size: 14px;
}

/* ===========================
   BUTTONS
   =========================== */
.btn {
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.3s ease;
}

.btn-primary {
    background: #4CAF50;
    color: white;
}

.btn-primary:hover {
    background: #45a049;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(76, 175, 80, 0.3);
}

.btn-danger {
    background: #f44336;
    color: white;
}

.btn-danger:hover {
    background: #da190b;
}

/* ===========================
   CONTAINER & LAYOUT
   =========================== */
.container {
    max-width: 1300px;
    margin: 0 auto;
    padding: 20px;
}

/* ===========================
   STATS CARDS
   =========================== */
.stats-grid {
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: white;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    text-align: center;
}

.stat-card h3 {
    color: #666;
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 10px;
}

.stat-card .number {
    font-size: 32px;
    font-weight: 700;
    color: #333;
}

.stat-card.draft { border-left: 4px solid #FFA726; }
.stat-card.progress { border-left: 4px solid #66BB6A; }
.stat-card.completed { border-left: 4px solid #42A5F5; }
.stat-card.total { border-left: 4px solid #AB47BC; }

/* ===========================
   DASHBOARD CONTROLS
   =========================== */
.dashboard-controls {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
    align-items: start;
}

/* Column 1: Filters */
.filters-column {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.filter-row {
    display: flex;
    gap: 12px;
    align-items: flex-end;
}

.filter-group {
    flex: 1;
}

.filter-group label {
    display: block;
    margin-bottom: 4px;
    font-size: 12px;
    font-weight: 500;
    color: #666;
}

.filter-group select,
.filter-group input {
    width: 100%;
    padding: 6px 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 13px;
}

.search-group {
    flex: 1;
}

.search-group input {
    flex: 1;
}

.search-group .btn {
    padding: 6px 12px;
    font-size: 13px;
    white-space: nowrap;
}

/* Column 2: Calendar */
.calendar-column {
    display: flex;
    flex-direction: column;
    justify-content: center;
    width: 100%;
}

#calendarWrapper {
    width: 100%;
}

.calendar-container {
    width: 100%;
}

/* Column 3: Today's Appointments */
.today-column {
    flex: 1;
}

.today-appointments {
    background: white;
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    max-height: 280px;
    overflow-y: auto;
}

.today-header {
    font-weight: 600;
    color: #333;
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 1px solid #eee;
    font-size: 14px;
}

.today-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.today-appointment {
    padding: 10px;
    background: #f9f9f9;
    border-left: 3px solid #4CAF50;
    border-radius: 3px;
    cursor: pointer;
    transition: background 0.2s;
}

.today-appointment:hover {
    background: #f0f0f0;
}

.today-time {
    font-weight: 600;
    color: #1976d2;
    font-size: 12px;
    margin-bottom: 3px;
}

.today-address {
    color: #333;
    font-size: 12px;
    margin-bottom: 2px;
}

.today-details {
    color: #666;
    font-size: 11px;
}

/* ===========================
   CALENDAR
   =========================== */
.mini-calendar {
    background: white;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 10px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.08);
    font-size: 12px;
    width: 100%;
}

.calendar-header {
    text-align: center;
    margin-bottom: 6px;
    padding-bottom: 4px;
    border-bottom: 1px solid #eee;
}

.calendar-month {
    font-weight: 600;
    color: #333;
    font-size: 14px;
}

.calendar-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 2px;
    margin-bottom: 4px;
    padding-bottom: 4px;
    border-bottom: 1px solid #f0f0f0;
}

.calendar-weekdays span {
    text-align: center;
    font-weight: 600;
    color: #666;
    font-size: 11px;
    padding: 2px;
    height: 16px;
    line-height: 16px;
}

.calendar-days {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 2px;
}

.calendar-day {
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 3px;
    cursor: pointer;
    font-size: 12px;
    color: #333;
    background: #fff;
    border: 1px solid #e0e0e0;
    transition: all 0.15s ease;
    height: 28px;
    min-height: 28px;
    max-height: 28px;
}

.calendar-day:not(.empty):hover {
    background: #f5f5f5;
    border-color: #999;
    transform: scale(1.05);
}

.calendar-day.empty {
    visibility: hidden;
    cursor: default;
    border: none;
}

.calendar-day.today {
    background: #e3f2fd;
    color: #1976d2;
    font-weight: 700;
    border: 1px solid #90caf9;
}

.calendar-day.has-inspection {
    background: #fff3cd;
    color: #856404;
    font-weight: 600;
    border: 1px solid #ffeaa7;
    position: relative;
}

.calendar-day.has-inspection::after {
    content: '';
    position: absolute;
    bottom: 2px;
    width: 3px;
    height: 3px;
    background: #f39c12;
    border-radius: 50%;
}

.calendar-day.selected {
    background: #4CAF50 !important;
    color: white !important;
    border-color: #45a049 !important;
    font-weight: 700;
}

/* Appointments Panel */
.appointments-panel {
    background: white;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 8px;
    margin-top: 10px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.08);
    display: none;
    max-height: 180px;
    overflow-y: auto;
    width: 100%;
}

.appointments-panel.active {
    display: block;
}

.appointments-header {
    font-weight: 600;
    color: #333;
    margin-bottom: 6px;
    padding-bottom: 4px;
    border-bottom: 1px solid #eee;
    font-size: 12px;
    position: sticky;
    top: 0;
    background: white;
    z-index: 1;
}

.appointment-item {
    padding: 6px;
    margin-bottom: 4px;
    background: #f9f9f9;
    border-left: 3px solid #4CAF50;
    border-radius: 3px;
    font-size: 11px;
    cursor: pointer;
    transition: background 0.15s;
}

.appointment-item:hover {
    background: #f0f0f0;
}

.appointment-time {
    font-weight: 600;
    color: #1976d2;
    font-size: 11px;
    display: inline-block;
    margin-right: 6px;
}

.appointment-address {
    color: #333;
    display: inline-block;
    font-size: 11px;
}

.appointment-client {
    color: #666;
    font-size: 10px;
    margin-top: 2px;
}

.no-appointments {
    color: #999;
    font-style: italic;
    text-align: center;
    padding: 10px;
    font-size: 11px;
}

/* ===========================
   REPORTS TABLE
   =========================== */
.reports-table {
    background: white;
    border-radius: 10px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    overflow: hidden;
}

.table-header {
    padding: 20px;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.table-header h2 {
    font-size: 18px;
    color: #333;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th {
    background: #f9f9f9;
    padding: 12px;
    text-align: left;
    font-weight: 600;
    color: #666;
    font-size: 14px;
    border-bottom: 1px solid #eee;
}

td {
    padding: 16px 12px;
    border-bottom: 1px solid #f0f0f0;
    font-size: 14px;
}

tr:hover {
    background: #f9f9f9;
}

.property-address {
    font-weight: 600;
    color: #333;
    cursor: pointer;
}

.property-address:hover {
    color: #4CAF50;
    text-decoration: underline;
}

/* Comments textarea */
.comments-textarea {
    width: 150px;
    height: 65px;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 12px;
    font-family: inherit;
    resize: none;
    transition: all 0.2s;
}

.comments-textarea:focus {
    outline: none;
    border-color: #4CAF50;
    box-shadow: 0 0 0 2px rgba(76, 175, 80, 0.1);
}

.comments-textarea.saving {
    border-color: #2196F3 !important;
    background: #e3f2fd !important;
}

.comments-textarea.saved {
    border-color: #4CAF50 !important;
    background: #e8f5e9 !important;
}

.comments-textarea.error {
    border-color: #f44336 !important;
    background: #ffebee !important;
}

/* Status badges */
.status-badge {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
}

.status-draft { background: #FFF3E0; color: #F57C00; }
.status-in-progress { background: #E8F5E9; color: #2E7D32; }
.status-review { background: #E3F2FD; color: #1565C0; }
.status-completed { background: #F3E5F5; color: #6A1B9A; }

/* Action buttons */
.actions {
    display: flex;
    gap: 10px;
    min-width: 180px;
    vertical-align: top;
}

.action-btn {
    padding: 8px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
    background: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
}

.action-btn img {
    width: 28px;
    height: 28px;
}

.action-edit:hover {
    background: #E8F5E9;
}

.action-delete:hover {
    background: #FFEBEE;
}

.action-delete:disabled {
    opacity: 0.5;
    cursor: not-allowed !important;
}

.action-delete:disabled:hover {
    background: none !important;
}

/* ===========================
   COLLABORATORS
   =========================== */
.collaborators-container {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid #eee;
}

.collaborators-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-bottom: 4px;
    min-height: 20px;
}

.email-chip {
    display: inline-flex;
    align-items: center;
    background: #e3f2fd;
    border: 1px solid #90caf9;
    border-radius: 3px;
    padding: 2px 8px;
    font-size: 11px;
    color: #1976d2;
    width: 210px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.email-chip:hover {
    background: #bbdefb;
}

.chip-remove {
    background: none;
    border: none;
    color: #1976d2;
    cursor: pointer;
    font-size: 16px;
    font-weight: bold;
    margin-left: 4px;
    padding: 0 2px;
    line-height: 1;
}

.chip-remove:hover {
    color: #d32f2f;
}

.collaborator-input {
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 4px;
    font-size: 11px;
    width: 100%;
    display: block;
    margin-top: 4px;
}

.collaborator-input:focus {
    outline: none;
    border-color: #2196F3;
    box-shadow: 0 0 0 2px rgba(33, 150, 243, 0.1);
}

/* Editing indicator */
.editing-indicator {
    display: inline-block;
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffeeba;
    border-radius: 4px;
    padding: 2px 6px;
    font-size: 10px;
    font-weight: 500;
    margin-top: 4px;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

/* Owner email */
.owner-email {
    color: #999;
    font-size: 10px;
    font-style: italic;
}

/* ===========================
   LOADING STATES
   =========================== */
.dashboard-loading {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.95);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.dashboard-loading.hidden {
    display: none !important;
}

.spinner {
    border: 3px solid #f3f3f3;
    border-top: 3px solid #4CAF50;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

.spinner-small {
    width: 16px;
    height: 16px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ===========================
   EMPTY STATES
   =========================== */
.empty-state {
    text-align: center;
    padding: 60px;
    color: #666;
}

.empty-state img {
    width: 100px;
    opacity: 0.3;
    margin-bottom: 20px;
}

/* ===========================
   NOTIFICATIONS
   =========================== */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    padding: 16px;
    z-index: 1000;
    animation: slideIn 0.3s ease-out;
    max-width: 400px;
}

.notification-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.notification-content button {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #666;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.notification-content button:hover {
    color: #333;
}

.notification-success {
    border-left: 4px solid #4CAF50;
}

.notification-error {
    border-left: 4px solid #f44336;
}

.notification-info {
    border-left: 4px solid #2196F3;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* ===========================
   RESPONSIVE DESIGN
   =========================== */
@media (max-width: 1200px) {
    .dashboard-controls {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    
    .calendar-column {
        order: -1;
    }
    
    .today-column {
        order: 0;
    }
    
    .filters-column {
        order: 1;
    }
}

@media (max-width: 768px) {
    .header-content {
        flex-direction: column;
        gap: 15px;
    }

    .filter-row {
        flex-direction: column;
        gap: 8px;
    }
    
    .filter-group {
        width: 100%;
    }

    .table-wrapper {
        overflow-x: auto;
    }

    table {
        min-width: 700px;
    }

    .stats-grid {
        grid-template-columns: 1fr 1fr;
    }

    .email-chip {
        font-size: 10px;
        padding: 2px 6px;
    }
    
    .collaborator-input {
        font-size: 10px;
        padding: 3px;
    }
    
    .editing-indicator {
        font-size: 9px;
        padding: 1px 4px;
    }

    .calendar-day {
        font-size: 11px;
        height: 24px;
        min-height: 24px;
        max-height: 24px;
    }

    .notification {
        right: 10px;
        left: 10px;
        max-width: none;
    }
}

@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }
}

/* ===========================
   HEADER - MOBILE FRIENDLY
   =========================== */
.header {
    background: white;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    padding: 15px 0;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content {
    max-width: 1300px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header h1 {
    color: #333;
    font-size: 24px;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 20px;
}

.user-email {
    color: #666;
    font-size: 14px;
}

/* Mobile Menu Button */
.mobile-menu-btn {
    display: none;
    flex-direction: column;
    justify-content: space-between;
    width: 30px;
    height: 24px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    z-index: 102;
}

.mobile-menu-btn span {
    display: block;
    height: 3px;
    width: 100%;
    background: #333;
    border-radius: 3px;
    transition: all 0.3s;
    transform-origin: center;
}

/* Animated hamburger menu */
.mobile-menu-btn.active span:nth-child(1) {
    transform: translateY(10.5px) rotate(45deg);
}

.mobile-menu-btn.active span:nth-child(2) {
    opacity: 0;
}

.mobile-menu-btn.active span:nth-child(3) {
    transform: translateY(-10.5px) rotate(-45deg);
}

/* Mobile Header Styles */
@media (max-width: 768px) {
    .header {
        padding: 12px 0;
    }
    
    .header-content {
        position: relative;
        padding: 0 15px;
    }
    
    .header-content img,
    .header-content > span {
        height: 45px !important;
        font-size: 20px !important;
    }
    
    .mobile-menu-btn {
        display: flex;
    }
    
    .user-info {
        position: absolute;
        top: calc(100% + 12px);
        left: 0;
        right: 0;
        background: white;
        box-shadow: 0 4px 12px rgba(0,0,0,0.15);
        padding: 15px;
        display: none;
        flex-direction: column;
        gap: 10px;
        z-index: 101;
        animation: slideDown 0.3s ease-out;
    }
    
    .user-info.active {
        display: flex;
    }
    
    @keyframes slideDown {
        from {
            opacity: 0;
            transform: translateY(-10px);
        }
        to {
            opacity: 1;
            transform: translateY(0);
        }
    }
    
    .user-email {
        text-align: center;
        padding: 10px;
        background: #f5f5f5;
        border-radius: 6px;
        font-size: 13px;
        margin-bottom: 5px;
    }
    
    .btn {
        width: 100%;
        justify-content: center;
        padding: 12px;
        font-size: 14px;
    }
    
    .btn-primary {
        order: 1;
    }
    
    .btn-danger {
        order: 2;
        background: #666;
        margin-top: 5px;
    }
    
    .btn-danger:hover {
        background: #555;
    }
}

@media (max-width: 480px) {
    .header-content img,
    .header-content > span {
        height: 40px !important;
        font-size: 18px !important;
    }
    
    .header-content {
        padding: 0 10px;
    }
    
    .user-email {
        font-size: 12px;
        padding: 8px;
    }
    
    .mobile-menu-btn {
        width: 28px;
        height: 22px;
    }
    
    .mobile-menu-btn span {
        height: 2.5px;
    }
}


/* ===========================
   MOBILE TABLE/CARDS
   =========================== */
@media (max-width: 768px) {
    /* Hide table headers on mobile */
    .reports-table table thead {
        display: none;
    }
    
    /* Convert table to cards */
    .reports-table table,
    .reports-table tbody,
    .reports-table tr,
    .reports-table td {
        display: block;
        width: 100%;
    }
    
    .reports-table tr {
        margin-bottom: 15px;
        background: white;
        border: 1px solid #ddd;
        border-radius: 8px;
        padding: 12px;
        box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    }
    
    .reports-table td {
        padding: 8px 0;
        border: none;
        position: relative;
        padding-left: 35%;
    }
    
    .reports-table td:before {
        content: attr(data-label);
        position: absolute;
        left: 0;
        width: 30%;
        font-weight: 600;
        font-size: 12px;
        color: #666;
    }
    
    /* Special styling for first cell (Property) */
    .reports-table td:first-child {
        padding-left: 0;
        border-bottom: 1px solid #eee;
        margin-bottom: 10px;
        padding-bottom: 10px;
    }
    
    .reports-table td:first-child:before {
        display: none;
    }
    
    /* Property address styling */
    .property-address {
        font-size: 16px;
        margin-bottom: 5px;
    }
    
    /* Compact textarea on mobile */
    .comments-textarea {
        width: 100%;
        height: 50px;
        font-size: 11px;
    }
    
    /* Action buttons in a row */
    .reports-table .actions {
        display: flex;
        justify-content: space-around;
        padding-left: 0;
        margin-top: 10px;
        padding-top: 10px;
        border-top: 1px solid #eee;
    }
    
    .reports-table .actions:before {
        display: none;
    }
    
    /* Collaborators section */
    .reports-table td:last-child {
        padding-left: 0;
    }
    
    .reports-table td:last-child:before {
        content: "Collaborators";
        position: relative;
        display: block;
        margin-bottom: 5px;
    }
    
    .collaborators-container {
        margin-top: 5px;
        padding-top: 5px;
    }
    
    .email-chip {
        font-size: 10px;
        padding: 2px 6px;
        width: auto;
        max-width: 100%;
    }
}

/* Even smaller screens */
@media (max-width: 480px) {
    .reports-table tr {
        padding: 10px;
        margin-bottom: 12px;
    }
    
    .reports-table td {
        padding: 6px 0;
        font-size: 12px;
    }
    
    .property-address {
        font-size: 14px;
    }
    
    .action-btn img {
        width: 24px;
        height: 24px;
    }
}

/* Clickable address styling */
.property-address.clickable-edit {
    cursor: pointer;
    color: #333;
    text-decoration: none;
    transition: all 0.2s;
}

.property-address.clickable-edit:hover {
    color: #4CAF50;
    text-decoration: underline;
}

/* Comments textarea wider */
.comments-textarea {
    width: 100%;
    min-width: 200px;
    height: 65px;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 12px;
    font-family: inherit;
    resize: vertical;
    transition: all 0.2s;
}

/* Smaller action buttons in property cell */
.action-btn {
    padding: 4px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
    background: transparent;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.action-btn img {
    width: 24px;
    height: 24px;
}

.action-download:hover {
    background: #E8F5E9;
}

.action-delete:hover {
    background: #FFEBEE;
}

/* ===========================
   MOBILE TABLE/CARDS - FIXED
   =========================== */
@media (max-width: 768px) {
    /* Hide table headers on mobile */
    .reports-table table thead {
        display: none;
    }
    
    /* Reset table display */
    .reports-table table {
        display: block;
        width: 100%;
    }
    
    .reports-table tbody {
        display: block;
        width: 100%;
    }
    
    /* Each row becomes a card */
    .reports-table tr {
        display: block;
        margin-bottom: 20px;
        background: white;
        border: 1px solid #ddd;
        border-radius: 8px;
        padding: 15px;
        box-shadow: 0 2px 4px rgba(0,0,0,0.05);
        width: 100%;
    }
    
    /* Each cell becomes a block */
    .reports-table td {
        display: block;
        padding: 10px 0;
        border: none;
        position: relative;
        width: 100%;
        text-align: left;
        padding-left: 0;
    }
    
    /* Add labels before content */
    .reports-table td[data-label]:before {
        content: attr(data-label);
        display: block;
        font-weight: 600;
        font-size: 11px;
        color: #666;
        text-transform: uppercase;
        margin-bottom: 5px;
        letter-spacing: 0.5px;
    }
    
    /* Property section (first cell) - special styling */
    .reports-table td:first-child {
        border-bottom: 1px solid #eee;
        padding-bottom: 15px;
        margin-bottom: 10px;
    }
    
    .reports-table td:first-child:before {
        content: "PROPERTY";
        display: block;
        font-weight: 600;
        font-size: 11px;
        color: #666;
        text-transform: uppercase;
        margin-bottom: 8px;
        letter-spacing: 0.5px;
    }
    
    /* Fix the flex container in property cell */
    .reports-table td:first-child > div {
        display: block !important;
    }
    
    .reports-table td:first-child > div > div:first-child {
        margin-bottom: 10px;
    }
    
    /* Action buttons row */
    .reports-table td:first-child > div > div:last-child {
        display: flex;
        gap: 10px;
        margin-left: 0 !important;
        margin-top: 10px;
        justify-content: flex-start;
    }
    
    /* Property address */
    .property-address {
        font-size: 16px;
        font-weight: 600;
        margin: 5px 0;
        display: block;
    }
    
    /* Comments textarea */
    .comments-textarea {
        width: 100% !important;
        height: 60px;
        font-size: 12px;
        min-width: unset !important;
    }
    
    /* Date/time inputs */
    .reports-table input[type="date"],
    .reports-table input[type="time"],
    .reports-table input[type="email"] {
        width: 100% !important;
        padding: 8px !important;
        font-size: 14px !important;
        margin-top: 5px !important;
    }
    
    /* Collaborators section */
    .collaborators-container {
        width: 100%;
    }
    
    .collaborators-chips {
        display: flex;
        flex-wrap: wrap;
        gap: 5px;
        margin-bottom: 8px;
    }
    
    .email-chip {
        font-size: 11px;
        padding: 4px 8px;
        width: auto;
        max-width: 100%;
        flex: 0 1 auto;
    }
    
    .collaborator-input {
        width: 100% !important;
        padding: 8px !important;
        font-size: 13px !important;
    }
    
    /* Action buttons */
    .action-btn {
        padding: 8px;
        background: #f5f5f5;
        border-radius: 4px;
    }
    
    .action-btn img {
        width: 20px;
        height: 20px;
    }
    
    /* Remove any absolute positioning */
    .reports-table td * {
        position: relative !important;
    }
}

/* Even smaller screens */
@media (max-width: 480px) {
    .reports-table tr {
        padding: 12px;
        margin-bottom: 15px;
    }
    
    .reports-table td {
        padding: 8px 0;
    }
    
    .property-address {
        font-size: 15px;
    }
    
    .reports-table td[data-label]:before {
        font-size: 10px;
    }
    
    /* Stack date fields vertically */
    .reports-table td[data-label="Ordered/Due"] {
        line-height: 1.5 !important;
    }
}

/* Fix for table wrapper on mobile */
@media (max-width: 768px) {
    .table-wrapper {
        overflow-x: visible !important;
        overflow-y: visible !important;
    }
}

/* ===========================
   MOBILE TABLE/CARDS - FIXED SPACING
   =========================== */
@media (max-width: 768px) {
    /* Hide table headers on mobile */
    .reports-table table thead {
        display: none;
    }
    
    /* Reset table display */
    .reports-table table {
        display: block;
        width: 100%;
    }
    
    .reports-table tbody {
        display: block;
        width: 100%;
    }
    
    /* Each row becomes a card */
    .reports-table tr {
        display: block;
        margin-bottom: 20px;
        background: white;
        border: 1px solid #ddd;
        border-radius: 8px;
        padding: 15px;
        box-shadow: 0 2px 4px rgba(0,0,0,0.05);
        width: 100%;
    }
    
    /* Each cell becomes a block with MORE SPACING */
    .reports-table td {
        display: block;
        padding: 15px 0;  /* Increased from 10px */
        border: none;
        position: relative;
        width: 100%;
        text-align: left;
        padding-left: 0;
        margin-bottom: 10px;  /* Added margin between cells */
    }
    
    /* Add labels before content with BETTER SPACING */
    .reports-table td[data-label]:before {
        content: attr(data-label);
        display: block;
        font-weight: 600;
        font-size: 11px;
        color: #666;
        text-transform: uppercase;
        margin-bottom: 10px;  /* Increased from 5px */
        margin-top: 5px;  /* Added top margin */
        letter-spacing: 0.5px;
        padding-bottom: 5px;  /* Added padding */
        border-bottom: 1px solid #f0f0f0;  /* Optional: adds a subtle line */
    }
    
    /* Property section (first cell) - special styling */
    .reports-table td:first-child {
        border-bottom: 2px solid #eee;
        padding-bottom: 20px;  /* Increased from 15px */
        margin-bottom: 15px;  /* Increased from 10px */
    }
    
    .reports-table td:first-child:before {
        content: "PROPERTY";
        display: block;
        font-weight: 600;
        font-size: 11px;
        color: #666;
        text-transform: uppercase;
        margin-bottom: 12px;  /* Increased from 8px */
        margin-top: 0;
        letter-spacing: 0.5px;
        padding-bottom: 5px;
        border-bottom: 1px solid #f0f0f0;
    }
    
    /* Fix the flex container in property cell */
    .reports-table td:first-child > div {
        display: block !important;
    }
    
    .reports-table td:first-child > div > div:first-child {
        margin-bottom: 10px;
    }
    
    /* Action buttons row */
    .reports-table td:first-child > div > div:last-child {
        display: flex;
        gap: 10px;
        margin-left: 0 !important;
        margin-top: 15px;  /* Increased from 10px */
        justify-content: flex-start;
    }
    
    /* Property address */
    .property-address {
        font-size: 16px;
        font-weight: 600;
        margin: 8px 0;  /* Increased spacing */
        display: block;
        line-height: 1.4;
    }
    
    /* Comments textarea with spacing */
    .reports-table td[data-label="Comments"] {
        margin-top: 10px;
    }
    
    .comments-textarea {
        width: 100% !important;
        height: 60px;
        font-size: 12px;
        min-width: unset !important;
        margin-top: 5px;  /* Added top margin */
    }
    
    /* Date/time inputs with better spacing */
    .reports-table input[type="date"],
    .reports-table input[type="time"],
    .reports-table input[type="email"] {
        width: 100% !important;
        padding: 8px !important;
        font-size: 14px !important;
        margin-top: 8px !important;  /* Increased from 5px */
        margin-bottom: 8px !important;  /* Added bottom margin */
    }
    
    /* Collaborators section */
    .reports-table td[data-label="Collaborators"] {
        margin-top: 15px;
        padding-top: 15px;
    }
    
    .collaborators-container {
        width: 100%;
        margin-top: 5px;
    }
    
    .collaborators-chips {
        display: flex;
        flex-wrap: wrap;
        gap: 5px;
        margin-bottom: 10px;  /* Increased from 8px */
        margin-top: 5px;
    }
    
    .email-chip {
        font-size: 11px;
        padding: 4px 8px;
        width: auto;
        max-width: 100%;
        flex: 0 1 auto;
    }
    
    .collaborator-input {
        width: 100% !important;
        padding: 8px !important;
        font-size: 13px !important;
        margin-top: 5px !important;
    }
    
    /* Action buttons */
    .action-btn {
        padding: 8px;
        background: #f5f5f5;
        border-radius: 4px;
    }
    
    .action-btn img {
        width: 20px;
        height: 20px;
    }
    
    /* Remove any absolute positioning */
    .reports-table td * {
        position: relative !important;
    }
    
    /* Add spacing to small text elements */
    .reports-table small {
        display: block;
        margin: 3px 0;
        line-height: 1.4;
    }
}

/* Even smaller screens - MORE SPACING */
@media (max-width: 480px) {
    .reports-table tr {
        padding: 12px;
        margin-bottom: 18px;
    }
    
    .reports-table td {
        padding: 12px 0;  /* More padding on small screens */
        margin-bottom: 12px;
    }
    
    .reports-table td[data-label]:before {
        margin-bottom: 12px;  /* Even more space on small screens */
        margin-top: 8px;
        font-size: 10px;
    }
    
    .property-address {
        font-size: 15px;
        margin: 10px 0;
    }
    
    /* Stack date fields vertically with spacing */
    .reports-table td[data-label="Ordered/Due"] {
        line-height: 1.8 !important;
    }
}

/* Fix for table wrapper on mobile */
@media (max-width: 768px) {
    .table-wrapper {
        overflow-x: visible !important;
        overflow-y: visible !important;
    }
}

/* ===========================
   MOBILE TABLE/CARDS - PROPERLY TARGETED
   =========================== */
@media (max-width: 768px) {
    /* Hide table headers */
    .reports-table thead {
        display: none !important;
    }
    
    /* Reset table structure */
    .reports-table table,
    .reports-table tbody {
        display: block;
        width: 100%;
    }
    
    /* Each row becomes a card */
    .reports-table tbody tr {
        display: block;
        margin: 0 10px 20px 10px;
        background: white;
        border: 1px solid #ddd;
        border-radius: 8px;
        padding: 15px;
        box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    }
    
    /* Each cell becomes a block */
    .reports-table tbody td {
        display: block !important;
        width: 100% !important;
        padding: 0 !important;
        border: none !important;
        margin-bottom: 20px !important;
        position: relative !important;
        text-align: left !important;
    }
    
    /* Style the data labels */
    .reports-table tbody td[data-label]::before {
        content: attr(data-label) !important;
        display: block !important;
        font-weight: 600 !important;
        font-size: 11px !important;
        color: #666 !important;
        text-transform: uppercase !important;
        letter-spacing: 0.5px !important;
        margin-bottom: 15px !important;
        padding-bottom: 8px !important;
        border-bottom: 1px solid #e0e0e0 !important;
    }
    
    /* Special handling for first cell (Property) */
    .reports-table tbody td:first-child {
        border-bottom: 2px solid #eee !important;
        padding-bottom: 15px !important;
        margin-bottom: 15px !important;
    }
    
    /* Fix the property cell content structure */
    .reports-table tbody td:first-child > div {
        display: block !important;
        margin-top: 10px !important;
    }
    
    .reports-table tbody td:first-child > div > div:first-child {
        margin-bottom: 10px !important;
    }
    
    /* Property address styling */
    .property-address {
        display: block !important;
        font-size: 16px !important;
        font-weight: 600 !important;
        margin: 10px 0 !important;
        color: #333 !important;
    }
    
    /* Small text in property */
    .reports-table tbody td:first-child small {
        display: block !important;
        margin: 5px 0 !important;
        line-height: .05 !important;
    }
    
    /* Action buttons in property cell */
    .reports-table tbody td:first-child .action-btn {
        margin-top: 10px !important;
    }
    
    /* AMC/Client cell */
    .reports-table tbody td[data-label="AMC/Client"] {
        padding-top: 15px !important;
    }
    
    /* Comments textarea */
    .reports-table tbody td[data-label="Comments"] textarea {
        width: 100% !important;
        min-width: unset !important;
        height: 60px !important;
        margin-top: 5px !important;
        font-size: 13px !important;
    }
    
    /* Date inputs */
    .reports-table tbody td[data-label="Ordered/Due"] {
         
    }
    
    /* Inspection inputs */
    .reports-table tbody td[data-label="Inspection"] input {
        width: 100% !important;
        padding: 8px !important;
        margin: 5px 0 !important;
        font-size: 14px !important;
    }
    
    /* Collaborators */
    .reports-table tbody td[data-label="Collaborators"] {
        padding-top: 10px !important;
    }
    
    .collaborators-container {
        margin-top: 10px !important;
    }
    
    .email-chip {
        margin: 2px !important;
        font-size: 11px !important;
    }
    
    .collaborator-input {
        width: 100% !important;
        margin-top: 8px !important;
        padding: 8px !important;
        font-size: 13px !important;
    }
}

/* Clear any conflicting styles */
@media (max-width: 768px) {
    .reports-table * {
        box-sizing: border-box !important;
    }
    
    /* Ensure no overflow */
    .table-wrapper {
        overflow: visible !important;
    }
}
 /* ===========================
   COLLABORATORS - Updated Layout
   =========================== */
.email-chip {
    display: inline-flex;
    align-items: center;
    background: #e3f2fd;
    border: 1px solid #90caf9;
    border-radius: 3px;
    padding: 2px 8px;
    font-size: 11px;
    color: #1976d2;
    max-width: 150px;  /* Changed from 210px */
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.email-chip:hover {
    background: #bbdefb;
}

.chip-remove {
    background: none;
    border: none;
    color: #1976d2;
    cursor: pointer;
    font-size: 16px;
    font-weight: bold;
    margin-right: 6px;  /* Changed from margin-left to margin-right */
    margin-left: 0;  /* Remove left margin */
    padding: 0 2px;
    line-height: 1;
    order: -1;  /* This moves it to the beginning of the flex container */
    flex-shrink: 0;  /* Prevent the X from shrinking */
}

.chip-remove:hover {
    color: #d32f2f;
}

.collaborator-input {
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 4px;
    font-size: 11px;
    max-width: 150px;  /* Added max-width to match chips */
    width: 100%;
    display: block;
    margin-top: 4px;
}

.collaborator-input:focus {
    outline: none;
    border-color: #2196F3;
    box-shadow: 0 0 0 2px rgba(33, 150, 243, 0.1);
}

/* Override for mobile to make it full width */
@media (max-width: 768px) {
    .collaborator-input {
        max-width: 100% !important;  /* Full width on mobile */
        width: 100% !important;
    }
    
    .email-chip {
        max-width: 100%;  /* Allow chips to be wider on mobile */
    }
}

/* =================================== */
/* == MOBILE VIEW ENHANCEMENTS (768px and below) == */
/* =================================== */

@media (max-width: 768px) {

    /* --- 1. Enhanced Report Cards --- */
    
    /* Hide the original table headers */
    .reports-table thead {
        display: none;
    }

    /* Reset table layout for card view */
    .reports-table table, 
    .reports-table tbody, 
    .reports-table tr, 
    .reports-table td {
        display: block;
        width: 100%;
    }

    /* Style each row as a distinct card */
    .reports-table tr {
        margin-bottom: 20px;
        border: 1px solid #e1e1e1;
        border-radius: 8px;
        box-shadow: 0 4px 8px rgba(0,0,0,0.05);
        padding: 15px;
        background-color: #fff;
    }

    /* Remove borders between cells */
    .reports-table td {
        padding: 12px 5px;
        border: none;
        border-bottom: 1px dashed #f0f0f0; /* Use a subtle separator */
        position: relative;
    }

    .reports-table td:last-child {
        border-bottom: none; /* Remove separator from the last item */
    }

    /* Create the label for each data point */
    .reports-table td[data-label]::before {
        content: attr(data-label);
        display: block;
        font-weight: 600;
        font-size: 12px;
        color: #555;
        margin-bottom: 6px;
    }

    /* Special styling for the main property address (first cell) */
    .reports-table td:first-child {
        padding-bottom: 15px;
        margin-bottom: 10px;
        border-bottom: 1px solid #e1e1e1; /* A solid line after the header */
    }

    .reports-table .property-address {
        font-size: 1.1rem;
        font-weight: 600;
        color: #94a9d7;
    }

    /* Tidy up the action buttons */
    .reports-table .actions {
        display: flex;
        justify-content: flex-end; /* Align to the right */
        gap: 15px;
        padding-top: 15px;
        margin-top: 10px;
    }
    
    .reports-table .action-btn img {
        width: 28px;
        height: 28px;
    }
}

@media (max-width: 1200px) { /* This also applies to tablets */

    /* --- 2. Organized Control Panels --- */
    .dashboard-controls > div {
        background: #ffffff;
        border: 1px solid #e1e1e1;
        border-radius: 8px;
        padding: 15px;
        box-shadow: 0 4px 8px rgba(0,0,0,0.02);
    }
    
    /* Add titles to the panels */
    .filters-column::before,
    .calendar-column::before,
    .today-column::before {
        display: block;
        font-size: 1rem;
        font-weight: 600;
        color: #333;
        margin-bottom: 15px;
        padding-bottom: 10px;
        border-bottom: 1px solid #f0f0f0;
    }

    .filters-column::before { content: 'Filters & Search'; }
    .calendar-column::before { content: 'Inspection Calendar'; }
    .today-column::before { content: "Today's Appointments"; }
}

