/* Premium search container */
.search-container {
    margin-bottom: var(--space-8);
    position: relative;
    max-width: 400px;
}

/* Table wrapper for horizontal scroll */
.table-wrapper {
    overflow-x: auto;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    background: var(--color-white);
    border: 1px solid var(--color-gray-200);
}

.search-input {
    width: 100%;
    height: var(--space-12);
    padding: 0 var(--space-4);
    padding-right: var(--space-10); /* Space for clear button */
    border: 1px solid var(--color-gray-300);
    border-radius: var(--radius-lg);
    font-size: 0.875rem;
    font-weight: 400;
    color: var(--color-gray-800);
    background-color: var(--color-white);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--shadow-sm);
}

.search-input::placeholder {
    color: var(--color-gray-400);
    font-weight: 400;
}

.search-input:focus {
    outline: none;
    border-color: var(--color-accent);
    box-shadow: 0 0 0 3px var(--color-accent-light), var(--shadow-sm);
}

/* Premium clear button with SVG icon */
.search-clear {
    position: absolute;
    right: var(--space-3);
    top: 50%;
    transform: translateY(-50%);
    width: var(--space-6);
    height: var(--space-6);
    background: none;
    border: none;
    color: var(--color-gray-400);
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
}

.search-clear:hover {
    color: var(--color-gray-600);
    background-color: var(--color-gray-100);
}

.search-clear::before {
    content: '';
    width: 14px;
    height: 14px;
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><line x1="18" y1="6" x2="6" y2="18"></line><line x1="6" y1="6" x2="18" y2="18"></line></svg>');
    background-repeat: no-repeat;
    background-position: center;
    background-size: contain;
}

/* Premium highlight styles */
mark {
    background-color: var(--color-warning-light);
    color: var(--color-gray-900);
    padding: 0.125rem 0.25rem;
    border-radius: var(--radius-sm);
    font-weight: 500;
}

.highlight-cell {
    display: inline-block;
    width: 100%;
    background-color: var(--color-accent-light);
    padding: var(--space-1) var(--space-2);
    border-radius: var(--radius-sm);
    position: relative;
    font-weight: 500;
}

.highlight-cell::before {
    content: '';
    position: absolute;
    top: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 12px;
    height: 12px;
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="%232563EB" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="18,15 12,9 6,15"></polyline></svg>');
    background-repeat: no-repeat;
    background-position: center;
    background-size: contain;
    opacity: 0.6;
}

/* Premium table design */
.agent-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    background: var(--color-white);
    table-layout: auto; /* Allow flexible column widths */
    border-radius: var(--radius-xl);
    overflow: hidden;
}

.agent-table th {
    background: var(--color-gray-50);
    padding: var(--space-5) var(--space-6);
    text-align: left;
    font-weight: 600;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--color-gray-600);
    border-bottom: 1px solid var(--color-gray-200);
    white-space: nowrap;
}

/* Smart column width allocation */
.agent-table th:first-child,
.agent-table td:first-child {
    width: auto;
    min-width: 120px; /* Ensure IDs have enough space */
    max-width: 200px; /* But don't let them get too wide */
}

/* Name column - most important, gets more space */
.agent-table th:nth-child(2),
.agent-table td:nth-child(2) {
    width: auto;
    min-width: 150px;
}

/* Description column - flexible but constrained */
.agent-table th:nth-child(3),
.agent-table td:nth-child(3) {
    width: auto;
    min-width: 200px;
    max-width: 300px;
}

/* URL columns - compact display */
.agent-table th:nth-child(n+4),
.agent-table td:nth-child(n+4) {
    width: auto;
    min-width: 80px;
}

.agent-table th:first-child {
    border-top-left-radius: var(--radius-xl);
}

.agent-table th:last-child {
    border-top-right-radius: var(--radius-xl);
}

.agent-table td {
    padding: var(--space-5) var(--space-6);
    border-bottom: 1px solid var(--color-gray-100);
    position: relative;
    font-size: 0.875rem;
    color: var(--color-gray-800);
    vertical-align: middle;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.agent-table tbody tr {
    transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
}

.agent-table tbody tr:hover {
    background-color: var(--color-gray-50);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.agent-table tbody tr:last-child td {
    border-bottom: none;
}

.agent-table tbody tr:last-child td:first-child {
    border-bottom-left-radius: var(--radius-xl);
}

.agent-table tbody tr:last-child td:last-child {
    border-bottom-right-radius: var(--radius-xl);
}

/* Premium status messages */
.error-message {
    color: var(--color-error);
    padding: var(--space-8);
    text-align: center;
    background: var(--color-error-light);
    border-radius: var(--radius-lg);
    margin-top: var(--space-8);
    border: 1px solid var(--color-error);
    font-weight: 500;
}

.loading-message {
    text-align: center;
    padding: var(--space-20);
    color: var(--color-gray-500);
    font-weight: 400;
    font-size: 0.875rem;
}

.no-results {
    text-align: center;
    padding: var(--space-16) var(--space-8);
    color: var(--color-gray-500);
    font-weight: 400;
    font-size: 0.875rem;
}

/* Premium modal design */
.modal {
    display: none;
    position: fixed;
    inset: 0;
    background-color: rgba(15, 20, 25, 0.6);
    backdrop-filter: blur(8px);
    justify-content: center;
    align-items: center;
    z-index: 1000;
    padding: var(--space-4);
}

.modal-content {
    background-color: var(--color-white);
    padding: var(--space-8);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    border: 1px solid var(--color-gray-200);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-8);
    padding-bottom: var(--space-6);
    border-bottom: 1px solid var(--color-gray-100);
}

.modal-header h2 {
    margin: 0;
    color: var(--color-gray-900);
    font-size: 1.25rem;
    font-weight: 600;
}

.close-button {
    background: none;
    border: none;
    width: var(--space-8);
    height: var(--space-8);
    cursor: pointer;
    color: var(--color-gray-400);
    border-radius: var(--radius-md);
    transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
}

.close-button:hover {
    color: var(--color-gray-600);
    background-color: var(--color-gray-100);
}

.close-button::before {
    content: '';
    width: 20px;
    height: 20px;
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><line x1="18" y1="6" x2="6" y2="18"></line><line x1="6" y1="6" x2="18" y2="18"></line></svg>');
    background-repeat: no-repeat;
    background-position: center;
    background-size: contain;
}

/* Premium form design */
.agent-form {
    display: flex;
    flex-direction: column;
    gap: var(--space-6);
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.form-group label {
    font-weight: 500;
    color: var(--color-gray-700);
    font-size: 0.875rem;
}

.form-group input[type="text"],
.form-group input[type="url"],
.form-group textarea {
    padding: var(--space-3) var(--space-4);
    border: 1px solid var(--color-gray-300);
    border-radius: var(--radius-lg);
    font-size: 0.875rem;
    color: var(--color-gray-800);
    background-color: var(--color-white);
    transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--shadow-sm);
}

.form-group input[type="text"]:focus,
.form-group input[type="url"]:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--color-accent);
    box-shadow: 0 0 0 3px var(--color-accent-light), var(--shadow-sm);
}

.form-group textarea {
    min-height: 120px;
    resize: vertical;
    line-height: 1.5;
}

.checkbox-group {
    flex-direction: row;
    align-items: center;
    gap: var(--space-3);
}

.checkbox-group label {
    font-weight: 400;
    cursor: pointer;
    user-select: none;
}

.checkbox-group input[type="checkbox"] {
    width: var(--space-4);
    height: var(--space-4);
    margin: 0;
    accent-color: var(--color-accent);
}

.form-actions {
    display: flex;
    gap: var(--space-3);
    margin-top: var(--space-6);
    padding-top: var(--space-6);
    border-top: 1px solid var(--color-gray-100);
}

/* Premium button design */
.promote-button,
.submit-button {
    background-color: var(--color-accent);
    color: var(--color-white);
    border: none;
    padding: var(--space-3) var(--space-6);
    border-radius: var(--radius-lg);
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--shadow-sm);
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
}

.promote-button:hover,
.submit-button:hover {
    background-color: var(--color-accent-dark);
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

.cancel-button {
    background-color: var(--color-white);
    color: var(--color-gray-700);
    border: 1px solid var(--color-gray-300);
    padding: var(--space-3) var(--space-6);
    border-radius: var(--radius-lg);
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--shadow-sm);
}

.cancel-button:hover {
    background-color: var(--color-gray-50);
    border-color: var(--color-gray-400);
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: var(--shadow-sm) !important;
}

/* Premium form validation */
.form-group input.error,
.form-group textarea.error {
    border-color: var(--color-error);
    background-color: var(--color-error-light);
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.1);
}

.field-error {
    color: var(--color-error);
    font-size: 0.75rem;
    font-weight: 500;
    margin-top: var(--space-1);
    animation: fadeIn 0.2s ease-out;
}

/* Premium notification system */
.notification {
    position: fixed;
    top: var(--space-6);
    right: var(--space-6);
    padding: var(--space-4) var(--space-6);
    border-radius: var(--radius-lg);
    color: var(--color-white);
    font-size: 0.875rem;
    font-weight: 500;
    z-index: 1001;
    animation: slideIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--shadow-xl);
    max-width: 400px;
    word-break: break-word;
    backdrop-filter: blur(8px);
}

.notification.success {
    background-color: var(--color-success);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.notification.error {
    background-color: var(--color-error);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.notification.fade-out {
    animation: fadeOut 0.3s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

/* Required field indicator */
.form-group.required label::after {
    content: '*';
    color: var(--color-error);
    margin-left: var(--space-1);
    font-weight: 600;
}

/* Premium animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

@keyframes slideIn {
    from {
        transform: translateX(100%) translateY(-20px);
        opacity: 0;
        scale: 0.95;
    }
    to {
        transform: translateX(0) translateY(0);
        opacity: 1;
        scale: 1;
    }
}

@keyframes shimmer {
    0% {
        background-position: -200px 0;
    }
    100% {
        background-position: calc(200px + 100%) 0;
    }
}

.loading-shimmer {
    background: linear-gradient(
        90deg,
        var(--color-gray-100) 0%,
        var(--color-gray-200) 20%,
        var(--color-gray-100) 40%,
        var(--color-gray-100) 100%
    );
    background-size: 200px 100%;
    animation: shimmer 1.5s infinite ease-in-out;
}

/* Mobile responsiveness */
@media (max-width: 768px) {
    .container {
        padding: 0 var(--space-4);
    }
    
    .search-container {
        margin-bottom: var(--space-6);
    }
    
    .agent-table {
        font-size: 0.8rem;
        border-radius: var(--radius-lg);
    }
    
    .agent-table th,
    .agent-table td {
        padding: var(--space-3) var(--space-4);
    }
    
    .agent-table th {
        font-size: 0.7rem;
    }
    
    /* Hide less important columns on mobile */
    .agent-table th:nth-child(n+5),
    .agent-table td:nth-child(n+5) {
        display: none;
    }
    
    .modal {
        padding: var(--space-2);
        align-items: flex-end;
    }
    
    .modal-content {
        border-radius: var(--radius-xl) var(--radius-xl) 0 0;
        max-height: 85vh;
        padding: var(--space-6);
    }
    
    .form-actions {
        flex-direction: column;
    }
    
    .form-actions button {
        width: 100%;
        justify-content: center;
    }
    
    .notification {
        left: var(--space-4);
        right: var(--space-4);
        top: var(--space-4);
        max-width: none;
    }
}

@media (max-width: 480px) {
    .agent-table th:nth-child(n+4),
    .agent-table td:nth-child(n+4) {
        display: none;
    }
    
    .search-input {
        height: var(--space-10);
        font-size: 1rem; /* Prevent zoom on iOS */
    }
}

/* Hover states for touch devices */
@media (hover: none) {
    .agent-table tbody tr:hover {
        background-color: initial;
        transform: none;
        box-shadow: none;
    }
    
    .agent-table tbody tr:active {
        background-color: var(--color-gray-50);
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .agent-table {
        border: 2px solid var(--color-gray-800);
    }
    
    .agent-table th {
        border-bottom: 2px solid var(--color-gray-800);
    }
    
    .agent-table td {
        border-bottom: 1px solid var(--color-gray-600);
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    .agent-table tbody tr {
        transition: none;
    }
    
    .agent-table tbody tr:hover {
        transform: none;
    }
}

/* Focus management for accessibility */
.search-input:focus {
    outline: 2px solid var(--color-accent);
    outline-offset: 2px;
}

.agent-table tbody tr:focus {
    outline: 2px solid var(--color-accent);
    outline-offset: -2px;
}

button:focus-visible {
    outline: 2px solid var(--color-accent);
    outline-offset: 2px;
}

/* Loading states */
.search-input.loading {
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="%236B7785" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M21 12a9 9 0 11-6.219-8.56"/></svg>');
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 16px;
    padding-right: 40px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from {
        background-position: right 12px center;
        transform: rotate(0deg);
    }
    to {
        background-position: right 12px center;
        transform: rotate(360deg);
    }
}

/* Premium scrollbars */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--color-gray-100);
    border-radius: var(--radius-sm);
}

::-webkit-scrollbar-thumb {
    background: var(--color-gray-300);
    border-radius: var(--radius-sm);
    transition: background-color 0.2s;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--color-gray-400);
}

/* Selection styling */
::selection {
    background-color: var(--color-accent-light);
    color: var(--color-accent-dark);
}

/* Print styles */
@media print {
    .search-container,
    .form-actions,
    .close-button,
    .search-clear {
        display: none !important;
    }
    
    .agent-table {
        box-shadow: none;
        border: 1px solid var(--color-gray-800);
    }
    
    .agent-table tbody tr:hover {
        background-color: transparent;
        transform: none;
    }
} 