/* Import parent styles variables */
:root {
    --bg-primary: #0a0e1a;
    --bg-secondary: #141824;
    --bg-tertiary: #1a1f2e;
    --text-primary: #e8f0fe;
    --text-secondary: #b8c8e0;
    --accent-primary: #6bb6ff;
    --accent-secondary: #4a9eff;
    --border-color: #2a3342;
    --error-color: #ff6b6b;
    --success-color: #4caf50;
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

/* Account Wrapper */
.account-wrapper {
    width: 100%;
    max-width: 650px;
    position: relative;
}

.account-wrapper::before {
    content: '';
    position: fixed;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle at center, rgba(107, 182, 255, 0.03) 0%, transparent 50%);
    animation: pulse 10s ease-in-out infinite;
    pointer-events: none;
    z-index: 0;
}

@keyframes pulse {

    0%,
    100% {
        transform: scale(1);
        opacity: 0.5;
    }

    50% {
        transform: scale(1.2);
        opacity: 0.8;
    }
}

/* Account Container */
.account-container {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 2.5rem;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4),
        0 0 100px rgba(107, 182, 255, 0.05);
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 400px;
    /* Default compact width for Login */
}

.account-container--wide {
    max-width: 1200px;
    /* Expanded width for Profile/Register */
    margin: 0 auto;
}

/* Account Header */
.account-header {
    text-align: center;
    margin-bottom: 2rem;
}

.account-logo {
    height: 50px;
    width: auto;
    margin-bottom: 1rem;
    filter: drop-shadow(0 0 12px rgba(107, 182, 255, 0.4));
}

.account-header h1 {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 0.4rem;
    background: linear-gradient(135deg, #fff 0%, var(--accent-primary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.account-subtitle {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

/* Forms */
.account-form {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

/* 3-column layout for very wide screens */
@media (min-width: 1000px) {
    .account-container--wide .form-row {
        grid-template-columns: 1fr 1fr 1fr;
    }

    .account-container--wide .form-row:has(.form-group:only-child) {
        grid-template-columns: 1fr;
    }
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.form-group label {
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 0.9rem;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 0.875rem 1rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 1rem;
    transition: all 0.3s ease;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(107, 182, 255, 0.1);
}

.form-group input:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.form-group small {
    color: var(--text-secondary);
    font-size: 0.8rem;
    margin-top: -0.25rem;
}

/* Checkbox */
.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
    user-select: none;
}

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

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

/* Form Options */
.form-options {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: -0.5rem;
}

/* Buttons */
.btn-primary,
.btn-secondary,
.btn-danger {
    padding: 0.875rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-family: inherit;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
    width: 100%;
    /* Full width to match fields */
    max-width: 100%;
    /* Remove the 280px restriction */
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent-primary) 0%, var(--accent-secondary) 100%);
    color: #fff;
    box-shadow: 0 4px 15px rgba(107, 182, 255, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(107, 182, 255, 0.4);
}

.btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

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

.btn-danger {
    background: rgba(255, 107, 107, 0.1);
    color: var(--error-color);
    border: 1px solid var(--error-color);
}

.btn-danger:hover {
    background: rgba(255, 107, 107, 0.2);
}

/* Links */
.link-primary {
    color: var(--accent-primary);
    text-decoration: none;
    font-weight: 500;
    transition: all 0.2s ease;
}

.link-primary:hover {
    color: var(--accent-secondary);
    text-shadow: 0 0 10px rgba(107, 182, 255, 0.4);
}

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

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

/* Form Messages */
.form-message {
    padding: 1rem;
    border-radius: 8px;
    text-align: center;
    font-weight: 500;
    display: none;
}

.form-message.success {
    display: block;
    background: rgba(76, 175, 80, 0.1);
    border: 1px solid rgba(76, 175, 80, 0.3);
    color: var(--success-color);
}

.form-message.error {
    display: block;
    background: rgba(255, 107, 107, 0.1);
    border: 1px solid rgba(255, 107, 107, 0.3);
    color: var(--error-color);
}

/* Account Footer */
.account-footer {
    margin-top: 2rem;
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.account-footer p {
    margin-bottom: 0.75rem;
}

/* Profile Sections */
.profile-info {
    background: linear-gradient(135deg, rgba(107, 182, 255, 0.1) 0%, rgba(74, 158, 255, 0.05) 100%);
    border: 1px solid rgba(107, 182, 255, 0.2);
    border-radius: 12px;
    padding: 1.25rem;
    margin-bottom: 1.75rem;
    text-align: center;
}

.profile-welcome {
    font-size: 1.4rem;
    font-weight: 600;
    color: var(--accent-primary);
    margin-bottom: 0.4rem;
}

.profile-sections {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 1.5rem;
    width: 100%;
}

/* Wider screens: 2-column layout for some sections */
@media (min-width: 900px) {
    .profile-sections {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .profile-section:first-child {
        grid-column: 1 / -1;
    }

    .profile-section:nth-child(4) {
        grid-column: 1 / -1;
    }
}

.profile-section {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.75rem;
    width: 100%;
    box-sizing: border-box;
    overflow: hidden;
    /* Prevent content from spilling out */
}

.profile-section h2 {
    font-size: 1.15rem;
    margin-bottom: 1.25rem;
    color: var(--text-primary);
    padding-bottom: 0.65rem;
    border-bottom: 1px solid var(--border-color);
}

.profile-section .account-form {
    width: 100%;
}

.profile-section .form-row {
    gap: 1.25rem;
}

/* ... existing styles ... */

.profile-section button {
    margin-top: 1rem;
    width: 100%;
    /* Full width to match inputs */
    max-width: none;
    /* Remove restriction */
    display: block;
}

/* Status Grid */
.status-grid {
    display: grid;
    grid-template-columns: 1fr;
    /* Stack by default */
    gap: 1rem;
}

@media (min-width: 600px) {
    .status-grid {
        grid-template-columns: repeat(2, 1fr);
        /* 2 columns on wider screens */
    }

    /* Make Privileges span full width to prevent overflow */
    .status-item:last-child {
        grid-column: 1 / -1;
    }
}

.status-item {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    overflow-wrap: break-word;
    /* Prevent text overflow */
}

/* ... existing styles ... */

/* Specific fix for Change Password form to stack inputs */
#passwordForm .form-row {
    grid-template-columns: 1fr;
    /* Stack inputs vertically */
}

/* Ensure Account Details form uses 2 columns but stacks on mobile */
#profileForm .form-row {
    grid-template-columns: 1fr;
}

@media (min-width: 768px) {
    #profileForm .form-row {
        grid-template-columns: 1fr 1fr;
    }
}

.status-label {
    color: var(--text-secondary);
    font-size: 0.8rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.status-value {
    color: var(--text-primary);
    font-size: 1rem;
    font-weight: 600;
}

/* Admin Controls */
.admin-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    width: 100%;
}

.admin-controls button {
    flex: 1 1 calc(33.333% - 1rem);
    min-width: 180px;
    max-width: none;
}

/* Account Footer */
.account-footer {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.95rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.account-footer p {
    margin-bottom: 0.65rem;
}

.account-footer button {
    margin: 0 auto;
}

/* Responsive */
@media (max-width: 768px) {
    body {
        padding: 1rem;
    }

    .account-container {
        padding: 2rem;
    }

    .account-container--wide {
        padding: 2rem 1.5rem;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .status-grid {
        grid-template-columns: 1fr;
    }

    .form-options {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }

    .account-header h1 {
        font-size: 1.5rem;
    }
}

@media (max-width: 480px) {
    .account-logo {
        height: 48px;
    }

    .admin-controls {
        flex-direction: column;
    }

    .admin-controls button {
        width: 100%;
    }
}