/* GRT Ticket Admin Styles */

/* General Admin Styles */
.grt-ticket-wrap {
    margin: 20px 20px 0 0;
}

.grt-ticket-header {
    background: #fff;
    padding: 20px;
    margin-bottom: 20px;
    border-left: 4px solid #2271b1;
    box-shadow: 0 1px 1px rgba(0,0,0,.04);
}

.grt-ticket-header h1 {
    margin: 0 0 10px 0;
    font-size: 24px;
}

/* Tickets Table */
.grt-tickets-table {
    width: 100%;
    background: #fff;
    border-collapse: collapse;
    box-shadow: 0 1px 1px rgba(0,0,0,.04);
}

.grt-tickets-table th,
.grt-tickets-table td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid #e5e5e5;
}

.grt-tickets-table th {
    background: #f9f9f9;
    font-weight: 600;
    color: #23282d;
}

.grt-tickets-table tr:hover {
    background: #f9f9f9;
}

.grt-ticket-status {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 3px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
}

.grt-ticket-status.status-open {
    background: #d4edda;
    color: #155724;
}

.grt-ticket-status.status-solved {
    background: #cce5ff;
    color: #004085;
}

.grt-ticket-status.status-closed {
    background: #f8d7da;
    color: #721c24;
}

.grt-ticket-actions a {
    text-decoration: none;
    margin-right: 10px;
}

/* Full-Screen Chat Interface */
.grt-chat-container {
    position: fixed;
    top: 32px;
    left: 160px;
    right: 0;
    bottom: 0;
    background: #f0f0f1;
    z-index: 9999;
    display: flex;
    box-sizing: border-box;
}

.grt-chat-container * {
    box-sizing: border-box;
}

/* Adjust for collapsed admin menu */
.folded .grt-chat-container {
    left: 36px;
}

/* Adjust for mobile */
@media screen and (max-width: 782px) {
    .grt-chat-container {
        top: 46px;
        left: 0;
    }
}

/* Chat Sidebar */
.grt-chat-sidebar {
    width: 300px;
    background: #fff;
    border-right: 1px solid #ddd;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.grt-chat-sidebar-header {
    padding: 20px;
    background: #2271b1;
    color: #fff;
    border-bottom: 1px solid #1d5d8c;
}

.grt-chat-sidebar-header h2 {
    margin: 0;
    font-size: 18px;
    color: #fff;
}

.grt-chat-tickets-list {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
}

.grt-chat-ticket-item {
    padding: 15px;
    margin-bottom: 10px;
    background: #f9f9f9;
    border-radius: 5px;
    cursor: pointer;
    transition: background 0.2s;
    border-left: 3px solid transparent;
}

.grt-chat-ticket-item:hover {
    background: #f0f0f1;
}

.grt-chat-ticket-item.active {
    background: #e8f4f8;
    border-left-color: #2271b1;
}

.grt-chat-ticket-item h4 {
    margin: 0 0 5px 0;
    font-size: 14px;
    font-weight: 600;
}

.grt-chat-ticket-item p {
    margin: 0;
    font-size: 12px;
    color: #666;
}

/* Chat Main Area */
.grt-chat-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #fff;
}

.grt-chat-header {
    padding: 20px;
    background: #fff;
    border-bottom: 1px solid #ddd;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.grt-chat-header h2 {
    margin: 0;
    font-size: 18px;
}

.grt-chat-info {
    display: flex;
    gap: 15px;
    font-size: 13px;
    color: #666;
}

.grt-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: #f9f9f9;
}

.grt-chat-message {
    margin-bottom: 20px;
    display: flex;
    flex-direction: column;
}

.grt-chat-message.admin {
    align-items: flex-end;
}

.grt-chat-message.user {
    align-items: flex-start;
}

.grt-message-sender {
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 5px;
    color: #666;
}

.grt-message-bubble {
    max-width: 70%;
    padding: 12px 16px;
    border-radius: 12px;
    word-wrap: break-word;
}

.grt-chat-message.admin .grt-message-bubble {
    background: #2271b1;
    color: #fff;
    border-bottom-right-radius: 4px;
}

.grt-chat-message.user .grt-message-bubble {
    background: #fff;
    color: #23282d;
    border: 1px solid #ddd;
    border-bottom-left-radius: 4px;
}

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

/* Chat Input */
.grt-chat-input-container {
    padding: 15px;
    background: #fff;
    border-top: 1px solid #ddd;
    flex-shrink: 0;
}

.grt-chat-input-wrapper {
    display: flex;
    gap: 10px;
    align-items: flex-end;
}

.grt-chat-input {
    flex: 1;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 5px;
    resize: vertical;
    min-height: 40px;
    max-height: 150px;
    font-family: inherit;
    font-size: 14px;
    line-height: 1.5;
}

.grt-chat-input:focus {
    outline: none;
    border-color: #2271b1;
}

.grt-chat-input:disabled {
    background: #f0f0f1;
    cursor: not-allowed;
}

.grt-chat-send-btn,
.grt-chat-solve-btn {
    padding: 12px 24px;
    background: #2271b1;
    color: #fff;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: background 0.2s;
}

.grt-chat-send-btn:hover {
    background: #135e96;
}

.grt-chat-send-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.grt-chat-solve-btn {
    background: #00a32a;
}

.grt-chat-solve-btn:hover {
    background: #008a20;
}

/* Solved Notice */
.grt-chat-solved-notice {
    padding: 15px;
    background: #d4edda;
    color: #155724;
    text-align: center;
    font-weight: 600;
    border-top: 1px solid #c3e6cb;
}

/* Settings Page */
.grt-settings-form {
    background: #fff;
    padding: 20px;
    max-width: 800px;
    box-shadow: 0 1px 1px rgba(0,0,0,.04);
}

.grt-settings-form table {
    width: 100%;
}

.grt-settings-form th {
    width: 200px;
    text-align: left;
    padding: 15px 10px 15px 0;
    vertical-align: top;
}

.grt-settings-form td {
    padding: 15px 0;
}

.grt-settings-form input[type="text"],
.grt-settings-form input[type="number"],
.grt-settings-form textarea {
    width: 100%;
    max-width: 500px;
}

.grt-settings-form textarea {
    height: 100px;
}

.grt-settings-form .description {
    display: block;
    margin-top: 5px;
    color: #666;
    font-size: 13px;
}

/* Loading Spinner */
.grt-loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #2271b1;
    border-radius: 50%;
    animation: grt-spin 1s linear infinite;
}

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

/* Responsive */
@media screen and (max-width: 782px) {
    .grt-chat-sidebar {
        width: 250px;
    }
    
    .grt-message-bubble {
        max-width: 85%;
    }
    
    .grt-chat-input-wrapper {
        flex-direction: column;
    }
    
    .grt-chat-send-btn,
    .grt-chat-solve-btn {
        width: 100%;
    }
}

@media screen and (max-width: 600px) {
    .grt-chat-sidebar {
        display: none;
    }
    
    .grt-message-bubble {
        max-width: 95%;
    }
}

/* Category Image Upload */
.grt-category-item {
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 15px;
    background: #f9f9f9;
    padding: 15px;
    border: 1px solid #e5e5e5;
    border-radius: 4px;
}

.grt-image-upload-wrapper {
    display: flex;
    align-items: center;
    gap: 10px;
}

.grt-image-preview {
    width: 40px;
    height: 40px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.grt-image-preview img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}
