/* ============================================
   PERFIL PROFESIONAL - DOMUS-IA
   Paleta: Silver (#C0C0C0) + Azul Marino (#1e3a8a)
   ============================================ */

:root {
    --primary-color: #1e3a8a;
    --secondary-color: #C0C0C0;
    --success-color: #10b981;
    --danger-color: #ef4444;
    --warning-color: #f59e0b;
    --text-dark: #1f2937;
    --text-light: #6b7280;
    --bg-light: #f9fafb;
    --bg-white: #ffffff;
    --border-color: #e5e7eb;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background-color: var(--bg-light);
    color: var(--text-dark);
    line-height: 1.6;
    overflow-x: hidden;
}

/* ============================================
   HEADER
   ============================================ */

.header {
    background: var(--bg-white);
    border-bottom: 1px solid var(--border-color);
    padding: 1rem 0;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-sm);
}

.header-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
}

.logo i {
    font-size: 1.75rem;
}

.nav-menu {
    display: flex;
    gap: 1rem;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.25rem;
    border-radius: 8px;
    text-decoration: none;
    color: var(--text-dark);
    font-weight: 500;
    transition: all 0.2s;
}

.nav-link:hover {
    background-color: var(--bg-light);
    color: var(--primary-color);
}

.nav-link.active {
    background-color: #5eead4;
    color: #134e4a;
}

.user-section {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.user-name {
    font-weight: 600;
    color: var(--text-dark);
}

.btn-logout {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.25rem;
    background-color: var(--secondary-color);
    color: var(--text-dark);
    border: none;
    border-radius: 8px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-logout:hover {
    background-color: #a9a9a9;
}

/* ============================================
   MAIN CONTAINER
   ============================================ */

.main-container {
    max-width: 1400px;
    margin: 2rem auto;
    padding: 0 2rem;
}

/* ============================================
   LOADING STATE
   ============================================ */

.loading-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 400px;
    gap: 1rem;
}

.spinner {
    width: 48px;
    height: 48px;
    border: 4px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* ============================================
   PAGE HEADER
   ============================================ */

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 2px solid var(--border-color);
}

.header-left h1 {
    font-size: 2rem;
    color: var(--text-dark);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}

.header-left h1 i {
    color: var(--primary-color);
}

.subtitle {
    color: var(--text-light);
    font-size: 1rem;
}

.header-right {
    display: flex;
    gap: 0.75rem;
}

/* ============================================
   BUTTONS
   ============================================ */

.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    font-weight: 500;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background-color: #1e40af;
}

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

.btn-success:hover {
    background-color: #059669;
}

.btn-secondary {
    background-color: var(--secondary-color);
    color: var(--text-dark);
}

.btn-secondary:hover {
    background-color: #a9a9a9;
}

.btn-danger {
    background-color: var(--danger-color);
    color: white;
}

.btn-danger:hover {
    background-color: #dc2626;
}

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

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* ============================================
   ALERT MESSAGES
   ============================================ */

#alertContainer {
    margin-bottom: 1.5rem;
}

.alert {
    padding: 1rem 1.5rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.alert i {
    font-size: 1.25rem;
}

.alert-success {
    background-color: #d1fae5;
    color: #065f46;
    border: 1px solid #6ee7b7;
}

.alert-error {
    background-color: #fee2e2;
    color: #991b1b;
    border: 1px solid #fca5a5;
}

.alert-warning {
    background-color: #fef3c7;
    color: #92400e;
    border: 1px solid #fcd34d;
}

.alert-info {
    background-color: #dbeafe;
    color: #1e40af;
    border: 1px solid #93c5fd;
}

/* ============================================
   PROFILE SECTIONS
   ============================================ */

.profile-sections {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.profile-section {
    background-color: var(--bg-white);
    border-radius: 12px;
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    background-color: var(--bg-light);
    border-bottom: 1px solid var(--border-color);
}

.section-header h2 {
    font-size: 1.25rem;
    color: var(--text-dark);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.section-header h2 i {
    color: var(--primary-color);
}

.section-status {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background-color: #d1fae5;
    color: #065f46;
    border-radius: 6px;
    font-size: 0.875rem;
    font-weight: 500;
}

.section-content {
    padding: 1.5rem;
}

/* ============================================
   FORMS
   ============================================ */

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.form-group:last-child {
    margin-bottom: 0;
}

.form-group label {
    font-weight: 500;
    color: var(--text-dark);
    font-size: 0.875rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.form-group label i {
    color: var(--primary-color);
}

.required {
    color: var(--danger-color);
}

.form-control {
    width: 100%;
    padding: 0.75rem 1rem;
    font-size: 1rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background-color: var(--bg-white);
    color: var(--text-dark);
    transition: all 0.2s;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(30, 58, 138, 0.1);
}

.form-control:read-only {
    background-color: var(--bg-light);
    cursor: not-allowed;
}

.form-control.error {
    border-color: var(--danger-color);
}

textarea.form-control {
    resize: vertical;
    min-height: 100px;
}

select.form-control {
    cursor: pointer;
}

.help-text {
    font-size: 0.875rem;
    color: var(--text-light);
}

/* ============================================
   LOGO UPLOAD
   ============================================ */

.logo-upload-group {
    margin-bottom: 1.5rem;
}

.logo-container {
    display: flex;
    align-items: center;
    gap: 2rem;
}

.logo-preview {
    width: 150px;
    height: 150px;
    border-radius: 12px;
    overflow: hidden;
    border: 2px solid var(--border-color);
    background-color: var(--bg-light);
    display: flex;
    align-items: center;
    justify-content: center;
}

.logo-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.logo-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    color: var(--text-light);
}

.logo-placeholder i {
    font-size: 3rem;
}

.logo-placeholder p {
    font-size: 0.875rem;
}

.logo-actions {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

/* ============================================
   BRAND COLORS PREVIEW
   ============================================ */

.brand-colors-container {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.color-preview-row {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.color-swatch {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    border: 2px solid var(--border-color);
    cursor: default;
    transition: transform 0.2s;
}

.color-swatch:hover {
    transform: scale(1.15);
}

/* ============================================
   EMPTY STATE OPTIONS LIST
   ============================================ */

.empty-options-list {
    list-style: none;
    padding: 0;
    margin: 0 auto 1.5rem auto;
    text-align: left;
    display: inline-block;
    max-width: 100%;
}

.empty-options-list li {
    padding: 0.5rem 0;
    font-size: 1rem;
    color: var(--text-dark);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.empty-options-list li i {
    width: 24px;
    color: var(--primary-color);
    font-size: 1.1rem;
    text-align: center;
}

.empty-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

/* ============================================
   AGENTS LIST
   ============================================ */

.agents-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1rem;
}

.agent-card {
    background-color: var(--bg-light);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1.25rem;
    position: relative;
}

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

.agent-name {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 0.25rem;
}

.agent-specialty {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    background-color: var(--primary-color);
    color: white;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 500;
}

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

.agent-actions button {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

.agent-edit-btn {
    background-color: var(--primary-color);
    color: white;
}

.agent-edit-btn:hover {
    background-color: #1e40af;
}

.agent-delete-btn {
    background-color: var(--danger-color);
    color: white;
}

.agent-delete-btn:hover {
    background-color: #dc2626;
}

.agent-info {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.agent-info-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: var(--text-light);
}

.agent-info-item i {
    width: 16px;
    color: var(--primary-color);
}

/* ============================================
   EMPTY STATES
   ============================================ */

.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-light);
}

.empty-state i {
    font-size: 4rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.empty-state p {
    font-size: 1.125rem;
}

.empty-profile-state,
.error-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 60vh;
    width: 100%;
    padding: 0 1rem;
    box-sizing: border-box;
}

.empty-content,
.error-content {
    text-align: center;
    max-width: 500px;
    width: 100%;
    margin: 0 auto;
}

.empty-content i,
.error-content i {
    font-size: 5rem;
    color: var(--text-light);
    margin-bottom: 1.5rem;
}

.empty-content h2,
.error-content h2 {
    font-size: 1.75rem;
    color: var(--text-dark);
    margin-bottom: 1rem;
}

.empty-content p,
.error-content p {
    font-size: 1.125rem;
    color: var(--text-light);
    margin-bottom: 1.5rem;
}

/* ============================================
   PROFILE FOOTER
   ============================================ */

.profile-footer {
    margin-top: 2rem;
    padding: 1.5rem;
    background-color: var(--bg-white);
    border-radius: 12px;
    box-shadow: var(--shadow-sm);
}

.footer-info {
    display: flex;
    gap: 2rem;
    justify-content: center;
    flex-wrap: wrap;
}

.footer-info p {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-light);
    font-size: 0.875rem;
}

.footer-info i {
    color: var(--primary-color);
}

.footer-info strong {
    color: var(--text-dark);
}

/* ============================================
   MODAL
   ============================================ */

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background-color: var(--bg-white);
    border-radius: 12px;
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.modal-header h3 {
    font-size: 1.25rem;
    color: var(--text-dark);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.modal-close {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: transparent;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    color: var(--text-light);
    transition: all 0.2s;
}

.modal-close:hover {
    background-color: var(--bg-light);
    color: var(--text-dark);
}

.modal-body {
    padding: 1.5rem;
}

.modal-body .form-group {
    margin-bottom: 1.25rem;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    padding: 1.5rem;
    border-top: 1px solid var(--border-color);
}

/* ============================================
   TOAST NOTIFICATIONS
   ============================================ */

.toast-container {
    position: fixed;
    top: 2rem;
    right: 2rem;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.toast {
    min-width: 300px;
    padding: 1rem 1.5rem;
    background-color: var(--bg-white);
    border-radius: 8px;
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    animation: slideIn 0.3s ease-out;
}

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

.toast-success {
    border-left: 4px solid var(--success-color);
}

.toast-error {
    border-left: 4px solid var(--danger-color);
}

.toast-warning {
    border-left: 4px solid var(--warning-color);
}

.toast-info {
    border-left: 4px solid var(--primary-color);
}

.toast i {
    font-size: 1.5rem;
}

.toast-success i {
    color: var(--success-color);
}

.toast-error i {
    color: var(--danger-color);
}

.toast-warning i {
    color: var(--warning-color);
}

.toast-info i {
    color: var(--primary-color);
}

.toast-message {
    flex: 1;
    color: var(--text-dark);
}

/* ============================================
   RESPONSIVE
   ============================================ */

@media (max-width: 1024px) {
    .header-content {
        padding: 0 1.5rem;
    }

    .main-container {
        padding: 0 1.5rem;
    }

    .nav-menu {
        gap: 0.5rem;
    }

    .nav-link {
        padding: 0.625rem 1rem;
        font-size: 0.875rem;
    }

    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    .header-right {
        width: 100%;
        flex-wrap: wrap;
    }
}

@media (max-width: 768px) {
    .header-content {
        flex-direction: column;
        gap: 1rem;
    }

    .nav-menu {
        width: 100%;
        flex-direction: column;
    }

    .nav-link {
        width: 100%;
        justify-content: center;
    }

    .user-section {
        width: 100%;
        justify-content: space-between;
    }

    .main-container {
        margin: 1rem auto;
        padding: 0 1rem;
        max-width: 100%;
        overflow-x: hidden;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .logo-container {
        flex-direction: column;
        align-items: center;
    }

    .agents-list {
        grid-template-columns: 1fr;
    }

    .footer-info {
        flex-direction: column;
        gap: 0.75rem;
    }

    .toast-container {
        left: 1rem;
        right: 1rem;
        top: 1rem;
    }

    .toast {
        min-width: auto;
        width: 100%;
    }

    /* Empty state: stack buttons vertically, prevent horizontal overflow */
    .empty-profile-state {
        min-height: auto;
        padding: 2rem 1rem;
    }

    .empty-content {
        max-width: 100%;
        padding: 0 0.5rem;
    }

    .empty-content i {
        font-size: 3.5rem;
    }

    .empty-content h2 {
        font-size: 1.35rem;
    }

    .empty-content p {
        font-size: 1rem;
    }

    .empty-actions {
        flex-direction: column;
        gap: 0.75rem;
    }

    .empty-actions .btn {
        width: 100%;
        justify-content: center;
    }

    .empty-options-list {
        width: 100%;
    }

    .empty-options-list li {
        font-size: 0.9rem;
    }

    .profile-cta-banner {
        padding: 14px 16px;
        border-radius: 10px;
    }
}

@media (max-width: 480px) {
    .header-left h1 {
        font-size: 1.5rem;
    }

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

    .section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    .modal-content {
        width: 95%;
    }
}

/* ============================================
   PROFILE CTA BANNER (voice call)
   ============================================ */
.profile-cta-banner {
    background: linear-gradient(135deg, #1e3a8a 0%, #2563eb 50%, #1e3a8a 100%);
    border-radius: 14px;
    padding: 16px 24px;
    margin-bottom: 24px;
    box-shadow: 0 4px 20px rgba(30, 58, 138, 0.25);
    width: 100%;
    max-width: 600px;
    box-sizing: border-box;
}

.cta-banner-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}

.cta-banner-text {
    display: flex;
    align-items: center;
    gap: 12px;
    color: white;
    font-size: 0.95rem;
    font-weight: 500;
}

.cta-banner-text i {
    font-size: 1.4rem;
    color: #93c5fd;
}

.cta-banner-btn {
    background: white;
    color: #1e3a8a;
    border: none;
    padding: 10px 24px;
    border-radius: 10px;
    font-weight: 700;
    font-size: 0.9rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s;
    white-space: nowrap;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.cta-banner-btn:hover {
    background: #dbeafe;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.cta-banner-btn i {
    color: #2563eb;
}

@media (max-width: 640px) {
    .cta-banner-content {
        flex-direction: column;
        text-align: center;
    }
    .cta-banner-text {
        flex-direction: column;
        gap: 8px;
    }
    .cta-banner-btn {
        width: 100%;
        justify-content: center;
    }
}

/* ============================================
   SAVE BUTTON ANIMATION
   ============================================ */
.save-btn-animated {
    transition: all 0.3s ease;
    position: relative;
}

.save-btn-animated.pulse-save {
    animation: pulseSave 0.6s ease;
}

@keyframes pulseSave {
    0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.5); }
    50% { transform: scale(1.05); box-shadow: 0 0 0 8px rgba(34, 197, 94, 0); }
    100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(34, 197, 94, 0); }
}

/* ============================================
   COMPANY IMAGES GALLERY
   ============================================ */
.company-images-group {
    margin-top: 16px;
}

.company-images-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 12px;
    margin-bottom: 12px;
    min-height: 60px;
}

.company-image-card {
    position: relative;
    border-radius: 8px;
    overflow: hidden;
    background: #f1f5f9;
    aspect-ratio: 4/3;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    transition: transform 0.2s;
}

.company-image-card:hover {
    transform: scale(1.02);
}

.company-image-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.company-image-remove {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: rgba(239, 68, 68, 0.9);
    color: white;
    border: none;
    font-size: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s;
}

.company-image-card:hover .company-image-remove {
    opacity: 1;
}

.company-images-actions {
    display: flex;
    gap: 8px;
}

/* Inline editable fields — always editable look */
.form-control {
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-control:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
    outline: none;
}
