/* ========================================
   LoveChat - Romantic UI Styling
   Soft Pink & Lavender Theme
   ======================================== */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #f5e6f0 0%, #e8ddf5 100%);
    min-height: 100vh;
    color: #333;
}

/* ========================================
   Authentication Pages (Login & Register)
   ======================================== */

.auth-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
}

.auth-card {
    background: white;
    border-radius: 20px;
    padding: 40px;
    box-shadow: 0 10px 40px rgba(201, 124, 180, 0.15);
    max-width: 400px;
    width: 100%;
    animation: slideIn 0.5s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.auth-card h1 {
    text-align: center;
    font-size: 2.5em;
    margin-bottom: 10px;
    color: #d946a6;
}

.auth-card h2 {
    text-align: center;
    font-size: 1.8em;
    color: #8b5a99;
    margin-bottom: 10px;
}

.auth-card .subtitle {
    text-align: center;
    color: #c67db8;
    margin-bottom: 30px;
    font-size: 0.95em;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: #8b5a99;
    font-weight: 600;
}

.form-group input {
    width: 100%;
    padding: 12px;
    border: 2px solid #e8d4eb;
    border-radius: 10px;
    font-size: 1em;
    transition: all 0.3s ease;
}

.form-group input:focus {
    outline: none;
    border-color: #d946a6;
    box-shadow: 0 0 10px rgba(217, 70, 166, 0.1);
}

.btn {
    width: 100%;
    padding: 12px;
    border: none;
    border-radius: 10px;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-primary {
    background: linear-gradient(135deg, #d946a6 0%, #c67db8 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(217, 70, 166, 0.3);
}

.btn-primary:active {
    transform: translateY(0);
}

.alert {
    padding: 12px;
    border-radius: 10px;
    margin-bottom: 20px;
    animation: slideIn 0.3s ease;
}

.alert-error {
    background-color: #fce4e6;
    color: #c3185b;
    border: 1px solid #f8bbd0;
}

.alert-success {
    background-color: #e8f5e9;
    color: #2e7d32;
    border: 1px solid #c8e6c9;
}

.alert a {
    color: inherit;
    text-decoration: underline;
}

.auth-link {
    text-align: center;
    margin-top: 20px;
    color: #666;
}

.auth-link a {
    color: #d946a6;
    text-decoration: none;
    font-weight: 600;
    transition: color 0.3s ease;
}

.auth-link a:hover {
    color: #8b5a99;
}

.demo-info {
    margin-top: 30px;
    padding: 15px;
    background-color: #faf0fb;
    border-radius: 10px;
    border-left: 4px solid #d946a6;
}

.demo-info p {
    font-size: 0.9em;
    color: #8b5a99;
    margin: 5px 0;
}

/* ========================================
   Chat Page Layout
   ======================================== */

.chat-container {
    display: flex;
    height: 100vh;
    gap: 0;
}

.sidebar {
    width: 280px;
    background: linear-gradient(180deg, #f5e6f0 0%, #ede4f0 100%);
    border-right: 1px solid #e8d4eb;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid #e8d4eb;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.sidebar-header h3 {
    color: #d946a6;
    font-size: 1.4em;
}

.logout-btn {
    background-color: #ffe0e7;
    color: #d946a6;
    padding: 8px 12px;
    border-radius: 8px;
    text-decoration: none;
    font-size: 0.85em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    border: none;
}

.logout-btn:hover {
    background-color: #ffb3c3;
    color: #8b5a99;
}

.user-info {
    padding: 20px;
    border-bottom: 1px solid #e8d4eb;
}

.user-info p {
    margin: 5px 0;
}

.user-info strong {
    color: #8b5a99;
}

.online-status {
    color: #4caf50;
    font-size: 0.9em;
}

.sidebar h4 {
    padding: 15px 20px 10px;
    color: #8b5a99;
    font-size: 0.95em;
}

.users-list {
    flex: 1;
    padding: 10px;
    overflow-y: auto;
}

.user-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 15px;
    margin: 5px 0;
    background: white;
    border-radius: 10px;
    text-decoration: none;
    color: #333;
    transition: all 0.3s ease;
    cursor: pointer;
    border: 2px solid transparent;
}

.user-item:hover {
    background-color: #f9f0fc;
    border-color: #d946a6;
}

.user-item.active {
    background: linear-gradient(135deg, #f5d6eb 0%, #e8ddf5 100%);
    border-color: #d946a6;
    font-weight: 600;
}

.user-name {
    flex: 1;
}

.status-indicator {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-left: 10px;
}

.status-indicator.online {
    background-color: #4caf50;
    box-shadow: 0 0 5px #4caf50;
}

.status-indicator.offline {
    background-color: #bdbdbd;
}

.text-sm {
    font-size: 0.85em;
}

/* ========================================
   Chat Area
   ======================================== */

.chat-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: linear-gradient(135deg, #faf5fc 0%, #f5f0fc 100%);
}

.chat-header {
    padding: 20px;
    background: linear-gradient(135deg, #d946a6 0%, #c67db8 100%);
    color: white;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    box-shadow: 0 2px 10px rgba(217, 70, 166, 0.1);
}

.chat-info h2 {
    margin-bottom: 5px;
    font-size: 1.5em;
}

.status-text {
    font-size: 0.9em;
    opacity: 0.9;
    margin: 0;
}

.messages-container {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
}

.loading-text {
    text-align: center;
    color: #999;
    padding: 20px;
    font-style: italic;
}

.message {
    margin-bottom: 15px;
    display: flex;
    animation: messageSlideIn 0.3s ease;
}

@keyframes messageSlideIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.message.sent {
    justify-content: flex-end;
}

.message.received {
    justify-content: flex-start;
}

.message-bubble {
    max-width: 60%;
    padding: 12px 16px;
    border-radius: 18px;
    word-wrap: break-word;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.message.sent .message-bubble {
    background: linear-gradient(135deg, #d946a6 0%, #c67db8 100%);
    color: white;
    border-radius: 18px 0 18px 18px;
}

.message.received .message-bubble {
    background-color: white;
    color: #333;
    border-radius: 0 18px 18px 18px;
    border: 1px solid #e8d4eb;
}

.message-timestamp {
    font-size: 0.75em;
    opacity: 0.7;
    margin-top: 5px;
    padding: 0 8px;
}

.message.sent .message-timestamp {
    color: #666;
    text-align: right;
}

.message.received .message-timestamp {
    color: #999;
    text-align: left;
}

/* ========================================
   Message Input Area
   ======================================== */

.message-input-area {
    padding: 20px;
    background-color: white;
    border-top: 1px solid #e8d4eb;
}

#messageForm {
    display: flex;
    gap: 10px;
}

#messageInput {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid #e8d4eb;
    border-radius: 25px;
    font-size: 1em;
    transition: all 0.3s ease;
}

#messageInput:focus {
    outline: none;
    border-color: #d946a6;
    box-shadow: 0 0 10px rgba(217, 70, 166, 0.1);
}

.send-btn {
    padding: 12px 24px;
    background: linear-gradient(135deg, #d946a6 0%, #c67db8 100%);
    color: white;
    border: none;
    border-radius: 25px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.send-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(217, 70, 166, 0.3);
}

.send-btn:active {
    transform: translateY(0);
}

/* ========================================
   Empty State
   ======================================== */

.empty-state {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    height: 100%;
    text-align: center;
    color: #999;
}

.empty-state p {
    margin: 10px 0;
}

.empty-state p:first-child {
    font-size: 2em;
    color: #d946a6;
}

/* ========================================
   Responsive Design
   ======================================== */

@media (max-width: 768px) {
    .chat-container {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        height: auto;
        max-height: 40vh;
        border-right: none;
        border-bottom: 1px solid #e8d4eb;
    }

    .chat-area {
        height: 60vh;
    }

    .message-bubble {
        max-width: 85%;
    }

    .sidebar-header {
        padding: 15px;
    }

    .sidebar h4 {
        padding: 10px 15px 5px;
    }

    .users-list {
        padding: 5px;
        display: flex;
        overflow-x: auto;
        overflow-y: hidden;
    }

    .user-item {
        flex-shrink: 0;
        min-width: 120px;
        flex-direction: column;
        gap: 8px;
    }

    .status-indicator {
        margin-left: 0;
        width: 8px;
        height: 8px;
    }
}

@media (max-width: 480px) {
    .auth-card {
        padding: 25px;
    }

    .auth-card h1 {
        font-size: 2em;
    }

    .chat-header {
        padding: 15px;
    }

    .chat-header h2 {
        font-size: 1.2em;
    }

    .message-bubble {
        max-width: 90%;
        padding: 10px 14px;
        font-size: 0.95em;
    }

    #messageForm {
        gap: 8px;
    }

    #messageInput {
        padding: 10px 14px;
        font-size: 0.95em;
    }

    .send-btn {
        padding: 10px 16px;
        font-size: 0.95em;
    }
}

/* ========================================
   Scrollbar Styling
   ======================================== */

::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
    background: #d946a6;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #c67db8;
}
