/* GateePay Messages System Styles */

/* Set Vazirmatn font for all message components */
.gateepay-message-form-wrapper,
.gateepay-message-form,
.gateepay-message-form *,
.gateepay-message-bell-wrapper,
.gateepay-message-bell-wrapper *,
.gateepay-message-dropdown,
.gateepay-message-dropdown *,
.gateepay-messages-modal,
.gateepay-messages-modal *,
.gateepay-messages-page-wrapper,
.gateepay-messages-page-wrapper *,
.gateepay-messages-management-wrapper,
.gateepay-messages-management-wrapper * {
    font-family: 'Vazirmatn', 'Vazir', 'Tahoma', sans-serif !important;
}

/* Message Form Styles */
.gateepay-message-form-wrapper {
    max-width: 800px;
    margin: 20px auto;
    padding: 20px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.gateepay-message-form .form-group {
    margin-bottom: 20px;
}

.gateepay-message-form label {
    display: block;
    margin-bottom: 8px;
    font-weight: bold;
    color: #333;
}

.gateepay-message-form .required {
    color: #dc3232;
}

.gateepay-message-form .form-control {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    font-family: 'Vazirmatn', 'Vazir', 'Tahoma', sans-serif;
}

.gateepay-message-form .form-control:focus {
    outline: none;
    border-color: #2271b1;
    box-shadow: 0 0 0 1px #2271b1;
}

.gateepay-message-form select.form-control {
    height: auto;
    min-height: 40px;
}

.gateepay-message-form textarea.form-control {
    min-height: 120px;
    resize: vertical;
}

.gateepay-message-form .btn {
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s;
}

.gateepay-message-form .btn-primary {
    background: #2271b1;
    color: #fff;
}

.gateepay-message-form .btn-primary:hover {
    background: #135e96;
}

.gateepay-message-form .btn-secondary {
    background: #f0f0f1;
    color: #2c3338;
    margin-right: 10px;
}

.gateepay-message-form .btn-secondary:hover {
    background: #dcdcde;
}

.gateepay-message-form .form-response {
    margin-top: 15px;
    padding: 10px;
    border-radius: 4px;
}

.gateepay-message-form .form-response.success .alert-success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
    padding: 10px;
    border-radius: 4px;
}

.gateepay-message-form .form-response.error .alert-danger {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
    padding: 10px;
    border-radius: 4px;
}

.gateepay-message-form .form-text {
    font-size: 12px;
    color: #666;
    margin-top: 5px;
}

/* Message Bell Styles */
.gateepay-message-bell-wrapper {
    position: relative;
    display: inline-flex;
}

.gateepay-message-bell {
    position: relative;
    cursor: pointer;
    font-size: 24px;
    color: #666;
    transition: color 0.3s;
    display: inline-flex;
}

.gateepay-message-bell:hover {
    color: #2271b1;
}

.gateepay-bell-badge {
    position: absolute;
    top: 5px;
    right: 5px;
    background: #dc3232;
    color: #fff;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    font-size: 11px;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
    }
}

/* Message Dropdown Styles */
.gateepay-message-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    width: 350px;
    max-height: 500px;
    z-index: 1000;
    margin-top: 10px;
    overflow: hidden;
}

.gateepay-dropdown-header {
    padding: 15px;
    background: #f8f9fa;
    border-bottom: 1px solid #ddd;
}

.gateepay-dropdown-header h4 {
    margin: 0;
    font-size: 16px;
    color: #333;
}

.gateepay-dropdown-messages {
    max-height: 350px;
    overflow-y: auto;
}

.gateepay-message-item {
    padding: 12px 15px;
    border-bottom: 1px solid #eee;
    cursor: pointer;
    transition: background 0.2s;
}

.gateepay-message-item:hover {
    background: #f8f9fa;
}

.gateepay-message-item.unread {
    background: #e7f3ff;
    font-weight: bold;
}

.gateepay-message-item .message-type-badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 3px;
    font-size: 11px;
    font-weight: bold;
    margin-bottom: 5px;
}

.gateepay-message-item .message-title {
    font-size: 14px;
    color: #333;
    margin-bottom: 5px;
}

.gateepay-message-item .message-date {
    font-size: 11px;
    color: #666;
}

.gateepay-dropdown-footer {
    padding: 10px 15px;
    background: #f8f9fa;
    border-top: 1px solid #ddd;
    text-align: center;
}

.gateepay-dropdown-footer .btn-view-all {
    background: #2271b1;
    color: #fff;
    border: none;
    padding: 8px 20px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.3s;
}

.gateepay-dropdown-footer .btn-view-all:hover {
    background: #135e96;
}

/* Message Modal Styles */
.gateepay-messages-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.gateepay-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    cursor: pointer;
}

.gateepay-modal-content {
    position: relative;
    background: #fff;
    border-radius: 8px;
    width: 90%;
    max-height: 90vh;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
    display: flex;
    flex-direction: column;
}
#gateepay-view-all-btn ,
#gateepay-message-form button[type="submit"],
#gateepay-form-edit-message-form button[type="submit"]{
    color: #fff!important;
}
.gateepay-modal-header {
    padding: 20px;
    background: linear-gradient(135deg, #2271b1 0%, #135e96 100%);
    color: #fff;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.gateepay-modal-header h3 {
    margin: 0;
    font-size: 20px;
}

.gateepay-modal-close {
    background: none;
    border: none;
    color: #fff;
    font-size: 28px;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    line-height: 30px;
    transition: opacity 0.3s;
}

.gateepay-modal-close:hover {
    opacity: 0.7;
}

.gateepay-modal-body {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
}

.gateepay-modal-filters {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.gateepay-modal-filters .form-control {
    flex: 1;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.gateepay-modal-messages {
    max-height: 500px;
    overflow-y: auto;
}

.gateepay-modal-message-item {
    padding: 15px;
    border: 1px solid #eee;
    border-radius: 4px;
    margin-bottom: 15px;
    cursor: pointer;
    transition: all 0.2s;
}

.gateepay-modal-message-item:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.gateepay-modal-message-item.unread {
    background: #e7f3ff;
    border-color: #2271b1;
}

.gateepay-modal-message-item .message-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.gateepay-modal-message-item .message-title {
    font-size: 16px;
    font-weight: bold;
    color: #333;
    margin-bottom: 10px;
}

.gateepay-modal-message-item .message-content {
    font-size: 14px;
    color: #666;
    line-height: 1.6;
}

/* Message Type Badges */
.message-type-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: bold;
}

.type-info {
    background: #e3f2fd;
    color: #1976d2;
}

.type-announcement {
    background: #fff3e0;
    color: #f57c00;
}

.type-warning {
    background: #ffebee;
    color: #d32f2f;
}

.type-urgent {
    background: #fce4ec;
    color: #c2185b;
}

.type-maintenance {
    background: #f3e5f5;
    color: #7b1fa2;
}

.type-other {
    background: #e0e0e0;
    color: #616161;
}

/* Loading and Empty States */
.gateepay-loading {
    text-align: center;
    padding: 20px;
    color: #666;
}

.gateepay-no-messages {
    text-align: center;
    padding: 40px 20px;
    color: #999;
    font-style: italic;
}

.gateepay-error {
    text-align: center;
    padding: 20px;
    color: #dc3232;
    background: #f8d7da;
    border-radius: 4px;
}

/* Status Badges */
.status-active {
    color: #46b450;
    font-weight: bold;
}

.status-inactive {
    color: #dc3232;
    font-weight: bold;
}

/* Responsive Design */
@media (max-width: 768px) {
    .gateepay-message-dropdown {
        width: 300px;
        right: -50px;
    }
    
    .gateepay-modal-content {
        width: 95%;
        max-height: 95vh;
    }
    
    .gateepay-modal-filters {
        flex-direction: column;
    }
}

/* Messages Page Wrapper */
.gateepay-messages-page-wrapper {
    max-width: 1200px;
    margin: 20px auto;
    padding: 20px;
}

.gateepay-messages-page-wrapper h2 {
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid #2271b1;
    color: #2271b1;
}

/* Messages Management Section */
.gateepay-messages-management-wrapper {
    margin-top: 40px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    padding: 20px;
}

.gateepay-messages-management-wrapper h2 {
    margin-top: 0;
}

.gateepay-messages-stats {
    display: flex;
    gap: 20px;
    margin: 20px 0;
    flex-wrap: wrap;
}

.gateepay-messages-stats .stat-box {
    background: #f8f9fa;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 15px;
    text-align: center;
    flex: 1;
    min-width: 150px;
}

.gateepay-messages-stats .stat-value {
    font-size: 24px;
    font-weight: bold;
    color: #2271b1;
}

.gateepay-messages-stats .stat-label {
    font-size: 12px;
    color: #666;
    margin-top: 5px;
}

.gateepay-messages-filters {
    display: flex;
    gap: 10px;
    margin: 20px 0;
    flex-wrap: wrap;
}

.gateepay-messages-filters .form-control {
    flex: 1;
    min-width: 150px;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.gateepay-messages-filters .btn {
    padding: 8px 20px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
}

.gateepay-messages-filters .btn-primary {
    background: #2271b1;
    color: #fff;
}

.gateepay-messages-filters .btn-primary:hover {
    background: #135e96;
}

#gateepay-form-messages-table {
    width: 100%;
    margin-top: 20px;
}

#gateepay-form-messages-table th {
    background: #f8f9fa;
    font-weight: bold;
    padding: 12px;
    text-align: right;
}

#gateepay-form-messages-table td {
    padding: 12px;
    vertical-align: middle;
}

#gateepay-form-messages-table .btn {
    padding: 5px 10px;
    margin: 2px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    text-decoration: none;
    display: inline-block;
}

#gateepay-form-messages-table .btn-small {
    padding: 4px 8px;
    font-size: 11px;
}

#gateepay-form-messages-table .btn-primary {
    background: #2271b1;
    color: #fff;
}

#gateepay-form-messages-table .btn-primary:hover {
    background: #135e96;
}

#gateepay-form-messages-table .btn-danger {
    background: #dc3232;
    color: #fff;
}

#gateepay-form-messages-table .btn-danger:hover {
    background: #a00;
}

#gateepay-form-messages-table .btn-secondary {
    background: #f0f0f1;
    color: #2c3338;
}

#gateepay-form-messages-table .btn-secondary:hover {
    background: #dcdcde;
}

/* Mobile: give the edit message editor more height */
@media (max-width: 768px) {
    #gateepay-form-edit-message-form .wp-editor-container,
    #gateepay-form-edit-message-form .wp-editor-container .wp-editor-area,
    #gateepay-form-edit-message-form .mce-edit-area iframe,
    #gateepay-form-edit-message-form .mce-edit-area.mce-rtl.mce-container.mce-panel.mce-stack-layout-item iframe {
        min-height: 100px !important;
        height: 140px !important;
    }
    /* Ensure edit form controls fit inside mobile viewport */
    #gateepay-form-edit-message-form select,
    #gateepay-form-edit-message-form input[type="datetime-local"] {
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
    }
}

/* Admin Modal Styles (for form page) */
.gateepay-admin-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);
}

.gateepay-admin-modal-content {
    background-color: #fefefe;
    margin: 5% auto;
    padding: 0;
    border: 1px solid #888;
    width: 80%;
    max-width: 800px;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
}

.gateepay-admin-modal-header {
    padding: 20px;
    background: linear-gradient(135deg, #2271b1 0%, #135e96 100%);
    color: white;
    border-radius: 8px 8px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.gateepay-admin-modal-header h2 {
    margin: 0;
    color: white;
    border: none;
}

.gateepay-admin-modal-close {
    color: white;
    font-size: 28px;
    font-weight: bold;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    line-height: 30px;
}

.gateepay-admin-modal-close:hover {
    opacity: 0.7;
}

.gateepay-admin-modal-body {
    padding: 20px;
}

.gateepay-admin-modal-body .form-group {
    margin-bottom: 15px;
}

.gateepay-admin-modal-body label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
}

/* RTL Support */
[dir="rtl"] .gateepay-message-bell-wrapper {
    direction: rtl;
}

[dir="rtl"] .gateepay-message-dropdown {
    right: auto;
    left: 0;
}

[dir="rtl"] .gateepay-modal-header {
    flex-direction: row-reverse;
}

[dir="rtl"] .gateepay-messages-filters {
    flex-direction: row-reverse;
}

[dir="rtl"] #gateepay-form-messages-table th,
[dir="rtl"] #gateepay-form-messages-table td {
    text-align: right;
}

