/**
 * Auth pages styles (Login, Register)
 * Modern dark theme with gradient accents
 */

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

:root {
    --primary: #7c3aed;
    --primary-dark: #5b21b6;
    --accent: #c026d3;
    --surface: rgba(255, 255, 255, 0.03);
    --surface-hover: rgba(255, 255, 255, 0.08);
    --text: #f8fafc;
    --text-muted: rgba(255, 255, 255, 0.6);
    --border: rgba(255, 255, 255, 0.1);
    --error: #f43f5e;
    --success: #10b981;
}

body {
    font-family: 'Outfit', -apple-system, sans-serif;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    background: #0a0a0f url('../images/backgrounds/login-book.jpg') center/cover no-repeat fixed;
    overflow-x: hidden;
}

/* Dark overlay for readability */
.bg-overlay {
    position: fixed;
    inset: 0;
    z-index: -1;
    background: rgba(0, 0, 0, 0.5);
}

.auth-container {
    width: 100%;
    max-width: 480px;
    animation: containerReveal 0.8s cubic-bezier(0.22, 1, 0.36, 1) forwards;
    opacity: 0;
    transform: translateY(30px);
}

@keyframes containerReveal {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Logo section */
.logo-section {
    text-align: center;
    margin-bottom: 2.5rem;
    animation: logoReveal 0.6s 0.2s cubic-bezier(0.22, 1, 0.36, 1) forwards;
    opacity: 0;
    transform: translateY(20px);
}

@keyframes logoReveal {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.logo-icon {
    width: 70px;
    height: 70px;
    margin: 0 auto 1.25rem;
    position: relative;
}

.logo-icon svg {
    width: 100%;
    height: 100%;
    filter: drop-shadow(0 0 30px rgba(124, 58, 237, 0.5));
}

.logo-icon .square-first {
    animation: float 4s ease-in-out infinite;
}
.logo-icon .square-second {
    animation: float 4s ease-in-out 0.3s infinite;
}
.logo-icon .square-third {
    animation: float 4s ease-in-out 0.6s infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-5px); }
}

.brand-name {
    font-family: 'Outfit', -apple-system, sans-serif;
    font-size: 1.75rem;
    font-weight: 600;
    color: var(--text);
    letter-spacing: -0.02em;
    margin-bottom: 0.5rem;
}

.brand-tagline {
    font-size: 0.95rem;
    color: var(--text-muted);
    font-weight: 400;
}

/* Form card */
.form-card {
    background: rgba(15, 15, 20, 0.65);
    border: 1px solid var(--border);
    border-radius: 24px;
    padding: 2.5rem;
    box-shadow:
        0 0 0 1px rgba(255,255,255,0.05) inset,
        0 25px 50px -12px rgba(0, 0, 0, 0.5);
    animation: cardReveal 0.7s 0.3s cubic-bezier(0.22, 1, 0.36, 1) forwards;
    opacity: 0;
    transform: translateY(20px) scale(0.98);
}

@keyframes cardReveal {
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.form-title {
    font-family: 'Outfit', -apple-system, sans-serif;
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text);
    text-align: center;
    margin-bottom: 2rem;
    letter-spacing: -0.01em;
}

/* Error alert */
.alert-error {
    background: rgba(244, 63, 94, 0.1);
    border: 1px solid rgba(244, 63, 94, 0.3);
    border-radius: 12px;
    padding: 1rem 1.25rem;
    margin-bottom: 1.5rem;
    color: #fda4af;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    animation: shake 0.5s ease-in-out;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-5px); }
    40%, 80% { transform: translateX(5px); }
}

.alert-error svg {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
}

/* Success alert */
.alert-success {
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.3);
    border-radius: 12px;
    padding: 1rem 1.25rem;
    margin-bottom: 1.5rem;
    color: #6ee7b7;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    animation: fadeIn 0.5s ease-in-out;
}

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

.alert-success svg {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
}

/* Form description */
.form-description {
    color: var(--text-muted);
    font-size: 0.95rem;
    text-align: center;
    margin-bottom: 1.5rem;
    line-height: 1.5;
}

/* Info alert */
.alert-info {
    background: rgba(59, 130, 246, 0.1);
    border: 1px solid rgba(59, 130, 246, 0.3);
    border-radius: 12px;
    padding: 1rem 1.25rem;
    margin-bottom: 1.5rem;
    color: #93c5fd;
    font-size: 0.9rem;
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    line-height: 1.5;
}

.alert-info svg {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    margin-top: 2px;
}

/* Warning alert */
.alert-warning {
    background: rgba(245, 158, 11, 0.1);
    border: 1px solid rgba(245, 158, 11, 0.3);
    border-radius: 12px;
    padding: 1rem 1.25rem;
    margin-bottom: 1.5rem;
    color: #fcd34d;
    font-size: 0.9rem;
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    line-height: 1.5;
}

.alert-warning svg {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    margin-top: 2px;
}

/* Icon header */
.icon-header {
    width: 64px;
    height: 64px;
    margin: 0 auto 1.5rem;
    background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: iconPulse 2s ease-in-out infinite;
}

.icon-header svg {
    width: 32px;
    height: 32px;
    color: white;
}

.icon-header.icon-error {
    background: linear-gradient(135deg, #ef4444 0%, #f97316 100%);
}

@keyframes iconPulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(124, 58, 237, 0.4); }
    50% { box-shadow: 0 0 0 15px rgba(124, 58, 237, 0); }
}

/* Info card */
.info-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border);
    border-radius: 12px;
    margin-bottom: 1.5rem;
    overflow: hidden;
}

.info-card-title {
    font-family: 'Outfit', -apple-system, sans-serif;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text);
    padding: 0.75rem 1rem;
    background: rgba(255, 255, 255, 0.03);
    border-bottom: 1px solid var(--border);
    margin: 0;
}

.info-card-content {
    padding: 0.5rem 0;
}

.info-row {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem 1rem;
}

.info-label {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.info-value {
    color: var(--text);
    font-size: 0.9rem;
    font-weight: 500;
}

/* Button group */
.button-group {
    display: flex;
    gap: 1rem;
    margin-top: 0.5rem;
}

@media (max-width: 480px) {
    .button-group {
        flex-direction: column;
    }
}

/* Secondary button */
.btn-secondary {
    flex: 1;
    padding: 1rem 2rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border);
    border-radius: 12px;
    color: var(--text);
    font-family: inherit;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    text-align: center;
    text-decoration: none;
    transition: all 0.3s cubic-bezier(0.22, 1, 0.36, 1);
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
}

/* Link button (for logout etc) */
.link-button {
    background: none;
    border: none;
    color: var(--accent);
    font-family: inherit;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: color 0.2s ease;
    padding: 0;
}

.link-button:hover {
    color: #e879f9;
}

/* Text center utility */
.text-center {
    text-align: center;
}

/* Form row for side by side inputs */
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

@media (max-width: 480px) {
    .form-row {
        grid-template-columns: 1fr;
    }
}

/* Input group */
.input-group {
    margin-bottom: 1.25rem;
    position: relative;
}

.input-group label {
    display: block;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    transition: color 0.3s ease;
}

.input-group:focus-within label {
    color: var(--accent);
}

.input-wrapper {
    position: relative;
}

.input-wrapper svg {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    color: var(--text-muted);
    transition: color 0.3s ease;
    pointer-events: none;
}

.input-group:focus-within .input-wrapper svg {
    color: var(--accent);
}

.input-wrapper input {
    width: 100%;
    padding: 0.9rem 1rem 0.9rem 2.75rem;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border);
    border-radius: 12px;
    color: var(--text);
    font-family: inherit;
    font-size: 0.95rem;
    transition: all 0.3s cubic-bezier(0.22, 1, 0.36, 1);
    outline: none;
}

.input-wrapper input::placeholder {
    color: rgba(255, 255, 255, 0.3);
}

.input-wrapper input:hover {
    border-color: rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.05);
}

.input-wrapper input:focus {
    border-color: var(--accent);
    background: rgba(192, 38, 211, 0.05);
    box-shadow:
        0 0 0 3px rgba(192, 38, 211, 0.15),
        0 0 20px rgba(192, 38, 211, 0.1);
}

/* Password toggle */
.password-toggle {
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0.25rem;
    transition: color 0.2s ease;
}

.password-toggle:hover {
    color: var(--text);
}

.password-toggle svg {
    position: static;
    transform: none;
    width: 18px;
    height: 18px;
}

/* Checkbox styles */
.checkbox-group {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.checkbox-wrapper {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
}

.checkbox-wrapper input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--accent);
    cursor: pointer;
}

.checkbox-wrapper span {
    font-size: 0.9rem;
    color: var(--text-muted);
}

.forgot-link {
    font-size: 0.9rem;
    color: var(--accent);
    text-decoration: none;
    transition: color 0.2s ease;
}

.forgot-link:hover {
    color: #e879f9;
}

/* Submit button */
.btn-submit {
    width: 100%;
    padding: 1rem 2rem;
    margin-top: 0.5rem;
    background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
    border: none;
    border-radius: 12px;
    color: white;
    font-family: inherit;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.22, 1, 0.36, 1);
    box-shadow:
        0 4px 15px rgba(124, 58, 237, 0.4),
        0 0 0 1px rgba(255, 255, 255, 0.1) inset;
}

.btn-submit::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, var(--accent) 0%, var(--primary) 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.btn-submit:hover {
    transform: translateY(-2px);
    box-shadow:
        0 8px 25px rgba(124, 58, 237, 0.5),
        0 0 0 1px rgba(255, 255, 255, 0.15) inset;
}

.btn-submit:hover::before {
    opacity: 1;
}

.btn-submit:active {
    transform: translateY(0);
}

.btn-submit span {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.btn-submit svg {
    width: 18px;
    height: 18px;
    transition: transform 0.3s ease;
}

.btn-submit:hover svg {
    transform: translateX(3px);
}

/* Footer link */
.form-footer {
    text-align: center;
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
    animation: footerReveal 0.6s 0.5s cubic-bezier(0.22, 1, 0.36, 1) forwards;
    opacity: 0;
}

@keyframes footerReveal {
    to { opacity: 1; }
}

.form-footer p {
    color: var(--text-muted);
    font-size: 0.95rem;
}

.form-footer a {
    color: var(--accent);
    text-decoration: none;
    font-weight: 500;
    transition: all 0.2s ease;
    position: relative;
}

.form-footer a::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 100%;
    height: 1px;
    background: var(--accent);
    transform: scaleX(0);
    transform-origin: right;
    transition: transform 0.3s ease;
}

.form-footer a:hover {
    color: #e879f9;
}

.form-footer a:hover::after {
    transform: scaleX(1);
    transform-origin: left;
}

/* Staggered animation delays for inputs */
.input-group:nth-child(1) { animation: inputReveal 0.5s 0.4s cubic-bezier(0.22, 1, 0.36, 1) forwards; opacity: 0; }
.input-group:nth-child(2) { animation: inputReveal 0.5s 0.45s cubic-bezier(0.22, 1, 0.36, 1) forwards; opacity: 0; }
.input-group:nth-child(3) { animation: inputReveal 0.5s 0.5s cubic-bezier(0.22, 1, 0.36, 1) forwards; opacity: 0; }
.input-group:nth-child(4) { animation: inputReveal 0.5s 0.55s cubic-bezier(0.22, 1, 0.36, 1) forwards; opacity: 0; }
.input-group:nth-child(5) { animation: inputReveal 0.5s 0.6s cubic-bezier(0.22, 1, 0.36, 1) forwards; opacity: 0; }
.form-row { animation: inputReveal 0.5s 0.4s cubic-bezier(0.22, 1, 0.36, 1) forwards; opacity: 0; }
.checkbox-group { animation: inputReveal 0.5s 0.55s cubic-bezier(0.22, 1, 0.36, 1) forwards; opacity: 0; }
.btn-submit { animation: inputReveal 0.5s 0.65s cubic-bezier(0.22, 1, 0.36, 1) forwards; opacity: 0; }

@keyframes inputReveal {
    to {
        opacity: 1;
    }
}
