/* Livewire Components Styles */

/* Dropdown Focus Override - Match Theme Color */
.dropdown-toggle:focus,
.btn-outline-secondary:focus,
.btn-outline-secondary.dropdown-toggle:focus {
    outline: 0;
    box-shadow: 0 0 0 0.2rem rgba(102, 126, 234, 0.25) !important;
    border-color: #667eea !important;
}

.dropdown-item.active,
.dropdown-item:active {
    background-color: #667eea !important;
}

/* Profile Manager Styles */
.profile-card {
    border: 2px solid #e9ecef;
    border-radius: 15px;
    transition: all 0.3s ease;
    overflow: visible;
    animation: fadeIn 0.5s ease-out;
    background: #fafbff;
    position: relative;
    z-index: 1;
}

.profile-card .card-header,
.profile-card .card-body {
    overflow: hidden;
}

.profile-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    border-color: #667eea;
    z-index: 100;
}

.profile-card:has(.dropdown-menu.show) {
    z-index: 100;
}

/* Compact List View Styles */
.col-12 .profile-card {
    border-radius: 0;
    border: none;
    border-bottom: 1px solid #e9ecef;
    margin-bottom: 0;
    box-shadow: none;
}

.col-12:first-child .profile-card {
    border-top-left-radius: 15px;
    border-top-right-radius: 15px;
}

.col-12:last-child .profile-card {
    border-bottom-left-radius: 15px;
    border-bottom-right-radius: 15px;
}

.col-12 .profile-card:last-child {
    border-bottom: none;
}

.col-12 .profile-card:hover,
.col-12 .profile-card.profile-default:hover {
    transform: none !important;
    box-shadow: none !important;
    background: linear-gradient(
        135deg,
        rgba(102, 126, 234, 0.08) 0%,
        rgba(118, 75, 162, 0.08) 100%
    ) !important;
    z-index: 2;
}

.col-12 .profile-card .card-body {
    padding: 0.75rem 1rem;
}

.col-12 .profile-card.profile-default {
    background: rgba(102, 126, 234, 0.02);
}

/* Dropdown menu always on top */
.dropdown {
    position: static;
}

.dropdown-menu {
    z-index: 10000 !important;
}

.dropdown-active {
    position: relative;
    z-index: 9999 !important;
}

.dropdown-active .profile-card {
    position: relative;
    z-index: 9999 !important;
}

.profile-card.profile-default {
    border-color: #667eea;
    background: linear-gradient(
        135deg,
        rgba(102, 126, 234, 0.05) 0%,
        rgba(118, 75, 162, 0.05) 100%
    );
}

.profile-card.profile-editing {
    border-color: #ffc107;
    background: rgba(255, 193, 7, 0.05);
}

.profile-card .card-header {
    background: linear-gradient(135deg, #f0f2ff 0%, #f5f3ff 100%);
    border-bottom: 2px solid #e9ecef;
    padding: 1rem 1.25rem;
    font-weight: 600;
    border-radius: 18px 18px 0 0;
}

.profile-card .card-body {
    padding: 1.25rem;
}

.profile-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.profile-actions .btn {
    border-radius: 8px;
    padding: 0.5rem 1rem;
    font-weight: 600;
    transition: all 0.3s ease;
}

.profile-actions .btn:hover {
    transform: translateY(-2px);
}

/* Document Upload Styles */
.upload-area {
    border: 3px dashed #667eea;
    border-radius: 15px;
    padding: 3rem 2rem;
    text-align: center;
    transition: all 0.3s ease;
    background: linear-gradient(
        135deg,
        rgba(102, 126, 234, 0.03) 0%,
        rgba(118, 75, 162, 0.03) 100%
    );
}

.upload-area:hover {
    border-color: #764ba2;
    background: linear-gradient(
        135deg,
        rgba(102, 126, 234, 0.08) 0%,
        rgba(118, 75, 162, 0.08) 100%
    );
}

.upload-area.drag-over {
    border-color: #28a745;
    background: rgba(40, 167, 69, 0.1);
    transform: scale(1.02);
}

.upload-icon {
    font-size: 3rem;
    color: #667eea;
    margin-bottom: 1rem;
}

/* Processing Status Styles */
.processing-status {
    background: linear-gradient(
        135deg,
        rgba(102, 126, 234, 0.05) 0%,
        rgba(118, 75, 162, 0.05) 100%
    );
    border-left: 4px solid #667eea;
    border-radius: 12px;
    padding: 1rem 1.5rem;
    margin: 1rem 0;
    animation: fadeIn 0.5s ease-out;
}

.processing-spinner {
    display: inline-block;
    width: 1.5rem;
    height: 1.5rem;
    border: 3px solid rgba(102, 126, 234, 0.3);
    border-radius: 50%;
    border-top-color: #667eea;
    animation: spin 1s linear infinite;
}

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

/* Data Manager Styles */
.profile-selector {
    position: sticky;
    top: 20px;
}

.profile-item {
    border: 2px solid #e9ecef;
    border-radius: 12px;
    padding: 1rem;
    margin-bottom: 0.75rem;
    transition: all 0.3s ease;
    cursor: pointer;
    background: white;
}

.profile-item:hover {
    border-color: #667eea;
    background: rgba(102, 126, 234, 0.05);
    transform: translateX(5px);
}

.profile-item.active {
    border-color: #667eea;
    background: linear-gradient(
        135deg,
        rgba(102, 126, 234, 0.1) 0%,
        rgba(118, 75, 162, 0.1) 100%
    );
    box-shadow: 0 3px 10px rgba(102, 126, 234, 0.2);
}

.profile-item .badge {
    border-radius: 20px;
    padding: 0.4rem 0.8rem;
    font-weight: 600;
}

/* Data Fields Tabs */
.nav-tabs {
    border-bottom: 2px solid #e9ecef;
}

@media (max-width: 576px) {
    .nav-tabs {
        border-bottom: none !important;
    }

    .nav-tabs .nav-link.active::after {
        display: none !important;
    }
}

.nav-tabs .nav-link {
    border: none;
    color: #718096;
    font-weight: 500;
    padding: 0.875rem 1.25rem;
    transition: all 0.3s ease;
    position: relative;
    border-radius: 8px 8px 0 0;
}

.nav-tabs .nav-link:hover {
    color: #667eea;
    background: rgba(102, 126, 234, 0.05);
}

.nav-tabs .nav-link.active {
    color: #667eea;
    background: white;
    font-weight: 600;
}

.nav-tabs .nav-link.active::after {
    content: "";
    position: absolute;
    bottom: -2px;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 3px 3px 0 0;
}

/* Field Rows */
.field-row {
    border: 2px solid #e9ecef;
    border-radius: 12px;
    padding: 1rem;
    margin-bottom: 0.75rem;
    transition: all 0.3s ease;
    background: white;
}

.field-row:hover {
    border-color: #667eea;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.05);
}

.field-row.editing {
    border-color: #ffc107;
    background: rgba(255, 193, 7, 0.03);
}

.field-label {
    font-weight: 600;
    color: #2d3748;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.field-value {
    color: #4a5568;
    padding: 0.75rem;
    background: #f7fafc;
    border-radius: 8px;
    border: 1px solid #e9ecef;
}

/* Document History */
.document-history-card {
    border: 2px solid #e9ecef;
    border-radius: 15px;
    overflow: hidden;
    background: white;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.document-history-header {
    background: linear-gradient(135deg, #f0f2ff 0%, #f5f3ff 100%);
    padding: 1rem 1.25rem;
    border-bottom: 2px solid #e9ecef;
}

.document-history-body {
    padding: 1rem;
}

.document-history-item {
    padding: 0.875rem;
    margin-bottom: 0.5rem;
    border-radius: 10px;
    background: #f8f9fa;
    transition: all 0.3s ease;
    display: flex;
    align-items: start;
    position: relative;
    z-index: 1;
}

.document-history-item:last-child {
    margin-bottom: 0;
}

.document-history-item:hover {
    background: #e9ecef;
    transform: translateX(5px);
    z-index: 100;
}

.document-filename {
    font-weight: 600;
    color: #2d3748;
    font-size: 0.9rem;
}

.document-count-badge {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 0.25rem 0.6rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    min-width: 2rem;
    text-align: center;
}

.document-status-success {
    color: #28a745;
    font-weight: 500;
}

.document-status-error {
    color: #dc3545;
    font-weight: 500;
}

.document-status-warning {
    color: #ffc107;
    font-weight: 500;
}

.document-actions {
    opacity: 0.7;
    transition: opacity 0.2s;
    position: relative;
    z-index: 10;
}

.document-history-item:hover .document-actions {
    opacity: 1;
}

.document-actions .btn {
    padding: 0.25rem 0.5rem;
    font-size: 0.875rem;
}

.document-actions .dropdown-menu {
    z-index: 1050;
}

.document-status {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 0.8rem;
    border-radius: 20px;
    font-weight: 600;
    font-size: 0.85rem;
}

.document-status.processing {
    background: rgba(255, 193, 7, 0.1);
    color: #ffc107;
}

.document-status.completed {
    background: rgba(40, 167, 69, 0.1);
    color: #28a745;
}

.document-status.failed {
    background: rgba(220, 53, 69, 0.1);
    color: #dc3545;
}

/* Buttons */
.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    border-radius: 10px;
    padding: 0.625rem 1.5rem;
    font-weight: 600;
    transition: all 0.3s ease;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(102, 126, 234, 0.4);
}

.btn-primary:disabled {
    background: #e9ecef;
    color: #718096;
    cursor: not-allowed;
    transform: none;
}

.btn-secondary {
    border: 2px solid #cbd5e0;
    border-radius: 10px;
    padding: calc(0.625rem - 2px) calc(1.5rem - 2px);
    font-weight: 600;
    transition: all 0.3s ease;
    background: white;
    color: #4a5568;
}

.btn-secondary:hover {
    border-color: #667eea;
    background: #f7fafc;
    color: #667eea;
    transform: translateY(-2px);
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

/* Cards */
.card {
    border: none;
    border-radius: 15px;
    box-shadow: 0 3px 15px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
    margin-bottom: 0.75rem;
    background: #fafbff;
}

.card-header {
    background: linear-gradient(135deg, #f0f2ff 0%, #f5f3ff 100%);
    border-bottom: 2px solid #e9ecef;
    padding: 1.25rem 1.5rem;
    border-radius: 15px 15px 0 0;
    font-weight: 600;
}

.card-header h5,
.card-header h6 {
    margin: 0;
    color: #2d3748;
}

.card-body {
    padding: 1.5rem;
}

/* Form Controls */
.form-label {
    color: #2d3748;
    font-weight: 500;
}

.form-control,
.form-select {
    border: 2px solid #e9ecef;
    border-radius: 10px;
    padding: 0.75rem 1rem;
    transition: all 0.3s ease;
    background: white;
    color: #2d3748;
}

.form-control:focus,
.form-select:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 0.2rem rgba(102, 126, 234, 0.15);
}

.form-check-input {
    width: 1.25rem;
    height: 1.25rem;
    border: 2px solid #e9ecef;
    cursor: pointer;
}

.form-check-input:checked {
    background-color: #667eea;
    border-color: #667eea;
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideIn {
    from {
        transform: translateX(-20px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .profile-card,
    .field-row,
    .document-history-item {
        margin-bottom: 0.5rem;
    }

    .profile-actions {
        flex-direction: row;
        justify-content: center;
    }

    .profile-actions .btn {
        width: auto;
        padding: 0.5rem 0.75rem;
    }

    .profile-actions .btn .btn-text {
        display: none;
    }

    .upload-area {
        padding: 2rem 1rem;
    }

    .btn-primary,
    .btn-success,
    .btn-danger,
    .btn-secondary {
        width: 100%;
        margin-bottom: 0.5rem;
    }
}
