/* --- Global Styles & Variables --- */
:root {
    --primary-color: #007bff; /* Blue */
    --secondary-color: #6c757d; /* Gray */
    --success-color: #28a745; /* Green */
    --danger-color: #dc3545; /* Red */
    --light-color: #f8f9fa;
    --dark-color: #343a40;
    --background-gradient: linear-gradient(135deg, #ece9e6 0%, #ffffff 100%); /* Subtle gradient */
    --card-background: #ffffff;
    --font-family: 'Poppins', sans-serif;
    --border-radius: 8px;
    --box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
}

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

body {
    font-family: var(--font-family);
    background: var(--background-gradient);
    color: var(--dark-color);
    line-height: 1.6;
    display: flex;
    justify-content: center;
    align-items: flex-start; /* Align content to the top */
    min-height: 100vh;
    padding: 20px;
}

img {
    width: 200px;
}

.app-container {
    max-width: 600px;
    width: 100%;
    margin-top: 30px; /* Spacing from top */
}

.app-header {
    text-align: center;
    margin-bottom: 30px;
    color: var(--primary-color);
}

.app-header h1 {
    font-weight: 700;
    margin-bottom: 5px;
}

.app-header p {
    font-size: 1rem;
    color: var(--secondary-color);
}

/* --- Card Styling --- */
.card {
    background-color: var(--card-background);
    padding: 30px;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    margin-bottom: 25px;
    transition: transform 0.2s ease-in-out;
}

/* --- Forms & Inputs --- */
.auth-section h2, .dashboard h2, .send-message-section h2 {
    text-align: center;
    margin-bottom: 25px;
    color: var(--dark-color);
    font-weight: 600;
}

input[type="email"],
input[type="password"],
input[type="text"],
textarea {
    width: 100%;
    padding: 12px 15px;
    margin-bottom: 15px;
    border: 1px solid #ced4da;
    border-radius: calc(var(--border-radius) / 2);
    font-size: 1rem;
    font-family: var(--font-family);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

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

textarea {
    resize: vertical;
    min-height: 100px;
}

/* --- Buttons --- */
.btn {
    display: inline-block; /* Changed to inline-block for better control */
    width: auto; /* Auto width */
    padding: 10px 25px; /* Adjusted padding */
    border: none;
    border-radius: calc(var(--border-radius) / 2);
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    text-align: center;
    transition: background-color 0.2s ease, transform 0.1s ease;
    margin-top: 10px; /* Add some top margin */
}
.btn:active {
    transform: scale(0.98); /* Slight press effect */
}


.btn-primary {
    background-color: var(--primary-color);
    color: white;
    width: 100%; /* Make primary buttons full width */
}

.btn-primary:hover {
    background-color: #0056b3;
}

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

.btn-secondary:hover {
    background-color: #5a6268;
}

.btn-danger {
    background-color: var(--danger-color);
    color: white;
    margin-top: 20px; /* More margin for logout */
}

.btn-danger:hover {
    background-color: #c82333;
}

.btn-link {
    background: none;
    border: none;
    color: var(--primary-color);
    padding: 0;
    font-size: 0.9rem;
    cursor: pointer;
    text-decoration: underline;
    margin-top: 0;
}

/* --- Auth Specific --- */
.auth-switch {
    text-align: center;
    margin-top: 20px;
    font-size: 0.9rem;
}

.error-message {
    color: var(--danger-color);
    font-size: 0.85rem;
    text-align: center;
    margin-top: 10px;
    min-height: 1.2em; /* Prevent layout shift */
}

/* --- Dashboard Specific --- */
.dashboard #user-identifier {
    font-weight: 600;
    color: var(--primary-color);
}

.share-link-area {
    margin-top: 20px;
    margin-bottom: 30px;
}

.share-link-area label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
}

.input-group {
    display: flex;
}

.input-group input {
    flex-grow: 1;
    margin-bottom: 0;
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
    background-color: #e9ecef; /* Indicate readonly */
}

.input-group button {
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
    margin-top: 0; /* Remove top margin for grouped button */
    padding: 10px 15px; /* Adjust padding */
}

.share-link-area small {
    display: block;
    margin-top: 8px;
    font-size: 0.85rem;
    color: var(--secondary-color);
}


.dashboard h3 {
    margin-top: 30px;
    margin-bottom: 15px;
    border-top: 1px solid #eee;
    padding-top: 20px;
    text-align: center;
    font-weight: 600;
}

.messages-container {
    max-height: 450px;
    overflow-y: auto;
    padding-right: 10px; /* Space for scrollbar */
}

/* Custom Scrollbar */
.messages-container::-webkit-scrollbar {
    width: 8px;
}
.messages-container::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}
.messages-container::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 10px;
}
.messages-container::-webkit-scrollbar-thumb:hover {
    background: #aaa;
}


.message-card {
    background-color: #eef7ff; /* Lighter blue for messages */
    padding: 15px 20px;
    margin-bottom: 15px;
    border-radius: var(--border-radius);
    border-left: 5px solid var(--primary-color);
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    word-wrap: break-word;
}

.message-card p {
    margin: 0 0 8px 0;
    font-size: 0.95rem;
}

.message-card .timestamp {
    font-size: 0.75rem;
    color: #555;
    display: block;
    text-align: right;
}

.no-messages {
    color: var(--secondary-color);
    text-align: center;
    padding: 20px 0;
    font-style: italic;
}

/* --- Send Page Specific --- */
.send-message-section p {
    text-align: center;
    margin-bottom: 20px;
    color: var(--secondary-color);
}

.username-highlight {
    font-weight: 600;
    color: var(--primary-color);
}

.status-message {
    text-align: center;
    margin-top: 15px;
    font-weight: 600;
    min-height: 1.2em; /* Prevent layout shift */
    transition: color 0.3s ease;
}
.status-message.success {
    color: var(--success-color);
}
.status-message.error {
     color: var(--danger-color);
}

.back-link {
    display: block;
    text-align: center;
    margin-top: 25px;
}


/* --- Responsiveness --- */
@media (max-width: 768px) {
    .card {
        padding: 25px;
    }
     .app-header h1 {
        font-size: 1.8rem;
    }
}

@media (max-width: 480px) {
    body {
        padding: 10px;
    }
    .app-container {
        margin-top: 15px;
    }
     .card {
        padding: 20px;
    }
    .app-header h1 {
        font-size: 1.6rem;
    }
    .btn {
        padding: 10px 15px;
        font-size: 0.9rem;
    }
    input[type="email"],
    input[type="password"],
    input[type="text"],
    textarea {
         font-size: 0.9rem;
         padding: 10px 12px;
    }
    .message-card {
        padding: 12px 15px;
    }
}