@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
    --primary-color: #4f46e5;
    --primary-hover: #4338ca;
    --bg-color: #f3f4f6;
    --card-bg: #ffffff;
    --text-main: #111827;
    --text-muted: #6b7280;
    --border-color: #d1d5db;
    --error-color: #ef4444;
    --success-color: #10b981;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-main);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 2rem 1rem;
    -webkit-font-smoothing: antialiased;
}

.auth-container {
    background-color: var(--card-bg);
    width: 100%;
    max-width: 440px;
    padding: 2.5rem;
    border-radius: 1rem;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

.auth-container h2 {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    text-align: center;
}

.auth-container p.subtitle {
    text-align: center;
    color: var(--text-muted);
    margin-bottom: 2rem;
    font-size: 0.95rem;
}

.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    display: block;
    font-weight: 500;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}

.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="password"],
.form-group input[type="date"] {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    font-size: 1rem;
    transition: border-color 0.2s, box-shadow 0.2s;
    outline: none;
    font-family: 'Inter', sans-serif;
}

.form-group input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15);
}

.checkbox-group {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

.checkbox-group input[type="checkbox"] {
    margin-top: 0.2rem;
    width: 1rem;
    height: 1rem;
    accent-color: var(--primary-color);
    cursor: pointer;
}

.checkbox-group label {
    font-size: 0.85rem;
    color: var(--text-muted);
    line-height: 1.4;
}

.checkbox-group a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
}

.checkbox-group a:hover {
    text-decoration: underline;
}

button.btn-submit {
    width: 100%;
    padding: 0.875rem;
    background-color: var(--primary-color);
    color: #ffffff;
    border: none;
    border-radius: 0.5rem;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s;
}

button.btn-submit:hover {
    background-color: var(--primary-hover);
}

.auth-footer {
    text-align: center;
    margin-top: 1.5rem;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.auth-footer a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 600;
}

.auth-footer a:hover {
    text-decoration: underline;
}

.alert {
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
}

.alert-error {
    background-color: #fef2f2;
    color: var(--error-color);
    border: 1px solid #fecaca;
}

.alert-success {
    background-color: #ecfdf5;
    color: var(--success-color);
    border: 1px solid #a7f3d0;
}


/* ---------------- ADD CONTACT MODAL ---------------- */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.4);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    animation: fadeIn 0.2s ease-out;
}

.modal-content {
    background-color: #ffffff;
    padding: 2.5rem;
    border-radius: 1rem;
    width: 90%;
    max-width: 440px;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    position: relative;
    animation: slideDown 0.2s ease-out;
}

.modal-close {
    position: absolute;
    top: 1rem;
    right: 1.25rem;
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--text-muted);
    cursor: pointer;
    transition: color 0.2s;
}

.modal-close:hover {
    color: var(--text-main);
}

.modal-content h3 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    text-align: center;
}

.modal-content .subtitle {
    text-align: center;
    color: var(--text-muted);
    margin-bottom: 2rem;
    font-size: 0.95rem;
}

.modal-content .form-group {
    margin-bottom: 1.25rem;
    text-align: left;
}

.modal-content label {
    display: block;
    font-weight: 500;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}

.modal-content input {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    font-size: 1rem;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.modal-content input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15);
}

.modal-content .btn-submit {
    width: 100%;
    padding: 0.875rem;
    background-color: var(--primary-color);
    color: #ffffff;
    border: none;
    border-radius: 0.5rem;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s;
    margin-top: 0.5rem;
}

.modal-content .btn-submit:hover {
    background-color: var(--primary-hover);
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideDown {
    from { transform: translateY(-20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

/* ---------------- FLAG / REPORT BUTTON ---------------- */
.msg-wrapper {
    position: relative;
    display: flex;
    align-items: flex-end;
    gap: 6px;
}

.msg-wrapper.sent {
    flex-direction: row-reverse;
}

.flag-btn {
    opacity: 0;
    transition: opacity 0.2s ease, color 0.2s ease;
    background: none;
    border: none;
    cursor: pointer;
    padding: 2px 4px;
    color: #aab4be;
    font-size: 0.8rem;
    line-height: 1;
    flex-shrink: 0;
    align-self: center;
    border-radius: 4px;
    display: flex;
    align-items: center;
}

.msg-wrapper:hover .flag-btn {
    opacity: 1;
}

.flag-btn:hover {
    color: #ef4444;
    background-color: rgba(239, 68, 68, 0.1);
}

.flag-btn svg {
    pointer-events: none;
}

/* ---------------- REPORT MODAL ---------------- */
#report-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    animation: fadeIn 0.2s ease-out;
}

#report-modal-overlay.hidden {
    display: none;
}

#report-modal-box {
    background: #fff;
    border-radius: 1rem;
    padding: 2rem;
    width: 90%;
    max-width: 380px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.15);
    animation: slideDown 0.2s ease-out;
}

#report-modal-box h3 {
    font-size: 1.15rem;
    font-weight: 700;
    margin-bottom: 0.35rem;
    color: #111827;
}

#report-modal-box p {
    font-size: 0.875rem;
    color: #6b7280;
    margin-bottom: 1.25rem;
}

.report-reason-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

.report-reason-btn {
    text-align: left;
    padding: 0.65rem 1rem;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    background: #f9fafb;
    cursor: pointer;
    font-size: 0.9rem;
    font-family: 'Inter', sans-serif;
    color: #374151;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.report-reason-btn:hover {
    background: #fee2e2;
    border-color: #fca5a5;
    color: #dc2626;
}

#report-modal-cancel {
    width: 100%;
    padding: 0.65rem;
    border: none;
    background: none;
    color: #6b7280;
    font-size: 0.875rem;
    cursor: pointer;
    font-family: 'Inter', sans-serif;
    border-radius: 0.5rem;
    transition: background 0.15s;
}

#report-modal-cancel:hover {
    background: #f3f4f6;
}

/* ---------------- RTL SUPPORT (Arabic) ---------------- */
[dir="rtl"] .sidebar {
    border-right: none;
    border-left: 1px solid var(--border-color);
}
[dir="rtl"] .contact-item .avatar {
    margin-right: 0;
    margin-left: 15px;
}
[dir="rtl"] .contact-info {
    padding-right: 0;
    padding-left: 15px;
}
[dir="rtl"] .chat-header .avatar {
    margin-right: 0;
    margin-left: 15px;
}
[dir="rtl"] .msg-wrapper.sent {
    flex-direction: row; 
}
[dir="rtl"] .msg-wrapper {
    flex-direction: row-reverse; 
}
[dir="rtl"] .header-icons {
    margin-left: 0 !important;
    margin-right: auto !important; 
}
[dir="rtl"] #chatSearchContainer {
    margin-right: 0 !important;
    margin-left: 10px !important;
}

[dir="rtl"] #settings-btn {
    margin-left: 0 !important;
    margin-right: 10px !important;
}

[dir="rtl"] .settings-dropdown {
    right: auto;
    left: 0;
}

/* ========================================================= */
/* WebRTC Calling UI Styles */
/* ========================================================= */

.call-control-btn {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, transform 0.1s;
}

.call-control-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

.call-control-btn:active {
    transform: scale(0.95);
}

.call-control-btn.end-call {
    background: #ef4444;
}

.call-control-btn.end-call:hover {
    background: #dc2626;
}

.call-control-btn.active-toggle {
    background: #ffffff;
    color: #111b21;
}

/* Optional Pulse Animation for incoming call modal */
@keyframes pulseRing {
    0% {
        box-shadow: 0 0 0 0 rgba(37, 211, 102, 0.7);
    }
    70% {
        box-shadow: 0 0 0 20px rgba(37, 211, 102, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(37, 211, 102, 0);
    }
}

#acceptCallBtn {
    animation: pulseRing 2s infinite;
}
