/* === Reset & Base === */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --bg-page: #E8E0F0;
    --bg-card: #FFFFFF;
    --accent: #6C5CE7;
    --accent-dark: #5A4BD1;
    --text-primary: #2D3436;
    --text-secondary: #636E72;
    --text-muted: #999;
    --border: #E0D8EC;
    --error: #D63031;
    --success: #00B894;
    --button-radius: 10px;
    --card-radius: 20px;
    --card-shadow: 0 2px 16px rgba(0, 0, 0, 0.08);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-page);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.5;
}

/* === Flash Messages === */
.flash-messages {
    position: fixed;
    top: 16px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
    width: 90%;
    max-width: 500px;
}

.flash {
    padding: 12px 40px 12px 20px;
    border-radius: 8px;
    margin-bottom: 8px;
    font-size: 14px;
    text-align: center;
    position: relative;
    animation: flashIn 0.3s ease, flashOut 0.4s ease 4s forwards;
}

.flash-dismiss {
    position: absolute;
    top: 50%;
    right: 10px;
    transform: translateY(-50%);
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    color: inherit;
    opacity: 0.6;
    padding: 0 4px;
    line-height: 1;
}

.flash-dismiss:hover {
    opacity: 1;
}

.flash-error { background: #FFEAEA; color: var(--error); }
.flash-success { background: #E6FFF8; color: #00886A; }

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

@keyframes flashOut {
    from { opacity: 1; }
    to { opacity: 0; pointer-events: none; }
}

/* === Card === */
.card {
    background: var(--bg-card);
    border-radius: var(--card-radius);
    box-shadow: var(--card-shadow);
    padding: 40px 32px;
    width: 100%;
    max-width: 560px;
}

/* === Login === */
.login-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
}

.login-card {
    text-align: center;
}

.login-card h1 {
    font-size: 24px;
    margin-bottom: 4px;
}

.login-subtitle {
    color: var(--text-secondary);
    margin-bottom: 28px;
    font-size: 15px;
}

.role-selector {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
}

.role-option {
    flex: 1;
    cursor: pointer;
}

.role-option input { display: none; }

.role-label {
    display: block;
    padding: 10px 16px;
    border: 2px solid var(--border);
    border-radius: 8px;
    text-align: center;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.2s;
    color: var(--text-secondary);
}

.role-option input:checked + .role-label {
    border-color: var(--accent);
    background: var(--accent);
    color: white;
}

.form-group {
    margin-bottom: 16px;
}

.form-group input[type="password"],
.form-group input[type="text"],
.form-group input[type="url"],
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--border);
    border-radius: 8px;
    font-size: 15px;
    outline: none;
    transition: border-color 0.2s;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    border-color: var(--accent);
}

/* === Buttons === */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
}

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

.btn-primary:hover {
    background: var(--accent-dark);
}

.btn-full { width: 100%; }

.btn-sm {
    padding: 6px 14px;
    font-size: 13px;
}

.btn-outline {
    background: transparent;
    border: 2px solid var(--border);
    color: var(--text-secondary);
}

.btn-outline:hover {
    border-color: var(--accent);
    color: var(--accent);
}

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

.btn-danger:hover {
    background: #C0392B;
}

/* === Main Page === */
.page-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 100vh;
    padding: 40px 20px;
}

.main-card {
    text-align: center;
}

.avatar-wrapper {
    display: flex;
    justify-content: center;
    margin-bottom: 16px;
}

.avatar {
    width: 88px;
    height: 88px;
    border-radius: 50%;
    object-fit: cover;
}

.avatar-placeholder {
    background: var(--text-primary);
}

.page-title {
    font-size: 22px;
    font-weight: 600;
    margin-bottom: 8px;
}

.divider {
    border: none;
    border-top: 1px solid var(--border);
    margin: 24px 0;
}

.section-title {
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

.link-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 8px;
}

.link-button {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 14px 24px;
    border-radius: var(--button-radius);
    text-decoration: none;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    transition: transform 0.15s, box-shadow 0.15s;
}

.link-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.link-icon {
    font-size: 18px;
}

.footer-text {
    margin-top: 28px;
    font-size: 13px;
    color: var(--text-muted);
    line-height: 1.6;
    white-space: pre-line;
}

.footer-text a {
    color: var(--accent);
}

/* === FAB (admin edit button) === */
.fab {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 52px;
    height: 52px;
    background: var(--accent);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    text-decoration: none;
    box-shadow: 0 4px 12px rgba(108, 92, 231, 0.4);
    transition: transform 0.2s, box-shadow 0.2s;
}

.fab:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(108, 92, 231, 0.5);
}

/* === Logout === */
.logout-wrapper {
    margin-top: 20px;
}

.logout-link {
    color: var(--text-muted);
    font-size: 13px;
    text-decoration: none;
    background: none;
    border: none;
    cursor: pointer;
    font-family: inherit;
}

.logout-link:hover {
    color: var(--accent);
}

/* === Dark Mode === */
@media (prefers-color-scheme: dark) {
    :root {
        --bg-page: #1E1A2E;
        --bg-card: #2A2540;
        --accent: #8B7CF7;
        --accent-dark: #7A6AE6;
        --text-primary: #EDEAF2;
        --text-secondary: #A9A2B8;
        --text-muted: #7A7490;
        --border: #3D3654;
        --error: #FF6B6B;
        --success: #4CD9A0;
        --card-shadow: 0 2px 16px rgba(0, 0, 0, 0.25);
    }

    .flash-error { background: #3D1F1F; color: #FF8A8A; }
    .flash-success { background: #1A3D2E; color: #6EEAB0; }

    .form-group input[type="password"],
    .form-group input[type="text"],
    .form-group input[type="url"],
    .form-group textarea,
    .form-group select {
        background: #342F4A;
        color: var(--text-primary);
    }

    .avatar-placeholder {
        background: #4A4460;
    }
}

/* === Responsive === */
@media (max-width: 600px) {
    .card {
        padding: 28px 20px;
        border-radius: 16px;
    }

    .page-wrapper {
        padding: 20px 12px;
    }
}
