/* ========================================
   Login Page CSS
   Uses DRY principles - only page-specific styles
   Reuses: form-control, form-label, btn-primary from common.css
   Prefix: login-
   ======================================== */

/* Import DM Sans font (Google Fonts fallback) */
@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;700&display=swap');

/* CSS Reset for login page */
* {
    border: 0;
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    vertical-align: baseline;
}

/* Base HTML & Body */
html,
body {
    -webkit-font-smoothing: antialiased;
    color: var(--text-primary);
    height: 100%;
    font-family: "DM Sans", -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    font-size: 100%;
}

body {
    display: grid;
    grid-template-rows: 1fr auto;
    background: var(--card-bg);
}

/* Main container - centered layout */
main {
    align-items: center;
    display: flex;
    justify-content: center;
}

/* Login section container */
section.login-section {
    padding: 22px 40px 60px;
    width: 400px;
}

/* Typography */
h1 {
    font-size: 24px;
    font-weight: 400;
    line-height: 36px;
    margin: 16px 0 0;
    color: var(--text-primary);
    text-align: center;
}

h2 {
    font-size: 20px;
    font-weight: 400;
    line-height: 36px;
    margin: 16px 0 0;
    color: var(--text-primary);
}

p {
    line-height: 24px;
    color: var(--text-primary);
}

p.subtitle {
    margin-bottom: 24px;
    margin-top: 0;
}

/* Brand section with centered icon */
.brand-section {
    text-align: center;
    margin-bottom: 24px;
}

.brand-icon {
    width: 64px;
    height: 64px;
    display: block;
    margin: 0 auto;
}

/* Form styles */
form {
    display: flex;
    flex-direction: column;
    padding-top: 8px;
}

form p {
    margin-top: 0;
    margin-bottom: 24px;
}

/* Form row with labeled input */
.form-row {
    margin-bottom: 12px;
    position: relative;
}

.form-row.labeled-input {
    display: flex;
    flex-direction: column;
    position: relative;
}

/* Input fields - clean, modern styling */
input {
    border-radius: 12px;
    border: solid 1px var(--border-color);
    font-size: 16px;
    height: 52px;
    outline: none;
    padding: 0 16px;
    width: 100%;
    transition: all 100ms linear;
    background-color: var(--card-bg);
    color: var(--text-primary);
    font-family: "DM Sans", -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

input:disabled {
    cursor: not-allowed;
    opacity: 0.6;
}

/* Hide placeholder by default for floating label effect */
input::placeholder {
    opacity: 0;
}

/* Focus state */
input:focus {
    border-color: var(--focus-color);
    box-shadow: 0 0 0 1px var(--focus-color);
    transition: all 100ms linear;
}

/* Remove spinner from number inputs */
input::-webkit-outer-spin-button,
input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

input[type="number"] {
    -moz-appearance: textfield;
}

/* Labels - Floating label implementation */
label {
    background-color: var(--card-bg);
    color: var(--text-secondary);
    pointer-events: none;
    position: absolute;
    transform: translate(23px, 16px);
    transition: all 100ms linear;
    font-size: 16px;
    left: 0;
    top: 0;
}

/* Label moves up when input has focus or content */
input:not(:placeholder-shown) + label,
input:focus + label {
    padding: 0 6px;
    position: absolute;
    transform: scale(0.88) translate(3px, -13px);
    transition: all 100ms linear;
}

/* Label color change on focus */
input:focus + label {
    color: var(--focus-color);
}

/* Button styling - Use standard button from common.css with login-specific overrides */
button {
    background: var(--primary-color);
    color: white;
    border: 1px solid var(--primary-color);
    border-radius: 8px;
    font-size: 16px;
    font-weight: 500;
    height: 48px;
    cursor: pointer;
    transition: all 0.15s ease;
    margin-top: 24px;
    font-family: "DM Sans", -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 0 16px;
}

button:hover:not(:disabled) {
    background: var(--primary-dark);
    border-color: var(--primary-dark);
}

button:active:not(:disabled) {
    background: var(--primary-dark);
    border-color: var(--primary-dark);
}

button:disabled {
    background: var(--light-bg);
    color: var(--text-disabled);
    border-color: var(--border-color);
    cursor: not-allowed;
    opacity: 0.6;
}

button.success {
    background: var(--success-color);
    border-color: var(--success-color);
    color: white;
}

/* Loading spinner */
.loading-spinner {
    display: none;
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Error message styling */
.error,
#error {
    display: none;
    background-color: rgba(239, 68, 68, 0.1);
    color: var(--danger-color);
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 16px;
    border: 1px solid rgba(239, 68, 68, 0.2);
    font-size: 14px;
    line-height: 20px;
}

.error:not(:empty),
#error:not(:empty) {
    display: block;
}

/* Success message styling */
.success {
    display: none;
    background-color: rgba(16, 185, 129, 0.1);
    color: var(--success-color);
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 16px;
    border: 1px solid rgba(16, 185, 129, 0.2);
    font-size: 14px;
    line-height: 20px;
}

.success:not(:empty) {
    display: block;
}

/* Links */
a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 700;
    transition: all 100ms linear;
}

a:hover {
    text-decoration: underline;
}

/* Hidden utility class */
.hidden {
    display: none !important;
}

/* Footer styling */
footer {
    font-size: 16px;
    line-height: 24px;
    padding: 16px 0;
    text-align: center;
    color: var(--text-primary);
}

footer a {
    color: var(--primary-color);
    font-weight: 700;
}

footer ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

footer ul li {
    display: inline-block;
    margin: 0 4px;
}

footer ul li + li {
    margin-left: 0;
}

footer ul li:not(:first-of-type)::before {
    content: "\2022";
    margin-right: 8px;
    color: var(--text-secondary);
}

/* Responsive Design - Pattern 5: Standard breakpoints */
@media (max-width: 968px) {
    section.login-section {
        padding: 40px 35px;
    }
}

@media (max-width: 640px) {
    main {
        align-items: unset;
        padding-top: 42px;
    }

    section.login-section {
        width: 100%;
        padding: 45px 20px;
    }

    h1 {
        font-size: 20px;
        line-height: 28px;
    }

    input {
        font-size: 16px;
        height: 48px;
    }

    button {
        height: 44px;
        font-size: 15px;
    }
}

@media (max-width: 480px) {
    section.login-section {
        padding: 30px 16px;
    }

    h1 {
        font-size: 18px;
        line-height: 26px;
    }
}
