/* Cirku Messages Frontend Styles */

/* Product Page Messages Section */
.cirku-messages-section {
    margin-top: 40px;
    padding: 30px;
    background: #f9f9f9;
    border: 1px solid #e0e0e0;
    border-radius: 5px;
}

.cirku-messages-section h2 {
    margin-top: 0;
    margin-bottom: 20px;
    color: #333;
    font-size: 24px;
}

/* Messages Container */
.messages-container {
    background: #fff;
    padding: 20px;
    border-radius: 5px;
}

/* Messages History */
.messages-history {
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid #e0e0e0;
}

.messages-history h4 {
    margin-top: 0;
    margin-bottom: 15px;
    color: #666;
    font-size: 16px;
}

/* Messages List */
.messages-list {
    max-height: 400px;
    overflow-y: auto;
    padding-right: 10px;
}

.messages-list::-webkit-scrollbar {
    width: 6px;
}

.messages-list::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.messages-list::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 3px;
}

/* Individual Message */
.message {
    margin-bottom: 15px;
    padding: 12px;
    border-radius: 5px;
    animation: slideIn 0.3s ease-out;
}

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

.message-customer {
    background: #e3f2fd;
    margin-left: 20px;
}

.message-shop_manager,
.message-admin {
    background: #f3e5f5;
    margin-right: 20px;
}

.message-guest {
    background: #fff3e0;
    margin-left: 20px;
}

.message-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    font-size: 12px;
}

.sender-name {
    font-weight: 600;
    color: #333;
}

.message-time {
    color: #999;
}

.message-content {
    color: #333;
    line-height: 1.5;
    word-wrap: break-word;
}

.message-status {
    margin-top: 5px;
    font-size: 11px;
    color: #999;
}

/* Message Form */
.message-form-wrapper {
    margin-top: 20px;
}

.message-form {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.message-form textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 14px;
    resize: vertical;
    min-height: 80px;
}

.message-form textarea:focus {
    outline: none;
    border-color: #007cba;
    box-shadow: 0 0 0 1px #007cba;
}

/* Guest Form */
.guest-info {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 10px;
}

.guest-info input {
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 14px;
}

.guest-info input:focus {
    outline: none;
    border-color: #007cba;
    box-shadow: 0 0 0 1px #007cba;
}

.guest-notice {
    margin-top: 10px;
    font-size: 13px;
    color: #666;
}

.guest-notice a {
    color: #007cba;
    text-decoration: none;
}

.guest-notice a:hover {
    text-decoration: underline;
}

/* Buttons */
.message-form button {
    align-self: flex-start;
    padding: 10px 20px;
    background: #007cba;
    color: #fff;
    border: none;
    border-radius: 5px;
    font-size: 14px;
    cursor: pointer;
    transition: background 0.2s;
}

.message-form button:hover {
    background: #005a87;
}

.message-form button:disabled {
    background: #ccc;
    cursor: not-allowed;
}

/* Status Indicators */
.message-status-indicator {
    margin-top: 10px;
    padding: 10px;
    border-radius: 5px;
    text-align: center;
    font-size: 14px;
}

.message-status-indicator span {
    display: none;
}

.message-status-indicator.sending .sending {
    display: block;
    color: #666;
}

.message-status-indicator.success {
    background: #d4edda;
    border: 1px solid #c3e6cb;
}

.message-status-indicator.success .success {
    display: block;
    color: #155724;
}

.message-status-indicator.error {
    background: #f8d7da;
    border: 1px solid #f5c6cb;
}

.message-status-indicator.error .error {
    display: block;
    color: #721c24;
}

/* Typing Indicator */
.typing-indicator {
    margin-top: 10px;
    padding: 8px;
    background: #f0f0f0;
    border-radius: 5px;
    font-size: 13px;
    color: #666;
    font-style: italic;
}

.typing-indicator span::after {
    content: '';
    animation: dots 1.5s infinite;
}

@keyframes dots {
    0%, 20% { content: ''; }
    40% { content: '.'; }
    60% { content: '..'; }
    80%, 100% { content: '...'; }
}

/* My Account Messages */
.cirku-messages-account {
    padding: 20px 0;
}

.cirku-messages-account h2 {
    margin-bottom: 20px;
}

/* Threads List */
.threads-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.thread-item {
    display: flex;
    align-items: center;
    padding: 15px;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 5px;
    transition: box-shadow 0.2s;
}

.thread-item:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.thread-item.resolved {
    opacity: 0.7;
}

.thread-item.archived {
    opacity: 0.5;
}

.thread-product {
    display: flex;
    flex: 1;
    gap: 15px;
    align-items: center;
}

.thread-product img {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 5px;
}

.product-info {
    flex: 1;
}

.product-info h4 {
    margin: 0 0 5px 0;
    font-size: 16px;
}

.product-info h4 a {
    color: #333;
    text-decoration: none;
}

.product-info h4 a:hover {
    color: #007cba;
}

.last-message {
    margin: 5px 0;
    color: #666;
    font-size: 14px;
}

.message-time {
    font-size: 12px;
    color: #999;
}

/* Unread Badge */
.unread-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    background: #ff4444;
    color: #fff;
    border-radius: 10px;
    font-size: 12px;
    font-weight: 600;
    margin: 0 10px;
}

/* Thread Actions */
.thread-actions {
    margin-left: auto;
}

.button-small {
    padding: 8px 15px;
    font-size: 13px;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .cirku-messages-section {
        padding: 20px;
    }
    
    .guest-info {
        grid-template-columns: 1fr;
    }
    
    .message-customer,
    .message-shop_manager,
    .message-admin,
    .message-guest {
        margin-left: 0;
        margin-right: 0;
    }
    
    .thread-item {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .thread-product {
        width: 100%;
    }
    
    .thread-actions {
        width: 100%;
        margin-top: 10px;
    }
    
    .thread-actions .button {
        width: 100%;
        text-align: center;
    }
}