/* Oxford Phone List Page Styles */

.oxford-phone {
    padding: 20px;
    max-width: 1200px;
    margin: 0 auto;
}

.oxford-phone h1 {
    text-align: center;
    margin-bottom: 30px;
    color: #5F07B3;
}

/* Controls Section */
.controls {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

#search-input {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    min-width: 200px;
}

#filter-options {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

/* Table Styles */
.table-container {
    overflow-x: auto;
    margin-bottom: 20px;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
    border-radius: 4px;
}

#phone-table {
    width: 100%;
    border-collapse: collapse;
    background-color: white;
}

#phone-table th,
#phone-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #ddd;
}

#phone-table th {
    background-color: #f5f5f5;
    font-weight: bold;
    color: #333;
}

#phone-table tbody tr:hover {
    background-color: #f9f9f9;
    cursor: pointer;
}

/* Responsive Table Styles */
@media (max-width: 1010px) {
    .oxford-phone {
        padding: 10px;
        max-width: 100vw;
        overflow-x: hidden;
    }

    .controls {
        flex-direction: column;
    }

    #search-input {
        width: 100%;
    }

    /* Stack table into cards */
    #phone-table,
    #phone-table thead,
    #phone-table tbody,
    #phone-table th,
    #phone-table td,
    #phone-table tr {
        display: block;
    }

    #phone-table thead tr {
        position: absolute;
        top: -9999px;
        left: -9999px;
    }

    #phone-table tr {
        margin-bottom: 15px;
        border: 1px solid #ddd;
        border-radius: 8px;
        background: white;
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    }

    #phone-table td {
        position: relative;
        padding: 12px 10px 12px 50%;
        border: none;
        border-bottom: 1px solid #eee;
        min-height: 40px; /* Ensure consistent height for empty cells */
    }

    #phone-table td:last-child {
        border-bottom: none;
    }

    #phone-table td:before {
        content: attr(data-label);
        position: absolute;
        left: 12px;
        width: 45%;
        padding-right: 10px;
        font-weight: bold;
        color: #666;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    /* Specific column styles */
    #phone-table td[data-label="Contact Phone"],
    #phone-table td[data-label="Contact Name"] {
        word-break: break-word;
    }
}

/* Pagination Styles */
#pagination {
    display: flex;
    align-items: center;
    gap: 15px;
    justify-content: center;
    margin-top: 20px;
}

#pagination button {
    padding: 8px 16px;
    border: 1px solid #ddd;
    background-color: white;
    cursor: pointer;
    border-radius: 4px;
}

#pagination button:hover {
    background-color: #f5f5f5;
}

#pagination button:disabled {
    background-color: #eee;
    cursor: not-allowed;
}

#items-per-page {
    padding: 6px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

/* House Popup Styles */
.popup {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    z-index: 1000;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.popup-content {
    position: relative;
    background-color: white;
    margin: 10% auto;
    padding: 20px;
    width: 80%;
    max-width: 600px;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    max-height: 90vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.close-button {
    position: absolute;
    right: 20px;
    top: 10px;
    font-size: 24px;
    cursor: pointer;
    color: #666;
}

#house-image {
    width: auto;
    max-height: 300px;
    object-fit: cover;
    border-radius: 4px;
    margin-bottom: 15px;
}

#house-name {
    margin-bottom: 10px;
    color: #333;
}

#house-details {
    line-height: 1.6;
    color: #666;
}

/* Clickable row styling */
#phone-table tbody tr td:first-child {
    color: #008DBB;
    position: relative;
}

#phone-table tbody tr td:first-child::after {
    content: '🏠';
    margin-left: 5px;
    font-size: 0.9em;
    opacity: 0.7;
}

#phone-table tbody tr:hover td:first-child {
    color: #5F07B3;
}

/* Ensure the table header doesn't show the house icon */
#phone-table thead tr th:first-child::after {
    content: none;
}

/* Print Button Styles */
.print-button {
    background-color: #5F07B3;
    color: white;
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 15px;
}

.print-button:hover {
    background-color: #4a0589;
}

.print-button i {
    font-size: 16px;
}

/* Print Styles */
@media print {
    .controls,
    #pagination,
    #main-header,
    #main-footer,
    .popup {
        display: none !important;
    }

    .oxford-phone {
        padding: 0;
        margin: 0;
        width: 100%;
    }

    .table-container {
        overflow: visible;
        box-shadow: none;
        width: 100%;
        margin: 0;
        padding: 0;
    }

    .print-only-title {
        text-align: center;
        font-size: 18pt;
        margin: 10px 0 20px;
        color: #000;
    }

    #phone-table {
        width: 100%;
        border-collapse: collapse;
        font-size: 10pt;
        border: 1px solid #000;
        margin-bottom: 20px;
        page-break-inside: auto;
    }

    #phone-table th,
    #phone-table td {
        padding: 6px;
        border: 1px solid #000;
        text-align: left;
        page-break-inside: avoid;
    }

    #phone-table th {
        background-color: #f5f5f5 !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
        font-weight: bold;
    }

    #phone-table tr {
        page-break-inside: avoid;
    }

    #phone-table tbody tr:nth-child(even) {
        background-color: #f9f9f9 !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    /* Remove house icon from name column when printing */
    #phone-table tbody tr td:first-child::after {
        content: none;
    }

    /* Ensure reasonable column widths */
    #phone-table th:nth-child(1), /* Name */
    #phone-table td:nth-child(1) {
        width: 20%;
    }

    #phone-table th:nth-child(2), /* Address */
    #phone-table td:nth-child(2) {
        width: 25%;
    }

    #phone-table th:nth-child(3), /* Phone */
    #phone-table td:nth-child(3) {
        width: 15%;
    }

    #phone-table th:nth-child(4), /* Contact Name */
    #phone-table td:nth-child(4) {
        width: 15%;
    }

    #phone-table th:nth-child(5), /* Contact Phone */
    #phone-table td:nth-child(5) {
        width: 15%;
    }

    #phone-table th:nth-child(6), /* Gender */
    #phone-table td:nth-child(6) {
        width: 10%;
    }

    /* Add page numbers */
    @page {
        margin: 0.5cm;
    }

    body::after {
        content: counter(page);
        counter-increment: page;
        position: fixed;
        bottom: 0.5cm;
        right: 0.5cm;
        font-size: 9pt;
    }

    /* Add header with date */
    body::before {
        content: "Printed on " attr(data-print-date);
        position: fixed;
        top: 0.5cm;
        right: 0.5cm;
        font-size: 9pt;
        color: #666;
    }
} 