/**
 * Estilos CSS para el shortcode de WhatsApp Condo360
 */

.condo360ws-container {
    max-width: 500px;
    margin: 20px auto;
    padding: 20px;
    border: 1px solid #ddd;
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.condo360ws-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #f0f0f0;
}

.condo360ws-header h3 {
    margin: 0;
    color: #333;
    font-size: 1.2em;
}

.condo360ws-status-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
}

.status-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #ccc;
    animation: pulse 2s infinite;
}

.status-dot.connected {
    background: #4CAF50;
    animation: none;
}

.status-dot.disconnected {
    background: #f44336;
}

.status-dot.checking {
    background: #ff9800;
}

.status-text {
    font-size: 0.9em;
    color: #666;
    font-weight: 500;
}

@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.5; }
    100% { opacity: 1; }
}

.condo360ws-content {
    text-align: center;
}

.condo360ws-qr-container h4 {
    color: #333;
    margin-bottom: 15px;
    font-size: 1.1em;
}

.qr-code-wrapper {
    background: #fff;
    padding: 20px;
    border-radius: 8px;
    border: 2px dashed #ddd;
    margin: 15px 0;
    display: inline-block;
}

.qr-code-wrapper img {
    max-width: 250px;
    height: auto;
    border-radius: 4px;
}

.qr-instructions {
    text-align: left;
    font-size: 0.9em;
    color: #666;
    line-height: 1.6;
    margin: 15px 0;
    padding: 15px;
    background: #f9f9f9;
    border-radius: 6px;
}

.condo360ws-connected {
    padding: 30px 20px;
}

.success-icon {
    width: 60px;
    height: 60px;
    background: #4CAF50;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    font-weight: bold;
    margin: 0 auto 20px;
}

.condo360ws-connected h4 {
    color: #4CAF50;
    margin-bottom: 10px;
    font-size: 1.2em;
}

.condo360ws-connected p {
    color: #666;
    margin: 0 0 20px 0;
}

/* Estilos para la sección de grupos */
.groups-section {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #f0f0f0;
}

.groups-section h5 {
    margin: 0 0 15px 0;
    color: #333;
    font-size: 1.1em;
}

.load-groups-btn {
    background: #4CAF50;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9em;
    transition: background 0.3s;
    margin-bottom: 15px;
}

.load-groups-btn:hover {
    background: #45a049;
}

.load-groups-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.groups-container {
    margin-top: 15px;
}

.groups-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 20px;
    color: #666;
}

.loading-spinner {
    width: 20px;
    height: 20px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #4CAF50;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.groups-list {
    max-height: 300px;
    overflow-y: auto;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: #fff;
}

.group-item {
    padding: 12px 15px;
    border-bottom: 1px solid #f0f0f0;
    cursor: pointer;
    transition: background 0.3s;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.group-item:hover {
    background: #f9f9f9;
}

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

.group-item.selected {
    background: #e3f2fd;
    border-left: 4px solid #2196F3;
}

.group-info {
    flex: 1;
}

.group-name {
    font-weight: 500;
    color: #333;
    display: block;
    margin-bottom: 4px;
}

.group-details {
    font-size: 0.8em;
    color: #666;
    display: block;
}

.group-id {
    font-family: monospace;
    font-size: 0.7em;
    color: #999;
    background: #f5f5f5;
    padding: 2px 6px;
    border-radius: 3px;
    margin-left: 10px;
}

.selected-group {
    margin-top: 20px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 6px;
    border: 1px solid #e9ecef;
}

.selected-group h6 {
    margin: 0 0 10px 0;
    color: #333;
    font-size: 1em;
}

.selected-group-info {
    margin-bottom: 15px;
}

.selected-group-info .group-name {
    display: block;
    font-weight: 500;
    color: #333;
    margin-bottom: 5px;
}

.selected-group-info .group-id {
    display: block;
    font-family: monospace;
    font-size: 0.8em;
    color: #666;
    background: #e9ecef;
    padding: 4px 8px;
    border-radius: 3px;
    margin: 0;
}

.set-group-btn {
    background: #2196F3;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9em;
    transition: background 0.3s;
}

.set-group-btn:hover {
    background: #1976D2;
}

.set-group-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
}

/* Mensaje cuando no hay grupos */
.no-groups-message {
    text-align: center;
    padding: 30px 20px;
    color: #666;
    font-style: italic;
}

.no-groups-message .icon {
    font-size: 2em;
    margin-bottom: 10px;
    display: block;
}

/* Responsive para grupos */
@media (max-width: 600px) {
    .group-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    
    .group-id {
        margin-left: 0;
        align-self: flex-start;
    }
    
    .groups-list {
        max-height: 250px;
    }
}

.condo360ws-error {
    padding: 30px 20px;
}

.error-icon {
    width: 60px;
    height: 60px;
    background: #f44336;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    font-weight: bold;
    margin: 0 auto 20px;
}

.condo360ws-error h4 {
    color: #f44336;
    margin-bottom: 10px;
    font-size: 1.2em;
}

.condo360ws-error p {
    color: #666;
    margin: 0;
}

.condo360ws-footer {
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid #f0f0f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.refresh-btn {
    background: #2196F3;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9em;
    transition: background 0.3s;
}

.refresh-btn:hover {
    background: #1976D2;
}

.refresh-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.last-updated {
    font-size: 0.8em;
    color: #999;
}

/* Responsive */
@media (max-width: 600px) {
    .condo360ws-container {
        margin: 10px;
        padding: 15px;
    }
    
    .condo360ws-header {
        flex-direction: column;
        gap: 10px;
        text-align: center;
    }
    
    .condo360ws-footer {
        flex-direction: column;
        text-align: center;
    }
    
    .qr-code-wrapper img {
        max-width: 200px;
    }
}

/* Estados de carga */
.condo360ws-loading {
    opacity: 0.7;
    pointer-events: none;
}

.condo360ws-loading .refresh-btn {
    background: #ccc;
}

/* Animaciones */
.condo360ws-container * {
    transition: all 0.3s ease;
}

.fade-in {
    animation: fadeIn 0.5s ease-in;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Estilos para mensajes de error específicos */
.condo360ws-error.qr-expired {
    border-left: 4px solid #ff9800;
}

.condo360ws-error.connection-failed {
    border-left: 4px solid #f44336;
}

.condo360ws-error.api-error {
    border-left: 4px solid #9c27b0;
}

/* Estilos mejorados para la nueva funcionalidad de grupos */
#groups-section {
    background: #fff;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 20px;
    margin-top: 20px;
}

#groups-section h5 {
    margin: 0 0 15px 0;
    color: #333;
    font-size: 18px;
    border-bottom: 2px solid #f0f0f0;
    padding-bottom: 10px;
}

#groups-loading {
    text-align: center;
    padding: 30px;
    color: #666;
}

#groups-list {
    margin-top: 15px;
}

.groups-list p {
    text-align: center;
    color: #666;
    font-style: italic;
    margin: 20px 0;
}

.groups-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 15px;
    margin-top: 15px;
}

.group-item {
    background: #fff;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    padding: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.group-item:hover {
    border-color: #007cba;
    box-shadow: 0 4px 12px rgba(0,124,186,0.2);
    transform: translateY(-3px);
}

.group-item:active {
    transform: translateY(-1px);
}

.group-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #007cba, #28a745);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.group-item:hover::before {
    opacity: 1;
}

.group-name {
    font-weight: bold;
    font-size: 18px;
    color: #333;
    margin-bottom: 10px;
    line-height: 1.3;
}

.group-id {
    font-size: 12px;
    color: #666;
    font-family: 'Courier New', monospace;
    background: #f8f9fa;
    padding: 6px 10px;
    border-radius: 4px;
    margin-bottom: 10px;
    word-break: break-all;
    border: 1px solid #e9ecef;
}

.group-participants {
    font-size: 14px;
    color: #666;
    display: flex;
    align-items: center;
    gap: 5px;
}

.group-participants::before {
    content: '👥';
    font-size: 16px;
}

/* Spinner mejorado */
.spinner {
    border: 3px solid #f3f3f3;
    border-top: 3px solid #007cba;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    animation: spin 1s linear infinite;
    margin: 0 auto 10px;
}

/* Responsive mejorado para grupos */
@media (max-width: 768px) {
    .groups-grid {
        grid-template-columns: 1fr;
    }
    
    .group-item {
        padding: 15px;
    }
    
    .group-name {
        font-size: 16px;
    }
    
    .condo360ws-container {
        max-width: 100%;
    }
}
