/* 
==============================================
🧩 COMPONENTES REUTILIZABLES DEL CMS
==============================================
Botones, Cards, Forms, Badges y otros componentes
usables en todos los temas del sistema CMS.

Estos componentes pueden ser personalizados por cada
tema mediante modificadores de clase.
==============================================
*/

/* ==========================================
   SISTEMA DE BOTONES
   ========================================== */

/* Botón base - estilo neutral */
.cms-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    font-weight: 600;
    line-height: 1.5;
    text-align: center;
    text-decoration: none;
    border: none;
    border-radius: var(--border-radius, 8px);
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
    white-space: nowrap;
    user-select: none;
    -webkit-user-select: none;
}

.cms-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Botón primario - acción principal */
.cms-btn-primary {
    background: var(--primary-color, #2563EB);
    color: white;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.cms-btn-primary:hover:not(:disabled) {
    background: var(--secondary-color, #1D4ED8);
    transform: translateY(-1px);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.15);
}

.cms-btn-primary:active:not(:disabled) {
    transform: translateY(0);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

/* Botón secundario - acción secundaria */
.cms-btn-secondary {
    background: transparent;
    color: var(--primary-color, #2563EB);
    border: 2px solid var(--primary-color, #2563EB);
}

.cms-btn-secondary:hover:not(:disabled) {
    background: var(--primary-color, #2563EB);
    color: white;
    transform: translateY(-1px);
}

/* Botón con outline */
.cms-btn-outline {
    background: transparent;
    color: var(--text-color, #374151);
    border: 1px solid var(--border-color, #E5E7EB);
}

.cms-btn-outline:hover:not(:disabled) {
    background: var(--background, #F9FAFB);
    border-color: var(--primary-color, #2563EB);
    color: var(--primary-color, #2563EB);
}

/* Botón con degradado */
.cms-btn-gradient {
    background: linear-gradient(135deg, var(--primary-color, #2563EB) 0%, var(--secondary-color, #1D4ED8) 100%);
    color: white;
    box-shadow: 0 4px 6px rgba(37, 99, 235, 0.25);
}

.cms-btn-gradient:hover:not(:disabled) {
    box-shadow: 0 6px 12px rgba(37, 99, 235, 0.35);
    transform: translateY(-2px);
}

/* Botón de éxito */
.cms-btn-success {
    background: var(--accent-color, #10B981);
    color: white;
}

.cms-btn-success:hover:not(:disabled) {
    background: #059669;
    transform: translateY(-1px);
}

/* Botón de peligro */
.cms-btn-danger {
    background: #DC2626;
    color: white;
}

.cms-btn-danger:hover:not(:disabled) {
    background: #B91C1C;
    transform: translateY(-1px);
}

/* Tamaños de botones */
.cms-btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

.cms-btn-lg {
    padding: 1rem 2rem;
    font-size: 1.125rem;
}

.cms-btn-xl {
    padding: 1.25rem 2.5rem;
    font-size: 1.25rem;
}

/* Botón de ancho completo */
.cms-btn-block {
    display: flex;
    width: 100%;
}

/* Grupo de botones */
.cms-btn-group {
    display: inline-flex;
    gap: 0.5rem;
}

/* ==========================================
   SISTEMA DE CARDS (TARJETAS)
   ========================================== */

/* Card base */
.cms-card {
    background: var(--surface, white);
    border-radius: var(--border-radius, 8px);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    border: 1px solid var(--border-color, #E5E7EB);
    overflow: hidden;
    transition: all 0.3s ease;
}

.cms-card:hover {
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

/* Card con padding */
.cms-card-padded {
    padding: 1.5rem;
}

/* Card con hover elevado */
.cms-card-hover:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 15px rgba(0, 0, 0, 0.15);
}

/* Secciones de la card */
.cms-card-header {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border-color, #E5E7EB);
    background: var(--background, #F9FAFB);
}

.cms-card-body {
    padding: 1.5rem;
}

.cms-card-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border-color, #E5E7EB);
    background: var(--background, #F9FAFB);
}

/* Card con imagen */
.cms-card-image {
    width: 100%;
    height: auto;
    display: block;
}

.cms-card-image-container {
    position: relative;
    overflow: hidden;
}

/* Card de feature (características) */
.cms-card-feature {
    text-align: center;
    padding: 2rem;
}

.cms-card-feature .icon {
    font-size: 3rem;
    color: var(--primary-color, #2563EB);
    margin-bottom: 1rem;
}

.cms-card-feature h3 {
    color: var(--primary-color, #2563EB);
    margin: 1rem 0 0.5rem;
    font-size: 1.25rem;
    font-weight: 600;
}

.cms-card-feature p {
    color: var(--text-light, #6B7280);
    font-size: 0.9rem;
    line-height: 1.5;
}

/* Card de testimonio */
.cms-card-testimonial {
    background: linear-gradient(135deg, var(--primary-color, #2563EB) 0%, var(--secondary-color, #1D4ED8) 100%);
    color: white;
    padding: 2rem;
}

.cms-card-testimonial blockquote {
    font-style: italic;
    margin-bottom: 1rem;
    font-size: 1.1rem;
}

.cms-card-testimonial footer {
    font-weight: 600;
    opacity: 0.9;
}

/* ==========================================
   SISTEMA DE FORMULARIOS
   ========================================== */

/* Grupo de formulario */
.cms-form-group {
    margin-bottom: 1.5rem;
}

/* Label */
.cms-label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--text-color, #374151);
    font-size: 0.875rem;
}

.cms-label-required::after {
    content: ' *';
    color: #DC2626;
}

/* Inputs base */
.cms-input,
.cms-select,
.cms-textarea {
    width: 100%;
    padding: 0.75rem 1rem;
    font-size: 1rem;
    line-height: 1.5;
    color: var(--text-color, #374151);
    background: white;
    border: 1px solid var(--border-color, #E5E7EB);
    border-radius: var(--border-radius, 8px);
    transition: all 0.2s ease;
    font-family: inherit;
}

.cms-input:hover,
.cms-select:hover,
.cms-textarea:hover {
    border-color: #D1D5DB;
}

.cms-input:focus,
.cms-select:focus,
.cms-textarea:focus {
    outline: none;
    border-color: var(--primary-color, #2563EB);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.cms-input:disabled,
.cms-select:disabled,
.cms-textarea:disabled {
    background: #F3F4F6;
    cursor: not-allowed;
    opacity: 0.6;
}

/* Textarea */
.cms-textarea {
    resize: vertical;
    min-height: 120px;
}

/* Input de búsqueda */
.cms-input-search {
    padding-left: 2.5rem;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%236B7280'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z'%3E%3C/path%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: 0.75rem center;
    background-size: 1.25rem;
}

/* Estados de validación */
.cms-input-error,
.cms-select-error,
.cms-textarea-error {
    border-color: #DC2626;
}

.cms-input-error:focus,
.cms-select-error:focus,
.cms-textarea-error:focus {
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.1);
}

.cms-input-success,
.cms-select-success,
.cms-textarea-success {
    border-color: #10B981;
}

.cms-input-success:focus,
.cms-select-success:focus,
.cms-textarea-success:focus {
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
}

/* Mensajes de ayuda */
.cms-help-text {
    display: block;
    margin-top: 0.25rem;
    font-size: 0.875rem;
    color: var(--text-light, #6B7280);
}

.cms-error-text {
    display: block;
    margin-top: 0.25rem;
    font-size: 0.875rem;
    color: #DC2626;
}

.cms-success-text {
    display: block;
    margin-top: 0.25rem;
    font-size: 0.875rem;
    color: #10B981;
}

/* Checkbox y radio */
.cms-checkbox,
.cms-radio {
    width: 1.25rem;
    height: 1.25rem;
    cursor: pointer;
}

.cms-checkbox-label,
.cms-radio-label {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    font-weight: 400;
}

/* ==========================================
   BADGES (INSIGNIAS)
   ========================================== */

.cms-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1;
    border-radius: 9999px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.cms-badge-primary {
    background: rgba(37, 99, 235, 0.1);
    color: var(--primary-color, #2563EB);
}

.cms-badge-success {
    background: rgba(16, 185, 129, 0.1);
    color: #10B981;
}

.cms-badge-warning {
    background: rgba(245, 158, 11, 0.1);
    color: #F59E0B;
}

.cms-badge-danger {
    background: rgba(220, 38, 38, 0.1);
    color: #DC2626;
}

.cms-badge-info {
    background: rgba(59, 130, 246, 0.1);
    color: #3B82F6;
}

.cms-badge-gray {
    background: #F3F4F6;
    color: #6B7280;
}

/* Badge con punto indicador */
.cms-badge-dot::before {
    content: '';
    display: inline-block;
    width: 0.5rem;
    height: 0.5rem;
    border-radius: 50%;
    background: currentColor;
    margin-right: 0.5rem;
}

/* ==========================================
   ALERTS (ALERTAS)
   ========================================== */

.cms-alert {
    padding: 1rem 1.5rem;
    border-radius: var(--border-radius, 8px);
    border-left: 4px solid;
    margin-bottom: 1rem;
}

.cms-alert-success {
    background: rgba(16, 185, 129, 0.1);
    border-color: #10B981;
    color: #065F46;
}

.cms-alert-info {
    background: rgba(59, 130, 246, 0.1);
    border-color: #3B82F6;
    color: #1E40AF;
}

.cms-alert-warning {
    background: rgba(245, 158, 11, 0.1);
    border-color: #F59E0B;
    color: #92400E;
}

.cms-alert-danger {
    background: rgba(220, 38, 38, 0.1);
    border-color: #DC2626;
    color: #991B1B;
}

.cms-alert-title {
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.cms-alert-dismissible {
    position: relative;
    padding-right: 3rem;
}

.cms-alert-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: transparent;
    border: none;
    font-size: 1.25rem;
    cursor: pointer;
    opacity: 0.6;
    transition: opacity 0.2s;
}

.cms-alert-close:hover {
    opacity: 1;
}

/* ==========================================
   LOADING (CARGANDO)
   ========================================== */

.cms-spinner {
    display: inline-block;
    width: 2rem;
    height: 2rem;
    border: 3px solid rgba(0, 0, 0, 0.1);
    border-top-color: var(--primary-color, #2563EB);
    border-radius: 50%;
    animation: cms-spin 0.8s linear infinite;
}

@keyframes cms-spin {
    to {
        transform: rotate(360deg);
    }
}

.cms-spinner-sm {
    width: 1rem;
    height: 1rem;
    border-width: 2px;
}

.cms-spinner-lg {
    width: 3rem;
    height: 3rem;
    border-width: 4px;
}

/* Skeleton loader */
.cms-skeleton {
    background: linear-gradient(90deg, #F3F4F6 25%, #E5E7EB 50%, #F3F4F6 75%);
    background-size: 200% 100%;
    animation: cms-skeleton-loading 1.5s ease-in-out infinite;
    border-radius: var(--border-radius, 8px);
}

@keyframes cms-skeleton-loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

.cms-skeleton-text {
    height: 1rem;
    margin-bottom: 0.5rem;
}

.cms-skeleton-title {
    height: 1.5rem;
    margin-bottom: 1rem;
}

/* ==========================================
   TOOLTIPS
   ========================================== */

.cms-tooltip {
    position: relative;
    display: inline-block;
}

.cms-tooltip-text {
    visibility: hidden;
    opacity: 0;
    position: absolute;
    bottom: 125%;
    left: 50%;
    transform: translateX(-50%);
    background: #1F2937;
    color: white;
    padding: 0.5rem 0.75rem;
    border-radius: 0.375rem;
    font-size: 0.875rem;
    white-space: nowrap;
    z-index: 1000;
    transition: opacity 0.2s;
}

.cms-tooltip:hover .cms-tooltip-text {
    visibility: visible;
    opacity: 1;
}

.cms-tooltip-text::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    margin-left: -5px;
    border-width: 5px;
    border-style: solid;
    border-color: #1F2937 transparent transparent transparent;
}

/* ==========================================
   MODALS (Ya definidos en cms-theme.css, aquí solo estructura base)
   ========================================== */

.cms-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 9998;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.cms-modal-overlay.active {
    opacity: 1;
}

.cms-modal {
    background: white;
    border-radius: var(--border-radius, 8px);
    box-shadow: 0 20px 25px rgba(0, 0, 0, 0.15);
    max-width: 90vw;
    max-height: 90vh;
    overflow-y: auto;
    z-index: 9999;
    transform: scale(0.95);
    transition: transform 0.3s ease;
}

.cms-modal-overlay.active .cms-modal {
    transform: scale(1);
}

/* ==========================================
   RESULTADOS: PRICING & COVERAGE COMPONENTS
   ========================================== */

/* Company Logo */
.company-logo {
    height: 60px;
    width: auto;
    margin-bottom: 1rem;
    object-fit: contain;
}

/* Product Name */
.product-name {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--cms-color-primary, #2563EB);
    margin-bottom: 0.5rem;
}

/* Price Section */
.price-section {
    text-align: center;
    margin: 1.5rem 0;
}

.price-amount {
    font-size: 2rem;
    font-weight: 700;
    color: var(--cms-color-accent, #059669);
    display: block;
}

.price-period {
    font-size: 1rem;
    color: var(--cms-color-text-light, #6b7280);
    display: block;
    margin-top: 0.25rem;
}

/* Coverage List */
.coverage-list {
    list-style: none;
    padding: 0;
    margin: 1rem 0;
}

.coverage-item {
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--cms-color-border, #e5e7eb);
    color: var(--cms-color-text, #374151);
    display: flex;
    align-items: center;
}

.coverage-item:last-child {
    border-bottom: none;
}

.coverage-item::before {
    content: "✓";
    color: var(--cms-color-success, #059669);
    font-weight: bold;
    margin-right: 0.75rem;
    flex-shrink: 0;
}

/* No Results State */
.no-results {
    text-align: center;
    padding: 4rem 2rem;
    background: var(--cms-color-surface, white);
    border-radius: 16px;
    margin: 2rem 0;
}

.no-results-icon {
    font-size: 4rem;
    color: var(--cms-color-border-dark, #d1d5db);
    margin-bottom: 1rem;
}

.no-results-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--cms-color-text, #374151);
    margin-bottom: 1rem;
}

.no-results-text {
    color: var(--cms-color-text-light, #6b7280);
    margin-bottom: 2rem;
}

/* ==========================================
   RESPONSIVE
   ========================================== */

@media (max-width: 768px) {
    .cms-btn {
        padding: 0.625rem 1.25rem;
        font-size: 0.9375rem;
    }
    
    .cms-btn-sm {
        padding: 0.5rem 0.875rem;
        font-size: 0.8125rem;
    }
    
    .cms-card-padded {
        padding: 1rem;
    }
    
    .cms-form-group {
        margin-bottom: 1rem;
    }
}

/* ==========================================
   FIN DE COMPONENTES CMS
   ========================================== */
