/* ========================================
   LOGIN PAGE STYLES
   ======================================== */
:root {
    --bg-primary: #FFFDF7;
    --bg-secondary: #F0EAD6;
    --text-primary: #4A2C2A;
    --text-secondary: #856f6f;
    --brand-primary: #4CAF50;
    --brand-secondary: #45a049;
    --border-color: #DED0B6;
    --wood-dark: #3a2422;
    --wood-light: #5c4240;
}

html {
    box-sizing: border-box;
}

*, *::before, *::after {
    box-sizing: inherit;
}

body {
    font-family: 'Lato', sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 1rem;
    background-image: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%239C92AC' fill-opacity='0.05'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}

.login-container {
    width: 100%;
    max-width: 400px;
    z-index: 10;
}

.login-clipboard {
    background-color: var(--wood-dark);
    padding: 1.5rem 1rem 1rem;
    border-radius: 0.5rem;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    position: relative;
}

.clip {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 120px;
    height: 40px;
    background: linear-gradient(to bottom, #d0d0d0, #b0b0b0);
    border: 1px solid #888;
    border-top-left-radius: 0.5rem;
    border-top-right-radius: 0.5rem;
    border-bottom: none;
    box-shadow: inset 0 2px 2px rgba(255,255,255,0.5);
}

.clip::before {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 30px;
    height: 8px;
    background-color: #999;
    border-radius: 4px 4px 0 0;
    border: 1px solid #777;
    box-shadow: 0 -2px 2px rgba(0,0,0,0.2);
}

.paper {
    background-color: var(--bg-primary);
    padding: 3rem 1.5rem 1.5rem;
    border-radius: 0.25rem;
    box-shadow: inset 0 0 10px rgba(0,0,0,0.05);
    position: relative;
    background-image: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%239C92AC' fill-opacity='0.05'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-secondary);
    text-decoration: none;
    margin-bottom: 2rem;
    transition: color 0.3s ease;
}
.back-link:hover {
    color: var(--text-primary);
}

.login-title {
    font-family: 'Patrick Hand', cursive;
    font-size: 2.5rem;
    text-align: center;
    margin: 0 0 0.5rem;
}

.login-subtitle {
    text-align: center;
    color: var(--text-secondary);
    margin: 0 0 2rem;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.form-label {
    font-weight: 700;
    margin-bottom: 0.5rem;
    display: block;
}

.form-input {
    width: 100%;
    background-color: #fff;
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    padding: 0.75rem 1rem;
    color: var(--text-primary);
    transition: border-color 0.3s, box-shadow 0.3s;
}
.form-input:focus {
    outline: none;
    border-color: var(--brand-secondary);
    box-shadow: 0 0 0 3px rgba(76, 175, 80, 0.2);
}

.auth-error-message {
    color: #c0392b;
    font-size: 0.875rem;
    text-align: center;
}
.hidden {
    display: none;
}

.button-group {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding-top: 0.5rem;
}

.auth-button {
    width: 100%;
    padding: 0.75rem;
    font-weight: 700;
    font-family: 'Nunito', sans-serif;
    border-radius: 50px;
    border: none;
    cursor: pointer;
    background: linear-gradient(180deg, var(--brand-primary) 0%, var(--brand-secondary) 100%);
    color: white;
    border-bottom: 3px solid #388E3C;
    transition: all 0.15s ease-out;
    display: flex;
    align-items: center;
    justify-content: center;
}
.auth-button:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(76, 175, 80, 0.3);
}
.auth-button:active:not(:disabled) {
    transform: translateY(1px);
    border-bottom-width: 1px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}
.auth-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: translateY(0);
    box-shadow: none;
    background: #9E9E9E;
    border-bottom-color: #757575;
}


.secondary-button {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-bottom: 3px solid var(--border-color);
}
.secondary-button:hover:not(:disabled) {
    background: #e5dccb;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.separator {
    text-align: center;
    color: var(--text-secondary);
    margin: 1.5rem 0;
    position: relative;
}
.separator::before, .separator::after {
    content: '';
    position: absolute;
    top: 50%;
    width: 40%;
    height: 1px;
    background-color: var(--border-color);
}
.separator::before { left: 0; }
.separator::after { right: 0; }

.google-button {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.8rem 1rem;
    font-weight: 700;
    font-family: 'Nunito', sans-serif;
    border-radius: 12px; /* match dashboard 3D buttons */
    background-color: #fff;
    color: #333;
    border: 2px solid var(--wood-dark);
    border-bottom: 5px solid var(--wood-dark); /* 3D ridge */
    box-shadow: inset 0 -2px 1px rgba(0,0,0,0.08);
    cursor: pointer;
    transition: all 0.15s ease-out;
}
.google-button:hover {
    background-color: #f7f7f7;
    transform: translateY(-2px);
    border-bottom-width: 7px;
    box-shadow: inset 0 -2px 1px rgba(0,0,0,0.08), 0 4px 10px rgba(0,0,0,0.15);
}
.google-button:active {
    transform: translateY(1px);
    border-bottom-width: 2px;
    box-shadow: inset 0 1px 1px rgba(0,0,0,0.2);
    transition-duration: 0.05s;
}
.google-button svg {
    width: 1.25rem;
    height: 1.25rem;
    margin-right: 0.75rem;
}

.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 1s ease-in-out infinite;
    display: inline-block;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.google-button:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
    box-shadow: inset 0 -2px 1px rgba(0,0,0,0.08);
}

/* --- TOS Agreement Styles --- */
.tos-agreement-group {
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

/* Hide TOS by default in login mode */
.auth-form[data-mode="login"] .tos-agreement-group {
    display: none;
}

/* Show TOS in signup mode */
.auth-form[data-mode="signup"] .tos-agreement-group {
    display: flex;
}

.tos-agreement-group input[type="checkbox"] {
    accent-color: var(--brand-primary);
    width: 1rem;
    height: 1rem;
}

.tos-agreement-group a {
    color: var(--brand-primary);
    text-decoration: none;
    font-weight: 700;
}
.tos-agreement-group a:hover {
    text-decoration: underline;
}

/* --- Modal Styles --- */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 1rem;
    backdrop-filter: blur(4px);
    animation: fadeIn 0.3s ease;
}

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

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

.modal-content {
    background-color: var(--bg-primary);
    padding: 2rem;
    border-radius: 0.5rem;
    max-width: 600px;
    width: 100%;
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 5px 20px rgba(0,0,0,0.2);
    border: 1px solid var(--border-color);
}

.modal-close-button {
    position: absolute;
    top: 0.5rem;
    right: 0.75rem;
    font-size: 2rem;
    font-weight: 300;
    color: var(--text-secondary);
    background: none;
    border: none;
    cursor: pointer;
    line-height: 1;
}
.modal-close-button:hover {
    color: var(--text-primary);
}

.tos-text h2 {
    font-family: 'Patrick Hand', cursive;
    font-size: 2rem;
    margin-top: 0;
    color: var(--text-primary);
}

.tos-text .updated-date {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-top: -1rem;
    margin-bottom: 2rem;
}

.tos-text h3 {
    font-family: 'Nunito', sans-serif;
    font-weight: 900;
    margin-top: 1.5rem;
    margin-bottom: 0.5rem;
}

.tos-text p, .tos-text li {
    line-height: 1.6;
    color: var(--text-primary);
}

.tos-text ul {
    padding-left: 1.5rem;
}

.tos-text li {
    margin-bottom: 0.5rem;
}
