/**
 * Talent Directory Styles
 * Recruiter-facing talent marketplace UI
 *
 * @package DataDNA_Agent_Connector
 */

/* =============================================================================
   CSS Variables (inherit from storefront where possible)
   ============================================================================= */
:root {
    --td-primary: #2563eb;
    --td-primary-dark: #1d4ed8;
    --td-primary-light: #3b82f6;
    --td-secondary: #0f172a;
    --td-success: #059669;
    --td-warning: #d97706;
    --td-gray-50: #f8fafc;
    --td-gray-100: #f1f5f9;
    --td-gray-200: #e2e8f0;
    --td-gray-300: #cbd5e1;
    --td-gray-400: #94a3b8;
    --td-gray-500: #64748b;
    --td-gray-600: #475569;
    --td-gray-700: #334155;
    --td-gray-800: #1e293b;
    --td-gray-900: #0f172a;
    --td-radius-sm: 6px;
    --td-radius-md: 12px;
    --td-radius-lg: 16px;
    --td-shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --td-shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --td-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --td-shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

/* =============================================================================
   Base Layout
   ============================================================================= */
.talent-directory {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    color: var(--td-gray-900);
    line-height: 1.6;
}

/* =============================================================================
   Loading & Error States
   ============================================================================= */
.talent-loading {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--td-gray-500);
}

.talent-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--td-gray-200);
    border-top-color: var(--td-primary);
    border-radius: 50%;
    margin: 0 auto 1rem;
    animation: td-spin 1s linear infinite;
}

@keyframes td-spin {
    to { transform: rotate(360deg); }
}

.talent-error {
    text-align: center;
    padding: 3rem;
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: var(--td-radius-md);
    color: #dc2626;
}

.talent-empty {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--td-gray-500);
    background: var(--td-gray-50);
    border-radius: var(--td-radius-md);
}

.talent-empty-text {
    color: var(--td-gray-400);
    font-style: italic;
    margin: 0.5rem 0;
}

/* =============================================================================
   Subscribe CTA Banner
   ============================================================================= */
.talent-subscribe-cta {
    background: linear-gradient(135deg, #1e40af 0%, #3b82f6 50%, #8b5cf6 100%);
    color: white;
    padding: 2.5rem;
    border-radius: var(--td-radius-lg);
    text-align: center;
    margin-bottom: 2rem;
    box-shadow: var(--td-shadow-lg);
}

.talent-subscribe-cta h2 {
    margin: 0 0 0.75rem;
    font-size: 1.75rem;
    font-weight: 700;
}

.talent-subscribe-cta p {
    margin: 0 0 1.5rem;
    opacity: 0.9;
    font-size: 1.1rem;
}

.talent-subscribe-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

/* =============================================================================
   Filters Bar
   ============================================================================= */
.talent-filters {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 2rem;
    padding: 1.5rem;
    background: var(--td-gray-50);
    border-radius: var(--td-radius-md);
    border: 1px solid var(--td-gray-200);
}

.talent-search {
    flex: 2;
    min-width: 200px;
}

.talent-filter-select {
    flex: 1;
    min-width: 150px;
}

.talent-filter-score {
    flex: 1;
    min-width: 180px;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.talent-filter-score label {
    font-size: 0.875rem;
    color: var(--td-gray-600);
    font-weight: 500;
}

.talent-filter-score #score-value {
    font-weight: 700;
    color: var(--td-primary);
}

.talent-search input,
.talent-filter-select select {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--td-gray-300);
    border-radius: var(--td-radius-sm);
    font-size: 0.9375rem;
    color: var(--td-gray-700);
    background: white;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.talent-search input:focus,
.talent-filter-select select:focus {
    outline: none;
    border-color: var(--td-primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.talent-filter-score input[type="range"] {
    width: 100%;
    height: 6px;
    background: var(--td-gray-200);
    border-radius: 3px;
    appearance: none;
    cursor: pointer;
}

.talent-filter-score input[type="range"]::-webkit-slider-thumb {
    appearance: none;
    width: 18px;
    height: 18px;
    background: var(--td-primary);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: var(--td-shadow-sm);
}

.talent-filter-score input[type="range"]::-moz-range-thumb {
    width: 18px;
    height: 18px;
    background: var(--td-primary);
    border-radius: 50%;
    cursor: pointer;
    border: none;
}

/* =============================================================================
   Profile Grid
   ============================================================================= */
.talent-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
}

/* =============================================================================
   Profile Cards
   ============================================================================= */
.talent-card {
    background: white;
    border-radius: var(--td-radius-md);
    box-shadow: var(--td-shadow-md);
    padding: 1.5rem;
    transition: transform 0.2s, box-shadow 0.2s;
    cursor: pointer;
    border: 1px solid var(--td-gray-100);
}

.talent-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--td-shadow-lg);
    border-color: var(--td-primary-light);
}

.talent-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0.5rem;
}

.talent-card h3 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--td-secondary);
}

.talent-score-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--td-primary) 0%, var(--td-primary-light) 100%);
    color: white;
    font-weight: 700;
    font-size: 0.9rem;
    border-radius: 50%;
    flex-shrink: 0;
}

.talent-location {
    color: var(--td-gray-500);
    font-size: 0.9rem;
    margin: 0 0 1rem;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.talent-tools {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin: 1rem 0;
}

.talent-tool-tag {
    background: var(--td-gray-100);
    color: var(--td-gray-700);
    padding: 0.25rem 0.625rem;
    border-radius: 4px;
    font-size: 0.8125rem;
    font-weight: 500;
}

.talent-tool-more {
    background: var(--td-gray-200);
    color: var(--td-gray-600);
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
}

.talent-tools-full {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.talent-submissions {
    color: var(--td-gray-500);
    font-size: 0.875rem;
    margin: 0 0 1rem;
}

.talent-card-actions {
    display: flex;
    gap: 0.75rem;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--td-gray-100);
}

.talent-btn-view,
.talent-btn-contact {
    flex: 1;
    padding: 0.625rem 1rem;
    border: none;
    border-radius: var(--td-radius-sm);
    font-weight: 600;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s;
}

.talent-btn-view {
    background: var(--td-gray-100);
    color: var(--td-gray-700);
}

.talent-btn-view:hover {
    background: var(--td-gray-200);
}

.talent-btn-contact {
    background: var(--td-success);
    color: white;
}

.talent-btn-contact:hover {
    background: #047857;
}

/* =============================================================================
   Modal Overlay
   ============================================================================= */
.talent-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 99999;
    padding: 20px;
    animation: td-fadeIn 0.2s ease;
}

@keyframes td-fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.talent-modal {
    background: white;
    border-radius: var(--td-radius-lg);
    max-width: 700px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    box-shadow: var(--td-shadow-xl);
    animation: td-slideUp 0.3s ease;
}

@keyframes td-slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* =============================================================================
   Modal Header
   ============================================================================= */
.talent-modal-header {
    padding: 1.5rem 2rem;
    border-bottom: 1px solid var(--td-gray-200);
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    position: sticky;
    top: 0;
    background: white;
    z-index: 1;
    border-radius: var(--td-radius-lg) var(--td-radius-lg) 0 0;
}

.talent-modal-header h2 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--td-secondary);
}

.talent-modal-location {
    margin: 0.25rem 0 0;
    color: var(--td-gray-500);
    font-size: 0.9375rem;
}

.talent-modal-close {
    background: none;
    border: none;
    font-size: 1.75rem;
    color: var(--td-gray-400);
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    line-height: 1;
    border-radius: var(--td-radius-sm);
    transition: all 0.2s;
}

.talent-modal-close:hover {
    color: var(--td-gray-700);
    background: var(--td-gray-100);
}

/* =============================================================================
   Modal Content
   ============================================================================= */
.talent-modal-content {
    padding: 1.5rem 2rem 2rem;
}

.talent-modal-section {
    margin-bottom: 2rem;
}

.talent-modal-section:last-child {
    margin-bottom: 0;
}

.talent-modal-section h4 {
    margin: 0 0 1rem;
    font-size: 1rem;
    font-weight: 600;
    color: var(--td-gray-700);
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

.talent-modal-section > p {
    margin: 0;
    color: var(--td-gray-600);
    line-height: 1.7;
}

/* =============================================================================
   Score Breakdown
   ============================================================================= */
.talent-scores-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.talent-score-item {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
}

.talent-score-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.talent-score-label {
    font-size: 0.8125rem;
    color: var(--td-gray-600);
    font-weight: 500;
}

.talent-score-value {
    font-weight: 700;
    font-size: 0.875rem;
    color: var(--td-primary);
}

.talent-score-bar {
    height: 8px;
    background: var(--td-gray-200);
    border-radius: 4px;
    overflow: hidden;
}

.talent-score-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--td-primary) 0%, var(--td-primary-light) 100%);
    border-radius: 4px;
    transition: width 0.5s ease;
}

.talent-score-average {
    margin: 1rem 0 0;
    padding: 1rem;
    background: var(--td-gray-50);
    border-radius: var(--td-radius-sm);
    text-align: center;
    color: var(--td-gray-600);
}

.talent-score-average strong {
    font-size: 1.5rem;
    color: var(--td-primary);
}

/* =============================================================================
   Challenge History
   ============================================================================= */
.talent-history-list {
    border: 1px solid var(--td-gray-200);
    border-radius: var(--td-radius-sm);
    overflow: hidden;
}

.talent-history-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.875rem 1rem;
    border-bottom: 1px solid var(--td-gray-100);
    background: white;
}

.talent-history-item:last-child {
    border-bottom: none;
}

.talent-history-item:nth-child(even) {
    background: var(--td-gray-50);
}

.talent-history-info {
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
}

.talent-history-challenge {
    font-weight: 500;
    color: var(--td-gray-800);
    font-size: 0.9375rem;
}

.talent-history-date {
    color: var(--td-gray-500);
    font-size: 0.8125rem;
}

.talent-history-score {
    font-weight: 700;
    font-size: 1rem;
    color: var(--td-success);
    background: rgba(5, 150, 105, 0.1);
    padding: 0.25rem 0.625rem;
    border-radius: 4px;
}

/* =============================================================================
   Contact Section
   ============================================================================= */
.talent-contact-section {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--td-gray-200);
}

.talent-contact-section h4 {
    margin: 0 0 1rem;
    font-size: 1rem;
    font-weight: 600;
    color: var(--td-gray-700);
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

.talent-contact-locked {
    color: var(--td-gray-500);
    margin: 0 0 1rem;
    padding: 1rem;
    background: var(--td-gray-50);
    border-radius: var(--td-radius-sm);
    border-left: 3px solid var(--td-warning);
}

.talent-subscribe-inline {
    text-align: center;
}

.talent-contact-revealed {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.talent-contact-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 1rem;
    background: var(--td-gray-100);
    border-radius: var(--td-radius-sm);
    text-decoration: none;
    color: var(--td-gray-700);
    font-weight: 500;
    font-size: 0.9375rem;
    transition: all 0.2s;
}

.talent-contact-link:hover {
    background: var(--td-gray-200);
    color: var(--td-gray-900);
}

.talent-contact-link svg {
    flex-shrink: 0;
}

.talent-contact-email {
    background: var(--td-success);
    color: white;
}

.talent-contact-email:hover {
    background: #047857;
    color: white;
}

.talent-btn-reveal {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    background: var(--td-primary);
    color: white;
    border: none;
    border-radius: var(--td-radius-sm);
    font-weight: 600;
    font-size: 0.9375rem;
    cursor: pointer;
    transition: all 0.2s;
    width: 100%;
}

.talent-btn-reveal:hover {
    background: var(--td-primary-dark);
}

.talent-btn-reveal:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.talent-btn-loading {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: td-spin 0.8s linear infinite;
}

/* =============================================================================
   Buttons
   ============================================================================= */
.talent-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.5rem;
    border-radius: var(--td-radius-sm);
    font-weight: 600;
    font-size: 0.9375rem;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
    text-decoration: none;
}

.talent-btn-starter {
    background: white;
    color: var(--td-primary-dark);
}

.talent-btn-starter:hover {
    background: var(--td-gray-100);
    transform: translateY(-1px);
}

.talent-btn-pro {
    background: #fbbf24;
    color: var(--td-secondary);
}

.talent-btn-pro:hover {
    background: #f59e0b;
    transform: translateY(-1px);
}

/* =============================================================================
   Responsive Design
   ============================================================================= */
@media (max-width: 768px) {
    .talent-directory {
        padding: 12px;
    }

    .talent-filters {
        flex-direction: column;
        padding: 1rem;
    }

    .talent-search,
    .talent-filter-select,
    .talent-filter-score {
        min-width: 100%;
    }

    .talent-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .talent-card {
        padding: 1.25rem;
    }

    .talent-subscribe-cta {
        padding: 1.5rem;
        margin-bottom: 1.5rem;
    }

    .talent-subscribe-cta h2 {
        font-size: 1.375rem;
    }

    .talent-subscribe-buttons {
        flex-direction: column;
    }

    /* Modal responsive */
    .talent-modal-overlay {
        padding: 10px;
        align-items: flex-end;
    }

    .talent-modal {
        max-height: calc(100vh - 20px);
        border-radius: var(--td-radius-lg) var(--td-radius-lg) 0 0;
    }

    .talent-modal-header {
        padding: 1.25rem 1.5rem;
    }

    .talent-modal-header h2 {
        font-size: 1.25rem;
    }

    .talent-modal-content {
        padding: 1.25rem 1.5rem 1.5rem;
    }

    .talent-scores-grid {
        grid-template-columns: 1fr;
    }

    .talent-history-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

    .talent-contact-revealed {
        flex-direction: column;
    }

    .talent-contact-link {
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .talent-card-header {
        flex-direction: column;
        gap: 0.75rem;
    }

    .talent-score-badge {
        align-self: flex-start;
    }

    .talent-card-actions {
        flex-direction: column;
    }

    .talent-btn-view,
    .talent-btn-contact {
        width: 100%;
    }
}

/* =============================================================================
   Print Styles
   ============================================================================= */
@media print {
    .talent-modal-overlay {
        display: none;
    }

    .talent-subscribe-cta {
        display: none;
    }

    .talent-filters {
        display: none;
    }

    .talent-card-actions {
        display: none;
    }
}

/* =============================================================================
   Toast Notifications
   ============================================================================= */
.talent-toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10001;
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: 400px;
}

.talent-toast {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 18px;
    background: var(--td-gray-800);
    color: white;
    border-radius: var(--td-radius-md);
    box-shadow: var(--td-shadow-lg);
    animation: talent-toast-in 0.3s ease;
}

.talent-toast-hiding {
    animation: talent-toast-out 0.3s ease forwards;
}

@keyframes talent-toast-in {
    from {
        opacity: 0;
        transform: translateX(100%);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes talent-toast-out {
    from {
        opacity: 1;
        transform: translateX(0);
    }
    to {
        opacity: 0;
        transform: translateX(100%);
    }
}

.talent-toast-info {
    background: var(--td-primary);
}

.talent-toast-success {
    background: var(--td-success);
}

.talent-toast-warning {
    background: var(--td-warning);
}

.talent-toast-error {
    background: #dc2626;
}

.talent-toast-message {
    flex: 1;
    font-size: 0.9375rem;
    line-height: 1.4;
}

.talent-toast-close {
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    border-radius: 4px;
    color: white;
    font-size: 1.25rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.talent-toast-close:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* =============================================================================
   Confirm Dialog
   ============================================================================= */
.talent-confirm-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10002;
    animation: talent-fade-in 0.2s ease;
}

@keyframes talent-fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

.talent-confirm-dialog {
    background: white;
    border-radius: var(--td-radius-lg);
    padding: 24px;
    max-width: 400px;
    width: 90%;
    box-shadow: var(--td-shadow-xl);
    animation: talent-scale-in 0.2s ease;
}

@keyframes talent-scale-in {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.talent-confirm-message {
    margin: 0 0 20px 0;
    font-size: 1rem;
    color: var(--td-gray-700);
    line-height: 1.5;
}

.talent-confirm-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

.talent-confirm-actions .talent-btn {
    min-width: 100px;
}
