/**
 * WhatsApp Admin Styles
 */

/* Modal Styles */
.wpflow-modal {
    display: none;
    position: fixed;
    z-index: 100000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0,0,0,0.5);
}

.wpflow-modal-content {
    background-color: #fefefe;
    margin: 5% auto;
    padding: 0;
    border: none;
    width: 90%;
    max-width: 600px;
    border-radius: 8px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
}

.wpflow-modal-header {
    padding: 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 8px 8px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.wpflow-modal-header h2 {
    margin: 0;
    color: white;
    font-size: 20px;
}

.wpflow-modal-close {
    color: white;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    background: none;
    border: none;
    padding: 0;
    line-height: 1;
}

.wpflow-modal-close:hover,
.wpflow-modal-close:focus {
    opacity: 0.8;
}

.wpflow-modal-body {
    padding: 30px;
}

.wpflow-modal-footer {
    padding: 15px 30px;
    background: #f5f5f5;
    border-top: 1px solid #e0e0e0;
    border-radius: 0 0 8px 8px;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* Form Styles */
.wpflow-form-group {
    margin-bottom: 20px;
}

.wpflow-form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    color: #333;
}

.wpflow-form-group input[type="text"],
.wpflow-form-group input[type="number"],
.wpflow-form-group textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.wpflow-form-group input:focus,
.wpflow-form-group textarea:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.1);
}

.wpflow-form-group small {
    display: block;
    margin-top: 5px;
    color: #666;
    font-size: 12px;
}

/* QR Code Modal */
.wpflow-qr-content {
    text-align: center;
    padding: 20px;
}

.wpflow-pairing-code {
    margin-bottom: 30px;
}

.wpflow-pairing-code h3 {
    margin-bottom: 15px;
    color: #333;
}

.wpflow-pairing-code .code {
    font-size: 32px;
    font-weight: bold;
    color: #667eea;
    letter-spacing: 5px;
    padding: 15px;
    background: #f5f5f5;
    border-radius: 8px;
    display: inline-block;
}

.wpflow-qr-image img {
    max-width: 300px;
    width: 100%;
    height: auto;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 10px;
    background: white;
}

.wpflow-qr-instructions {
    margin-top: 30px;
    padding: 20px;
    background: #f9f9f9;
    border-radius: 8px;
}

.wpflow-qr-instructions h3 {
    margin-top: 0;
    color: #333;
}

.wpflow-qr-instructions ol {
    text-align: left;
    margin: 15px 0;
    padding-left: 20px;
}

.wpflow-qr-instructions li {
    margin-bottom: 10px;
}

/* Instance Cards */
.wpflow-instances-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.wpflow-instance-card {
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 20px;
    transition: box-shadow 0.3s;
}

.wpflow-instance-card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.wpflow-instance-header {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 15px;
}

.wpflow-instance-status {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    flex-shrink: 0;
}

.wpflow-instance-info {
    flex: 1;
}

.wpflow-instance-name {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

.wpflow-instance-number {
    margin: 5px 0 0;
    color: #666;
    font-size: 14px;
}

.wpflow-instance-actions {
    display: flex;
    gap: 5px;
}

.wpflow-instance-actions button {
    padding: 5px 10px;
    border: none;
    background: #f5f5f5;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
}

.wpflow-instance-actions button:hover {
    background: #e0e0e0;
}

.wpflow-instance-details {
    padding-top: 15px;
    border-top: 1px solid #f0f0f0;
}

.wpflow-instance-detail {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    font-size: 13px;
}

.wpflow-instance-detail strong {
    color: #666;
}

.wpflow-instance-footer {
    margin-top: 15px;
    display: flex;
    gap: 10px;
}

.wpflow-instance-footer button {
    flex: 1;
    padding: 8px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    transition: background 0.3s;
}

.wpflow-instance-footer .wpflow-btn-primary {
    background: #667eea;
    color: white;
}

.wpflow-instance-footer .wpflow-btn-primary:hover {
    background: #5a67d8;
}

.wpflow-instance-footer .wpflow-btn-danger {
    background: #ef4444;
    color: white;
}

.wpflow-instance-footer .wpflow-btn-danger:hover {
    background: #dc2626;
}

/* Chat Interface */
.wpflow-chat-container {
    display: flex;
    height: 600px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
    background: white;
}

.wpflow-conversations-list {
    width: 300px;
    border-right: 1px solid #e0e0e0;
    overflow-y: auto;
}

.wpflow-conversation-item {
    padding: 15px;
    border-bottom: 1px solid #f0f0f0;
    cursor: pointer;
    transition: background 0.2s;
}

.wpflow-conversation-item:hover {
    background: #f9f9f9;
}

.wpflow-conversation-item.active {
    background: #f0f4ff;
}

.wpflow-conversation-name {
    font-weight: 600;
    margin-bottom: 5px;
}

.wpflow-conversation-last-message {
    color: #666;
    font-size: 13px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.wpflow-conversation-time {
    color: #999;
    font-size: 11px;
    float: right;
}

.wpflow-chat-area {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.wpflow-chat-header {
    padding: 15px 20px;
    background: #f9f9f9;
    border-bottom: 1px solid #e0e0e0;
}

.wpflow-chat-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    background: #f5f5f5;
}

.wpflow-message {
    margin-bottom: 15px;
    display: flex;
}

.wpflow-message.sent {
    justify-content: flex-end;
}

.wpflow-message.received {
    justify-content: flex-start;
}

.wpflow-message .message-content {
    max-width: 70%;
    padding: 10px 15px;
    border-radius: 18px;
    word-wrap: break-word;
}

.wpflow-message.sent .message-content {
    background: #667eea;
    color: white;
}

.wpflow-message.received .message-content {
    background: white;
    color: #333;
}

.wpflow-message .message-time {
    font-size: 11px;
    color: #999;
    margin-top: 5px;
}

.wpflow-message.sent .message-time {
    text-align: right;
}

.wpflow-chat-input-area {
    padding: 15px 20px;
    border-top: 1px solid #e0e0e0;
    background: white;
}

.wpflow-chat-input-form {
    display: flex;
    gap: 10px;
}

#wpflow-message-input {
    flex: 1;
    padding: 10px 15px;
    border: 1px solid #ddd;
    border-radius: 25px;
    outline: none;
}

#wpflow-message-input:focus {
    border-color: #667eea;
}

#wpflow-send-btn {
    padding: 10px 20px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 25px;
    cursor: pointer;
    font-weight: 600;
}

#wpflow-send-btn:hover {
    background: #5a67d8;
}

#wpflow-send-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
}

/* Empty States */
.wpflow-empty-state {
    text-align: center;
    padding: 60px 20px;
}

.wpflow-empty-state p {
    color: #666;
    margin-bottom: 20px;
}

/* Buttons */
.wpflow-btn {
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s;
}

.wpflow-btn.primary {
    background: #667eea;
    color: white;
}

.wpflow-btn.primary:hover {
    background: #5a67d8;
}

.wpflow-btn.secondary {
    background: #6b7280;
    color: white;
}

.wpflow-btn.secondary:hover {
    background: #4b5563;
}

.wpflow-btn.danger {
    background: #ef4444;
    color: white;
}

.wpflow-btn.danger:hover {
    background: #dc2626;
}

.wpflow-btn.small {
    padding: 5px 10px;
    font-size: 12px;
}

/* Loading States */
.wpflow-loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #667eea;
    border-radius: 50%;
    animation: wpflow-spin 1s linear infinite;
}

@keyframes wpflow-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Responsive */
@media (max-width: 768px) {
    .wpflow-instances-grid {
        grid-template-columns: 1fr;
    }

    .wpflow-chat-container {
        flex-direction: column;
        height: auto;
    }

    .wpflow-conversations-list {
        width: 100%;
        max-height: 200px;
        border-right: none;
        border-bottom: 1px solid #e0e0e0;
    }

    .wpflow-modal-content {
        width: 95%;
        margin: 2% auto;
    }
}