/* File: css/m365-clients.css — M365 Clients dashboard */

.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;
}

.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;
}

.btn-portal {
    background: #17a2b8;
    margin-left: 0.5rem;
}

.btn-portal:hover {
    background: #138496;
}

.config-warning {
    background: #fff3cd;
    border: 1px solid #ffc107;
    color: #856404;
    border-radius: 6px;
    padding: 12px 16px;
    margin-bottom: 16px;
}

.add-client-panel {
    background: #fff;
    border-radius: 8px;
    padding: 16px 20px;
    margin-bottom: 20px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.add-client-panel h2 {
    font-size: 1.05rem;
    margin: 0 0 12px;
}

.add-client-form {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.add-client-form input,
.add-client-form select {
    flex: 1 1 200px;
    padding: 8px 10px;
    border: 1px solid #ccc;
    border-radius: 5px;
    font-size: 0.95rem;
}

.controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    gap: 10px;
    flex-wrap: wrap;
}

.clients-table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.clients-table th,
.clients-table td {
    padding: 10px 12px;
    text-align: left;
    border-bottom: 1px solid #eee;
    font-size: 0.92rem;
    vertical-align: middle;
}

.clients-table th {
    background: #f8f9fa;
    font-weight: 600;
    white-space: nowrap;
}

.clients-table tr:hover td {
    background: #f8fbff;
}

.clients-table select.company-select {
    max-width: 220px;
    padding: 5px 6px;
    border: 1px solid #ccc;
    border-radius: 4px;
}

.tenant-domain {
    font-family: monospace;
    font-size: 0.88rem;
}

.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 600;
    white-space: nowrap;
    cursor: default;
}

.badge-granted { background: #d4edda; color: #155724; }
.badge-pending { background: #fff3cd; color: #856404; }
.badge-error   { background: #f8d7da; color: #721c24; }

.users-cell {
    white-space: nowrap;
    font-size: 0.85rem;
    line-height: 1.5;
}

.last-sync {
    font-size: 0.85rem;
    color: #555;
    max-width: 220px;
}

.row-actions {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.row-actions .btn-sm {
    padding: 4px 10px;
    font-size: 0.8rem;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    color: #fff;
    background: #0078d4;
}

.row-actions .btn-sm:hover { opacity: 0.88; }
.row-actions .btn-sm:disabled { opacity: 0.5; cursor: not-allowed; }
.row-actions .btn-grant  { background: #6f42c1; }
.row-actions .btn-check  { background: #6c757d; }
.row-actions .btn-sync   { background: #28a745; }
.row-actions .btn-delete { background: #dc3545; }

/* Autotask → WiseTrack contact sync panel */
.atwt-panel {
    background: #fff;
    border-radius: 8px;
    padding: 16px 20px;
    margin-top: 28px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.atwt-panel h2 {
    font-size: 1.05rem;
    margin: 0 0 8px;
}

.atwt-help {
    color: #555;
    font-size: 0.9rem;
    margin: 0 0 14px;
}

.atwt-settings {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 16px;
    margin-bottom: 14px;
}

.atwt-settings input[type="number"] {
    width: 80px;
    margin-left: 6px;
    padding: 5px 6px;
    border: 1px solid #ccc;
    border-radius: 4px;
}

.atwt-settings input[type="text"] {
    width: 200px;
    margin-left: 6px;
    padding: 5px 6px;
    border: 1px solid #ccc;
    border-radius: 4px;
}

.atwt-detail {
    margin-top: 20px;
}

.atwt-note {
    background: #fff3cd;
    color: #856404;
    border-radius: 4px;
    padding: 6px 10px;
    margin: 0 0 6px;
    font-size: 0.88rem;
}

.atwt-row-delete td {
    background: #fdf0f1;
}
