/* connected-campus-chat/public/style.css */

/* Basic Reset & Body Styles */
:root {
    --primary-color: #007bff;
    --secondary-color: #6c757d;
    --accent-color: #28a745;
    --background-color: #f4f7f6;
    --card-background: #ffffff;
    --text-color: #333;
    --light-text-color: #666;
    --border-color: #ddd;
    --success-bg: #d4edda;
    --success-text: #155724;
    --error-bg: #f8d7da;
    --error-text: #721c24;
    --info-bg: #e2e3e5;
    --info-text: #333;
}

*, *::before, *::after {
    box-sizing: border-box; /* Ensures padding and border are included in the element's total width and height */
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    margin: 0;
    background-color: var(--background-color);
    color: var(--text-color);
    line-height: 1.6;
}

/* Container & Card Styles */
.container {
    background-color: var(--card-background);
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: 450px;
}

.auth-container {
    text-align: center;
}

h1, h2 {
    color: var(--primary-color);
    margin-bottom: 15px;
}

h1 {
    font-size: 2.2em;
    font-weight: 700;
}

h2 {
    font-size: 1.6em;
    font-weight: 600;
    margin-top: 25px;
    margin-bottom: 20px;
}

p {
    color: var(--light-text-color);
    margin-bottom: 25px;
}

/* Form Styles */
form {
    display: flex;
    flex-direction: column;
    gap: 15px; /* Space between form groups */
}

.form-group {
    margin-bottom: 3px; /* Slightly reduce space as gap handles most */
    text-align: left;
}

label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--text-color);
}

input[type="email"],
input[type="password"],
input[type="text"] {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 1em;
    transition: border-color 0.2s, box-shadow 0.2s;
}

input[type="file"] { /* File input specifically styled for better visibility */
    width: 100%;
    padding: 8px; /* Adjust padding for file input */
    border: 1px dashed var(--border-color); /* Dashed border for file input */
    background-color: #fbfbfb;
    border-radius: 6px;
    font-size: 0.95em;
    cursor: pointer;
}

input[type="email"]:focus,
input[type="password"]:focus,
input[type="text"]:focus,
input[type="file"]:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.25);
    outline: none;
}

/* Buttons */
button {
    padding: 12px 25px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1.05em;
    font-weight: 600;
    transition: background-color 0.2s, transform 0.1s;
    width: 100%;
    margin-top: 10px; /* Space between buttons */
    white-space: nowrap; /* Prevent button text from wrapping */
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background-color: #0056b3;
    transform: translateY(-1px);
}
.btn-primary:disabled {
    background-color: #a0c3ec; /* Lighter color for disabled */
    cursor: not-allowed;
    opacity: 0.7;
}


.btn-secondary {
    background-color: var(--secondary-color);
    color: white;
}

.btn-secondary:hover:not(:disabled) {
    background-color: #5a6268;
    transform: translateY(-1px);
}
.btn-secondary:disabled {
    background-color: #b0b4b8; /* Lighter color for disabled */
    cursor: not-allowed;
    opacity: 0.7;
}

/* Auth Toggle (Sign Up / Login Buttons) */
.auth-toggle {
    display: flex;
    justify-content: center;
    margin-bottom: 25px;
    border-radius: 8px;
    overflow: hidden;
    background-color: #e9ecef;
}

.auth-toggle button {
    flex: 1;
    border: none;
    padding: 10px 0;
    background-color: #e9ecef;
    color: var(--light-text-color);
    font-weight: 600;
    font-size: 1em;
    transition: background-color 0.2s, color 0.2s;
    border-radius: 0; /* Override default button radius */
}

.auth-toggle button.active {
    background-color: var(--primary-color);
    color: white;
    box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.1);
}

.auth-toggle button:first-child {
    border-top-left-radius: 8px;
    border-bottom-left-radius: 8px;
}

.auth-toggle button:last-child {
    border-top-right-radius: 8px;
    border-bottom-right-radius: 8px;
}

/* Auth Sections */
.auth-section {
    display: none;
    animation: fadeIn 0.5s ease-out;
}

.auth-section.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Message Box */
.message-box {
    margin-top: 25px;
    padding: 12px;
    border-radius: 8px;
    font-size: 0.95em;
    font-weight: 500;
    display: none; /* Hidden by default */
    text-align: left;
}

.message-box.success {
    background-color: var(--success-bg);
    color: var(--success-text);
    border: 1px solid #c3e6cb;
}

.message-box.error {
    background-color: var(--error-bg);
    color: var(--error-text);
    border: 1px solid #f5c6cb;
}

.message-box.info {
    background-color: var(--info-bg);
    color: var(--info-text);
    border: 1px solid #a8b0b8;
}

/* File Upload Group */
.file-upload-group {
    display: flex;
    flex-direction: column;
    align-items: flex-start; /* Align label and input to start */
}

.file-upload-group label {
    margin-bottom: 8px;
}

.file-upload-group button {
    width: auto; /* Allow button to size itself */
    align-self: flex-end; /* Align to the right */
    margin-top: 10px;
}

.instructions-box {
    background-color: #e6f7ff;
    border: 1px solid #b3e0ff;
    border-radius: 8px;
    padding: 15px;
    margin-top: 15px;
    text-align: left;
    font-size: 0.9em;
    color: #0056b3;
    line-height: 1.5;
}

.instructions-box ol {
    padding-left: 20px;
    margin: 10px 0;
}
.instructions-box li {
    margin-bottom: 5px;
}
.instructions-box b {
    color: #004085;
}

/* Dashboard styles (basic placeholders, will be expanded) */
.dashboard-container {
    display: flex;
    min-height: 100vh;
    width: 100%;
    max-width: 1200px; /* Max width for dashboard */
    background-color: var(--card-background);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
    border-radius: 12px;
    overflow: hidden; /* For fixed sidebar */
}

.sidebar {
    width: 280px;
    background-color: #f8f9fa;
    padding: 20px;
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.sidebar h2 {
    font-size: 1.4em;
    margin-bottom: 15px;
    color: var(--primary-color);
}

.sidebar nav ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.sidebar nav li {
    margin-bottom: 10px;
}

.sidebar nav a {
    display: block;
    padding: 10px 15px;
    text-decoration: none;
    color: var(--text-color);
    border-radius: 6px;
    transition: background-color 0.2s, color 0.2s;
    font-weight: 500;
}

.sidebar nav a:hover,
.sidebar nav a.active {
    background-color: var(--primary-color);
    color: white;
}

.sidebar nav a .fas {
    margin-right: 8px; /* Space for icons */
}

.sidebar-bottom {
    margin-top: auto; /* Pushes content to the bottom */
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
}

.sidebar-bottom nav ul {
    list-style: none;
    padding: 0;
    margin-bottom: 15px;
}

.main-content {
    flex-grow: 1;
    padding: 20px;
    display: flex;
    flex-direction: column;
}

.chat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border-color);
}

.chat-header h2 {
    margin: 0;
    font-size: 1.8em;
}

.chat-messages {
    flex-grow: 1;
    overflow-y: auto;
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background-color: #fdfdff;
    margin-bottom: 15px;
    display: flex;
    flex-direction: column; /* Messages stack from top */
}

.message-bubble {
    background-color: #e9eff5;
    padding: 10px 15px;
    border-radius: 15px;
    margin-bottom: 8px;
    max-width: 75%;
    align-self: flex-start; /* Default alignment */
    word-wrap: break-word;
}

.message-bubble.own-message {
    background-color: var(--accent-color);
    color: white;
    align-self: flex-end; /* Align own messages to the right */
}

.message-bubble .sender-name {
    font-weight: 600;
    font-size: 0.9em;
    margin-bottom: 3px;
    color: #444; /* Darker color for sender name */
}

.message-bubble.own-message .sender-name {
    color: rgba(255, 255, 255, 0.8);
}

.message-bubble .timestamp {
    font-size: 0.75em;
    color: var(--light-text-color);
    margin-top: 5px;
    text-align: right;
    display: block;
}
.message-bubble.own-message .timestamp {
    color: rgba(255, 255, 255, 0.7);
}


.chat-input-area {
    display: flex;
    gap: 10px;
    margin-top: 15px;
    align-items: center; /* Vertically align items */
}

.chat-input-area input[type="text"] {
    flex-grow: 1;
    border-radius: 25px; /* Rounded input */
    padding: 12px 20px;
}

.chat-input-area button,
.chat-input-area .image-upload-btn { /* Style for file upload label acting as button */
    width: auto;
    padding: 12px 20px;
    border-radius: 25px; /* Rounded button */
    font-size: 1em;
    display: inline-flex; /* For icon + text alignment */
    align-items: center;
    justify-content: center;
    gap: 5px; /* Space between icon and text */
}
.image-upload-btn {
    margin-top: 0; /* Override default button margin-top */
    color: white;
    background-color: var(--secondary-color);
    cursor: pointer;
}
.image-upload-btn:hover {
    background-color: #5a6268;
}
.message-bubble img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin-top: 5px;
}

/* Profile Section Styles */
.profile-section {
    background-color: var(--card-background);
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    margin-bottom: 20px;
    text-align: left;
}
.profile-section h3 {
    color: var(--primary-color);
    margin-top: 0;
    margin-bottom: 15px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 10px;
}
.profile-section p {
    margin-bottom: 10px;
    color: var(--text-color);
}
.profile-section p strong {
    color: var(--primary-color);
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .container {
        padding: 20px;
        margin: 15px;
        border-radius: 8px;
    }
    .auth-toggle {
        flex-direction: column;
    }
    .auth-toggle button {
        border-radius: 6px !important;
        margin-bottom: 5px;
    }
    .dashboard-container {
        flex-direction: column;
        border-radius: 0;
        box-shadow: none;
        max-width: 100%; /* Full width on small screens */
    }
    .sidebar {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
        padding-bottom: 10px;
        text-align: center;
    }
    .sidebar nav ul {
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
        gap: 5px;
    }
    .sidebar nav li {
        width: auto; /* Adjust width for inline items */
        margin-bottom: 5px;
    }
    .sidebar nav a {
        padding: 8px 12px;
        font-size: 0.9em;
    }
    .main-content {
        padding: 15px;
    }
    .chat-messages {
        height: 50vh; /* Fixed height for chat messages on small screens */
    }
    .message-bubble {
        max-width: 90%;
    }
    .chat-input-area {
        flex-wrap: wrap; /* Wrap input and buttons */
    }
    .chat-input-area input[type="text"] {
        order: 1; /* Message input first */
        width: 100%;
    }
    .chat-input-area .image-upload-btn {
        order: 2; /* Image button next */
        flex-grow: 1; /* Take available width */
    }
    .chat-input-area button {
        order: 3; /* Send button last */
        flex-grow: 1; /* Take available width */
    }
}