/* ==========================================================================
   Contabilidad General Express - Estilos del Panel de Compañías (Dashboard)
   ========================================================================== */

.dashboard-wrapper {
    max-width: 1280px;
    margin: 0 auto;
    padding: 32px 24px;
}

/* Topbar Header */
.dashboard-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 32px;
    flex-wrap: wrap;
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.page-title {
    font-size: 1.75rem;
    font-weight: 700;
}

.plan-quota-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background-color: var(--primary-light);
    color: var(--primary);
    padding: 6px 14px;
    border-radius: var(--radius-full);
    font-size: 0.85rem;
    font-weight: 600;
}

/* Actions in Topbar */
.topbar-actions {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

/* Search Box */
.search-container {
    position: relative;
    width: 320px;
}

.search-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 1rem;
    pointer-events: none;
}

.search-input {
    width: 100%;
    padding: 9px 36px 9px 38px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    background-color: var(--bg-surface);
    color: var(--text-main);
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.search-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.clear-search {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-light);
    cursor: pointer;
    font-size: 1rem;
}

.clear-search:hover {
    color: var(--text-muted);
}

.btn-add {
    box-shadow: 0 2px 4px rgba(37, 99, 235, 0.2);
}

/* User Menu & Avatar Dropdown */
.user-dropdown-wrapper {
    position: relative;
}

.btn-avatar {
    background: none;
    border: 1px solid var(--border-color);
    padding: 4px 8px 4px 4px;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    background-color: var(--bg-surface);
    transition: border-color var(--transition-fast);
}

.btn-avatar:hover {
    border-color: var(--border-hover);
}

.avatar-circle {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    color: #ffffff;
    font-weight: 700;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.dropdown-arrow {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.user-dropdown-menu {
    position: absolute;
    right: 0;
    top: 48px;
    width: 240px;
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    z-index: 200;
    padding: 8px 0;
    animation: fadeIn 0.15s ease;
}

.dropdown-header {
    padding: 12px 16px;
    display: flex;
    flex-direction: column;
}

.dropdown-header strong {
    font-size: 0.925rem;
    color: var(--text-main);
}

.dropdown-header small {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.dropdown-divider {
    height: 1px;
    background-color: var(--border-color);
    margin: 6px 0;
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    font-size: 0.875rem;
    color: var(--text-main);
    transition: background-color var(--transition-fast);
}

.dropdown-item:hover {
    background-color: var(--bg-subtle);
    color: var(--primary);
}

.dropdown-item.text-danger {
    color: var(--danger);
}

.dropdown-item.text-danger:hover {
    background-color: var(--danger-light);
    color: var(--danger);
}

/* Companies Grid Layout */
.companies-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 24px;
}

/* Company Card Element */
.company-card {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 24px;
    position: relative;
    box-shadow: var(--shadow-sm);
    transition: transform var(--transition-normal), box-shadow var(--transition-normal), border-color var(--transition-normal);
    display: flex;
    flex-direction: column;
}

.company-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
    border-color: var(--border-hover);
}

.company-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 16px;
}

.company-logo-box {
    width: 130px;
    aspect-ratio: 2 / 1;
    border-radius: var(--radius-md);
    background-color: var(--primary-light);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.4rem;
    border: 1px solid rgba(79, 70, 229, 0.15);
    overflow: hidden;
}

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

/* Logo Preview 2:1 Box */
.logo-preview-wrapper {
    background-color: var(--bg-subtle);
    border: 1px dashed var(--border-color);
    border-radius: var(--radius-md);
    padding: 16px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.logo-preview-box {
    width: 100%;
    max-width: 320px;
    aspect-ratio: 2 / 1;
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-sm);
}

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

.logo-preview-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    color: var(--text-muted);
    font-size: 0.825rem;
    text-align: center;
    padding: 10px;
}

.logo-preview-placeholder i {
    font-size: 1.8rem;
    color: var(--text-light);
}

/* 3-Dots Action Menu */
.company-menu-wrapper {
    position: relative;
}

.btn-menu-dots {
    background: none;
    border: none;
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-size: 1.1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color var(--transition-fast), color var(--transition-fast);
}

.btn-menu-dots:hover {
    background-color: var(--bg-subtle);
    color: var(--text-main);
}

.company-actions-dropdown {
    position: absolute;
    right: 0;
    top: 36px;
    width: 170px;
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    z-index: 100;
    padding: 6px 0;
}

.company-taxid-badge {
    display: inline-block;
    padding: 3px 8px;
    background-color: var(--bg-subtle);
    color: var(--text-muted);
    border-radius: var(--radius-sm);
    font-size: 0.775rem;
    font-weight: 600;
    margin-bottom: 8px;
    width: fit-content;
}

.company-title {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 6px;
    line-height: 1.3;
}

.company-role-tag {
    font-size: 0.8rem;
    color: var(--text-light);
    margin-bottom: 4px;
}

.company-fiscal-tag {
    font-size: 0.825rem;
    color: var(--primary);
    font-weight: 500;
    margin-bottom: 18px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.company-card-footer {
    margin-top: auto;
    padding-top: 16px;
    border-top: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* Empty Grid State */
.empty-grid-state {
    grid-column: 1 / -1;
    background-color: var(--bg-surface);
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-lg);
    padding: 60px 20px;
    text-align: center;
    color: var(--text-muted);
}

.empty-icon {
    font-size: 3rem;
    color: var(--text-light);
    margin-bottom: 16px;
}

.empty-grid-state h3 {
    font-size: 1.25rem;
    margin-bottom: 8px;
}

.empty-grid-state p {
    font-size: 0.925rem;
    margin-bottom: 24px;
    max-width: 400px;
    margin-left: auto;
    margin-right: auto;
}

/* Modal / Card Upgrade Required */
.upgrade-card {
    max-width: 520px;
    width: 90%;
    border-radius: var(--radius-xl);
    overflow: hidden;
}

.upgrade-header {
    text-align: center;
    padding: 30px 24px 16px;
}

.upgrade-header h3 {
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 6px;
}

.upgrade-header p {
    font-size: 0.95rem;
    color: var(--text-muted);
    margin: 0;
}

.upgrade-icon {
    width: 64px;
    height: 64px;
    background-color: #fffbeb;
    color: #d97706;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    margin: 0 auto 16px;
    border: 1px solid #fde68a;
}

.upgrade-body {
    padding: 0 28px 20px 28px;
}

.upgrade-notice {
    background-color: #fffbeb;
    border: 1px solid #fde68a;
    color: #92400e;
    padding: 14px 18px;
    border-radius: var(--radius-lg);
    display: flex;
    align-items: flex-start;
    gap: 14px;
    font-size: 0.9rem;
    margin-bottom: 24px;
}

.upgrade-notice i {
    font-size: 1.35rem;
    color: #d97706;
    flex-shrink: 0;
    margin-top: 2px;
}

.upgrade-notice p {
    margin: 0;
    line-height: 1.45;
    text-align: left;
}

.upgrade-benefits {
    padding: 0 4px;
}

.upgrade-benefits h4 {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 12px;
    text-align: left;
}

.upgrade-benefits ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.upgrade-benefits ul li {
    font-size: 0.9rem;
    color: #475569;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 10px;
    text-align: left;
}

.upgrade-benefits ul li i {
    color: #10b981;
    font-size: 1.1rem;
}

.upgrade-footer {
    padding: 16px 28px 24px 28px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    border-top: 1px solid #f1f5f9;
}
