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

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

body {
    font-family: 'Merriweather', serif;
    background-color: #dcd0c0; /* Light wood/desk color */
    background-image: url('https://www.transparenttextures.com/patterns/wood-pattern.png'); /* Subtle wood texture */
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px 0; /* Add vertical padding for smaller screens */
    color: #5a4a3a; /* Warm, dark brown for text */
}

.logo {
    width: 80px;
    height: 80px;
    margin-bottom: 10px;
    border-radius: 50%;
}

.container {
    width: 400px;
    background: #fdfbf7; /* Off-white, like aged paper */
    border-radius: 8px;
    padding: 40px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
    border: 1px solid rgba(0,0,0,0.05);
}

.dashboard-container {
    width: 100%;
    max-width: 600px;
    display: none; /* Initially hidden */
}

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

.input-group {
    position: relative;
    margin-bottom: 20px;
}

.input-group i {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: #a27b5c; /* Lighter brown for accents */
    z-index: 2; /* Ensure icons are on top of the input field */
}

.toggle-password {
    /* Override the default left position for the toggle icon */
    left: auto !important; 
    right: 15px;
    cursor: pointer;
}

.otp-message {
    font-size: 0.9rem;
    margin-bottom: 20px;
    color: #eee;
}

h1 {
    font-family: 'Kalam', cursive;
    font-size: 2.5rem;
    margin-bottom: 30px;
}

input {
    width: 100%;
    padding: 15px 40px; /* Adjust padding for icons */
    margin-bottom: 0; /* Remove margin as it's now on input-group */
    border: 1px solid #ddd;
    border-radius: 4px;
    background-color: #fff;
    color: #5a4a3a;
    font-size: 16px;
    font-family: 'Merriweather', serif;
}

textarea {
    width: 100%;
    padding: 15px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background-color: #fff;
    color: #5a4a3a;
    font-size: 16px;
    font-family: 'Merriweather', serif;
    resize: vertical;
}
input::placeholder {
    color: #ddd;
}

input:focus {
    outline: none;
    border-color: #a27b5c;
    box-shadow: 0 0 5px rgba(162, 123, 92, 0.3);
}

/* Override browser autofill styles */
input:-webkit-autofill,
input:-webkit-autofill:hover, 
input:-webkit-autofill:focus, 
input:-webkit-autofill:active {
    -webkit-text-fill-color: #5a4a3a; /* Match our dark text color */
    box-shadow: 0 0 0px 1000px #fff inset; /* Force background to be white */
}

button {
    width: 100%;
    padding: 15px;
    border: none;
    background: #5a4a3a;
    color: #fff;
    border-radius: 4px;
    font-family: 'Kalam', cursive;
    font-size: 1.4rem;
    font-weight: 700;
    cursor: pointer;
    transition: background-color 0.3s, transform 0.2s;
}

button:hover {
    background-color: #a27b5c;
    transform: translateY(-2px);
}

button:disabled {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
}

.loader {
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top: 4px solid #fff;
    width: 24px;
    height: 24px;
    animation: spin 1s linear infinite;
    flex-shrink: 0; /* Prevent the loader from shrinking */
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

p {
    margin-top: 20px;
}

a {
    color: #a27b5c;
    text-decoration: none;
    font-weight: 600;
}

a:hover {
    text-decoration: underline;
}

/* Dashboard Styles */
.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
}

.dashboard-header h1 {
    margin-bottom: 0;
}

#logout-button {
    width: auto;
    padding: 10px 20px;
    font-size: 1rem;
    background-color: #A93226; /* Red accent */
}

#logout-button:hover {
    background-color: #c0392b;
}

.share-link-box {
    background-color: #FCFAF5; /* Lighter paper color */
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 30px;
    text-align: center;
    border: 1px dashed #a27b5c;
}

.share-link-box h2 {
    font-family: 'Kalam', cursive;
    margin-bottom: 10px;
}

.share-link-box .input-group {
    display: flex;
}

.share-link-box input {
    border-right: none;
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
}

#copy-link-button {
    width: auto;
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
}

#inbox-container {
    display: grid;
    gap: 20px;
}

.message-card {
    background: #FCFAF5;
    padding: 20px;
    border-radius: 4px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.08);
    border-left: 5px solid #A93226; /* Red accent */
    text-align: left;
}

/* Single Message "Letter" View */
.letter-container {
    width: 100%;
    max-width: 700px;
    display: none; /* Initially hidden */
}

.letter-content {
    background: #fdfbf7;
    padding: 50px;
    border-radius: 8px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
    font-family: 'Kalam', cursive;
}

#letter-paper {
    background: #FCFAF5;
    padding: 30px;
    border: 1px solid #eee;
    min-height: 200px;
    margin-bottom: 30px;
    position: relative;
}

#single-message-text {
    font-size: 1.5rem;
    line-height: 1.8;
    margin-top: 0;
    color: #333;
}

.message-meta {
    text-align: right;
    font-size: 0.9rem;
    color: #a27b5c;
    margin-top: 20px;
    font-family: 'Merriweather', serif;
}

.message-meta span {
    display: block;
}

#single-message-reply-area {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px dashed #a27b5c;
}

.reply-box {
    background: rgba(162, 123, 92, 0.05);
    padding: 15px;
    border-radius: 4px;
}

.reply-box p {
    margin: 0;
    font-size: 1.2rem;
}

.reply-box .reply-meta {
    text-align: right;
    font-size: 0.8rem;
    margin-top: 10px;
    font-family: 'Merriweather', serif;
}

#letter-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-bottom: 30px;
}

#letter-actions button, #letter-reply-form-area button {
    width: auto;
    padding: 10px 20px;
    font-size: 1rem;
}

#letter-reply-form-area textarea {
    margin-bottom: 10px;
}

.back-link-container {
    text-align: center;
    margin-top: 20px;
}
