/**
 * Chat Application Styles
 * Colors: #748469, #ABB290, #AAC1B1, #F9EAD7, #F6F6EE
 * Includes basic Bootstrap-like utilities
 */

/* Basic Bootstrap-like utilities */
.container-fluid {
    width: 100%;
}

.ml-auto {
    margin-left: auto;
}

.text-danger {
    color: #dc3545 !important;
}

.text-muted {
    color: #6c757d;
}

.btn {
    display: inline-block;
    font-weight: 400;
    text-align: center;
    vertical-align: middle;
    user-select: none;
    border: 1px solid transparent;
    padding: 0.375rem 0.75rem;
    font-size: 1rem;
    line-height: 1.5;
    border-radius: 0.25rem;
    transition: color 0.15s ease-in-out, background-color 0.15s ease-in-out, border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
    text-decoration: none;
    cursor: pointer;
}

.btn-primary {
    color: #fff;
    background-color: #748469;
    border-color: #748469;
}

.btn-primary:hover {
    background-color: #5a6b52;
    border-color: #5a6b52;
}

.btn-secondary {
    color: #fff;
    background-color: #6c757d;
    border-color: #6c757d;
}

.btn-secondary:hover {
    background-color: #5a6268;
    border-color: #545b62;
}

.btn-danger {
    color: #fff;
    background-color: #dc3545;
    border-color: #dc3545;
}

.btn-danger:hover {
    background-color: #c82333;
    border-color: #bd2130;
}

.form-group {
    margin-bottom: 1rem;
}

.form-control {
    display: block;
    width: 100%;
    padding: 0.375rem 0.75rem;
    font-size: 1rem;
    font-weight: 400;
    line-height: 1.5;
    color: #495057;
    background-color: #fff;
    background-clip: padding-box;
    border: 1px solid #ced4da;
    border-radius: 0.25rem;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
    box-sizing: border-box;
}

.form-text {
    margin-top: 0.25rem;
    font-size: 0.875em;
    color: #6c757d;
}

/* Modal Styles */
.modal {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 1050;
    display: none;
    overflow: hidden;
    outline: 0;
}

.modal.show {
    display: block;
}

.modal.fade {
    transition: opacity 0.15s linear;
}

.modal.fade:not(.show) {
    opacity: 0;
}

.modal-dialog {
    position: relative;
    width: auto;
    margin: 1.75rem auto;
    max-width: 500px;
    pointer-events: none;
}

.modal.show .modal-dialog {
    pointer-events: auto;
}

.modal-content {
    position: relative;
    display: flex;
    flex-direction: column;
    width: 100%;
    pointer-events: auto;
    background-color: #fff;
    background-clip: padding-box;
    border: 1px solid rgba(0,0,0,0.2);
    border-radius: 0.3rem;
    outline: 0;
}

.modal-backdrop {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 1040;
    background-color: #000;
}

.modal-backdrop.fade {
    opacity: 0;
}

.modal-backdrop.show {
    opacity: 0.5;
}

body.modal-open {
    overflow: hidden;
    padding-right: 0 !important;
}

@font-face {
    font-family: 'Sahel';
    src: url('/fonts/SAHEL.TTF') format('truetype');
    font-weight: normal;
}

@font-face {
    font-family: 'Sahel';
    src: url('/fonts/SAHEL-BOLD.TTF') format('truetype');
    font-weight: bold;
}

@font-face {
    font-family: 'Sahel';
    src: url('/fonts/SAHEL-BLACK-FD.TTF') format('truetype');
    font-weight: 900;
}

* {
    font-family: 'Sahel', 'Tahoma', sans-serif;
}

body {
    margin: 0;
    padding: 0;
    background-color: #F6F6EE;
    direction: rtl;
    font-family: 'Sahel', 'Tahoma', sans-serif;
}

/* Login Page */
.login-page {
    background: linear-gradient(135deg, #748469 0%, #ABB290 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.login-container {
    width: 100%;
    max-width: 400px;
}

.login-box {
    background: #F6F6EE;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    padding: 40px;
}

.login-header {
    text-align: center;
    margin-bottom: 30px;
}

.login-header h2 {
    color: #748469;
    margin-top: 15px;
    font-weight: bold;
}

.login-icon {
    width: 60px;
    height: 60px;
    margin-bottom: 10px;
}

.login-form .form-group {
    margin-bottom: 20px;
}

.login-form label {
    color: #748469;
    font-weight: bold;
    margin-bottom: 8px;
    display: block;
}

.login-form .form-control {
    border: 2px solid #AAC1B1;
    border-radius: 8px;
    padding: 12px;
    font-size: 16px;
    transition: border-color 0.3s;
}

.login-form .form-control:focus {
    border-color: #748469;
    box-shadow: 0 0 0 0.2rem rgba(116, 132, 105, 0.25);
    outline: none;
}

.btn-login {
    background: #748469;
    border: none;
    color: white;
    padding: 12px 30px;
    border-radius: 8px;
    width: 100%;
    font-size: 16px;
    font-weight: bold;
    transition: background 0.3s;
    cursor: pointer;
}

.btn-login:hover {
    background: #5a6b52;
    color: white;
}

/* Navbar */
.navbar-custom {
    background: #748469;
    color: white;
    padding: 12px 20px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.navbar-custom .navbar-brand {
    color: white;
    font-weight: bold;
    font-size: 20px;
}

.navbar-custom .user-name {
    color: #F6F6EE;
    font-weight: bold;
    margin-left: 15px;
}

.navbar-custom .btn-icon {
    background: transparent;
    border: none;
    color: white;
    padding: 5px 10px;
    margin-left: 10px;
    cursor: pointer;
    border-radius: 5px;
    transition: background 0.3s;
}

.navbar-custom .btn-icon:hover {
    background: rgba(255,255,255,0.2);
}

.navbar-custom .btn-icon img {
    filter: brightness(0) invert(1);
}

/* Chat Container */
.chat-container {
    height: calc(100vh - 120px);
    overflow-y: auto;
    padding: 20px;
    background: #F6F6EE;
}

.chat-messages {
    max-width: 800px;
    margin: 0 auto;
    padding-bottom: 20px;
}

/* Messages */
.message {
    margin-bottom: 15px;
    padding: 12px 15px;
    border-radius: 12px;
    max-width: 70%;
    word-wrap: break-word;
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.message-own {
    background: #AAC1B1;
    margin-right: auto;
    margin-left: 0;
    border-bottom-right-radius: 4px;
}

.message-other {
    background: #F9EAD7;
    margin-left: auto;
    margin-right: 0;
    border-bottom-left-radius: 4px;
}

.message-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    font-size: 12px;
}

.message-sender {
    font-weight: bold;
    color: #748469;
}

.message-time {
    color: #666;
    font-size: 11px;
}

.message-text {
    color: #333;
    line-height: 1.5;
    white-space: pre-wrap;
}

.message-file {
    margin-bottom: 8px;
}

.message-image {
    max-width: 100%;
    border-radius: 8px;
    margin-top: 5px;
    cursor: pointer;
}

.file-link {
    color: #748469;
    text-decoration: none;
    display: inline-block;
    padding: 8px 12px;
    background: rgba(116, 132, 105, 0.1);
    border-radius: 6px;
    transition: background 0.3s;
}

.file-link:hover {
    background: rgba(116, 132, 105, 0.2);
    text-decoration: none;
    color: #5a6b52;
}

/* Message Input */
.message-input-container {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    border-top: 2px solid #AAC1B1;
    padding: 15px;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
}

.message-form {
    max-width: 800px;
    margin: 0 auto;
}

.input-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.btn-attach {
    background: #ABB290;
    border: none;
    color: white;
    padding: 10px 15px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 18px;
    transition: background 0.3s;
}

.btn-attach:hover {
    background: #8a9a75;
    color: white;
}

.message-input {
    flex: 1;
    border: 2px solid #AAC1B1;
    border-radius: 8px;
    padding: 12px 15px;
    font-size: 16px;
    font-family: 'Sahel', sans-serif;
}

.message-input:focus {
    border-color: #748469;
    box-shadow: 0 0 0 0.2rem rgba(116, 132, 105, 0.25);
    outline: none;
}

.btn-send {
    background: #748469;
    border: none;
    color: white;
    padding: 12px 25px;
    border-radius: 8px;
    font-weight: bold;
    cursor: pointer;
    transition: background 0.3s;
}

.btn-send:hover {
    background: #5a6b52;
    color: white;
}

/* File Preview */
.file-preview {
    margin-top: 10px;
}

.file-preview-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    background: #F9EAD7;
    border-radius: 6px;
    margin-top: 5px;
}

.file-preview-item span {
    flex: 1;
    color: #748469;
}

.btn-remove-file {
    background: #dc3545;
    border: none;
    color: white;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 18px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-remove-file:hover {
    background: #c82333;
}

/* Modals */
.modal-content {
    border-radius: 12px;
    border: none;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
}

.modal-header {
    background: #748469;
    color: white;
    border-radius: 12px 12px 0 0;
    padding: 15px 20px;
}

.modal-header .close {
    color: white;
    opacity: 0.8;
    font-size: 28px;
}

.modal-header .close:hover {
    opacity: 1;
}

.modal-title {
    font-weight: bold;
}

.modal-body {
    padding: 20px;
}

.modal-body .form-group label {
    color: #748469;
    font-weight: bold;
    margin-bottom: 8px;
}

.modal-body .form-control {
    border: 2px solid #AAC1B1;
    border-radius: 8px;
    padding: 10px;
}

.modal-body .form-control:focus {
    border-color: #748469;
    box-shadow: 0 0 0 0.2rem rgba(116, 132, 105, 0.25);
    outline: none;
}

.modal-footer {
    border-top: 1px solid #AAC1B1;
    padding: 15px 20px;
}

.modal-footer .btn-primary {
    background: #748469;
    border: none;
}

.modal-footer .btn-primary:hover {
    background: #5a6b52;
}

.modal-footer .btn-danger {
    background: #dc3545;
    border: none;
}

.modal-footer .btn-danger:hover {
    background: #c82333;
}

/* Alerts */
.alert {
    border-radius: 8px;
    border: none;
    padding: 12px 15px;
}

.alert-danger {
    background: #f8d7da;
    color: #721c24;
}

.alert-success {
    background: #d4edda;
    color: #155724;
}

/* Responsive */
@media (max-width: 768px) {
    .message {
        max-width: 85%;
    }
    
    .chat-container {
        height: calc(100vh - 140px);
        padding: 10px;
    }
    
    .message-input-container {
        padding: 10px;
    }
    
    .navbar-custom .user-name {
        display: none;
    }
    
    .login-box {
        padding: 30px 20px;
    }
}

/* Scrollbar */
.chat-messages::-webkit-scrollbar {
    width: 8px;
}

.chat-messages::-webkit-scrollbar-track {
    background: #F6F6EE;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: #AAC1B1;
    border-radius: 4px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
    background: #8a9a75;
}