/* Manage Companies Page Styles */

.page-header {
    margin-bottom: 2rem;
}

.page-header h1 {
    color: #333;
    margin-bottom: 0.5rem;
}

.page-header p {
    color: #666;
    font-size: 0.95rem;
}

.controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    gap: 1rem;
    flex-wrap: wrap;
}

.search-box {
    flex: 1;
    min-width: 250px;
    max-width: 400px;
}

.search-box input {
    width: 100%;
    padding: 0.6rem 1rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.95rem;
}

.btn {
    padding: 0.6rem 1.5rem;
    background: #007bff;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.95rem;
    transition: background 0.2s;
}

.btn:hover {
    background: #0056b3;
}

.btn:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.status-message {
    padding: 0.8rem 1rem;
    margin-bottom: 1rem;
    border-radius: 4px;
    display: none;
}

.status-message.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.status-message.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.table-container {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    overflow: hidden;
}

.companies-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8rem;
}

.companies-table th {
    background: #f8f9fa;
    padding: 0.6rem 0.5rem;
    text-align: left;
    font-weight: 600;
    color: #495057;
    border-bottom: 2px solid #dee2e6;
    position: sticky;
    top: 0;
    white-space: nowrap;
    font-size: 0.8rem;
}

.companies-table th.sortable {
    cursor: pointer;
    user-select: none;
}

.companies-table th.sortable:hover {
    background: #e9ecef;
}

.companies-table th.sorted {
    background: #dee2e6;
    color: #212529;
}

.sort-indicator {
    font-size: 0.7rem;
    margin-left: 0.3rem;
    color: #007bff;
}

.companies-table td {
    padding: 0.5rem;
    border-bottom: 1px solid #dee2e6;
    color: #333;
}

/* Banded/zebra rows - alternating white and light gray */
.companies-table tbody tr:nth-child(odd) {
    background: #ffffff;
}

.companies-table tbody tr:nth-child(even) {
    background: #f8f9fa;
}

.companies-table tbody tr:hover {
    background: #e9ecef !important;
}

.companies-table tbody tr.updating {
    opacity: 0.6;
}

/* Toggle Switch */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 24px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s;
    border-radius: 24px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked + .toggle-slider {
    background-color: #28a745;
}

input:checked + .toggle-slider:before {
    transform: translateX(26px);
}

.toggle-switch.disabled {
    opacity: 0.5;
    pointer-events: none;
}

/* Dropdown */
select {
    padding: 0.3rem 0.5rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.75rem;
    background: white;
    cursor: pointer;
    min-width: 100px;
}

select:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* AutoTask link arrow */
.autotask-link {
    color: #dc3545;
    font-size: 1.2rem;
    font-weight: bold;
    text-decoration: none;
    display: inline-block;
    transition: transform 0.2s, color 0.2s;
}

.autotask-link:hover {
    color: #c82333;
    transform: translateX(3px);
}

.loading {
    text-align: center;
    padding: 3rem;
    color: #666;
}

.spinner {
    border: 3px solid #f3f3f3;
    border-top: 3px solid #007bff;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 0 auto 1rem;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.record-count {
    color: #666;
    font-size: 0.9rem;
}

.no-results {
    text-align: center;
    padding: 2rem;
    color: #666;
}

.filter-toggle {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
}

.filter-toggle label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
}

/* Enable Client Portal Button */
.btn-portal {
    background: #17a2b8;
    margin-left: 0.5rem;
}

.btn-portal:hover {
    background: #138496;
}

/* Portal Results Modal */
.portal-modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.portal-modal-overlay.active {
    display: flex;
}

.portal-modal {
    background: white;
    border-radius: 8px;
    padding: 2rem;
    max-width: 700px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.portal-modal h2 {
    margin-top: 0;
    margin-bottom: 1rem;
    color: #333;
}

.portal-modal .summary-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.portal-modal .summary-item {
    padding: 0.75rem;
    background: #f8f9fa;
    border-radius: 4px;
}

.portal-modal .summary-item .label {
    font-size: 0.8rem;
    color: #666;
    margin-bottom: 0.25rem;
}

.portal-modal .summary-item .value {
    font-size: 1.2rem;
    font-weight: 600;
    color: #333;
}

.portal-modal .company-list {
    max-height: 300px;
    overflow-y: auto;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    margin-bottom: 1rem;
}

.portal-modal .company-list table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.portal-modal .company-list th {
    background: #f8f9fa;
    padding: 0.5rem;
    text-align: left;
    border-bottom: 2px solid #dee2e6;
    position: sticky;
    top: 0;
}

.portal-modal .company-list td {
    padding: 0.4rem 0.5rem;
    border-bottom: 1px solid #eee;
}

.portal-modal .close-btn {
    padding: 0.6rem 2rem;
    background: #6c757d;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.95rem;
}

.portal-modal .close-btn:hover {
    background: #5a6268;
}

.portal-modal .classifications-list {
    margin-bottom: 1rem;
    padding: 0.75rem;
    background: #e7f3ff;
    border-radius: 4px;
    font-size: 0.85rem;
}

.portal-modal .classifications-list strong {
    display: block;
    margin-bottom: 0.25rem;
}
