/**
 * Bebond Account - Material 3 Design System
 * Complete redesign with navigation rail, dark mode, and theme customization
 */

:root {
    /* Brand Colors */
    --brand-primary: #62369D;
    --brand-secondary: #8b5fd6;

    /* Light Mode */
    --bg-primary: #ffffff;
    --bg-secondary: #f5f5f5;
    --bg-tertiary: #fafafa;
    --surface: #ffffff;
    --surface-variant: #e7e0ec;

    --text-primary: #1c1b1f;
    --text-secondary: #49454f;
    --text-tertiary: #79747e;

    --border: #cac4d0;
    --divider: #e7e0ec;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.07);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1);

    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg-primary: #1c1b1f;
        --bg-secondary: #121212;
        --bg-tertiary: #2a2a2a;
        --surface: #1c1b1f;
        --surface-variant: #49454f;

        --text-primary: #e6e1e5;
        --text-secondary: #cac4d0;
        --text-tertiary: #938f99;

        --border: #49454f;
        --divider: #49454f;

        --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
        --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.4);
        --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.5);
    }
}

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

body {
    font-family: 'Roboto', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg-secondary);
    color: var(--text-primary);
    line-height: 1.6;
    transition: background-color 0.3s, color 0.3s;
}

.hidden {
    display: none !important;
}

/* Auth Page */
.auth-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.auth-card {
    background: var(--surface);
    padding: 48px 40px;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    max-width: 440px;
    width: 100%;
    text-align: center;
}

.auth-logo {
    margin-bottom: 24px;
}

.logo-img {
    width: 80px;
    height: 80px;
    border-radius: var(--radius-md);
}

.auth-title {
    font-size: 28px;
    font-weight: 600;
    margin-bottom: 8px;
}

.auth-subtitle {
    color: var(--text-secondary);
    margin-bottom: 32px;
}

.auth-button {
    width: 100%;
    padding: 16px 24px;
    border: none;
    border-radius: var(--radius-md);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.auth-button.primary {
    background: var(--brand-primary);
    color: white;
}

.auth-button.primary:hover {
    background: var(--brand-secondary);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(98, 54, 157, 0.3);
}

.auth-message {
    margin-top: 16px;
    padding: 12px;
    border-radius: var(--radius-sm);
    font-size: 14px;
}

.auth-message.success {
    background: #d4edda;
    color: #155724;
}

.auth-message.error {
    background: #f8d7da;
    color: #721c24;
}

/* App Layout */
#app {
    display: flex;
    min-height: 100vh;
}

/* Navigation Rail */
.nav-rail {
    width: 80px;
    background: var(--surface);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 16px 0;
    position: fixed;
    height: 100vh;
    z-index: 100;
}

.nav-rail-header {
    margin-bottom: 24px;
}

.nav-logo {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
}

.nav-rail-items {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
}

.nav-rail-footer {
    width: 100%;
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 12px 8px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: var(--radius-md);
    transition: all 0.2s;
    width: 100%;
}

.nav-item:hover {
    background: var(--surface-variant);
    color: var(--text-primary);
}

.nav-item.active {
    background: var(--brand-primary);
    color: white;
}

.nav-item .material-symbols-outlined {
    font-size: 24px;
}

.nav-label {
    font-size: 11px;
    font-weight: 500;
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: 80px;
    padding: 24px;
    max-width: 1200px;
}

/* Header */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 32px;
}

.app-header h1 {
    font-size: 32px;
    font-weight: 600;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 16px;
}

.icon-button {
    width: 40px;
    height: 40px;
    border: none;
    background: transparent;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    transition: all 0.2s;
}

.icon-button:hover {
    background: var(--surface-variant);
    color: var(--text-primary);
}

.user-chip {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 12px 4px 4px;
    background: var(--surface-variant);
    border-radius: 24px;
}

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

/* Views */
.view {
    display: none;
}

.view.active {
    display: block;
}

/* Cards */
.card {
    background: var(--surface);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow-sm);
    margin-bottom: 24px;
}

.card h2 {
    font-size: 24px;
    margin-bottom: 16px;
}

.card h3 {
    font-size: 18px;
    margin-bottom: 12px;
}

/* Dashboard */
.welcome-card {
    background: linear-gradient(135deg, var(--brand-primary), var(--brand-secondary));
    color: white;
}

.welcome-card h2 {
    font-size: 28px;
}

.welcome-card p {
    opacity: 0.9;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    display: flex;
    align-items: center;
    gap: 16px;
}

.stat-icon {
    font-size: 40px;
    color: var(--brand-primary);
}

.stat-value {
    font-size: 32px;
    font-weight: 600;
    line-height: 1;
}

.stat-label {
    font-size: 14px;
    color: var(--text-secondary);
}

/* Profile */
.profile-grid {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 32px;
}

.avatar-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

.avatar-large {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    object-fit: cover;
    border: 4px solid var(--border);
}

.profile-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

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

.input {
    padding: 12px 16px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 15px;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    transition: border-color 0.2s;
}

.input:focus {
    outline: none;
    border-color: var(--brand-primary);
}

.input:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.textarea {
    min-height: 100px;
    resize: vertical;
    font-family: inherit;
}

.input-hint {
    font-size: 12px;
    color: var(--text-tertiary);
}

.color-picker-wrapper {
    display: flex;
    align-items: center;
    gap: 12px;
}

#themeColor {
    width: 60px;
    height: 40px;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
}

/* Buttons */
.button {
    padding: 12px 24px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.button.primary {
    background: var(--brand-primary);
    color: white;
}

.button.primary:hover {
    background: var(--brand-secondary);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.button.secondary {
    background: transparent;
    color: var(--brand-primary);
    border: 1.5px solid var(--brand-primary);
}

.button.secondary:hover {
    background: var(--surface-variant);
}

/* Activity */
.view-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.activity-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.activity-item {
    padding: 16px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-sm);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Settings */
.settings-section {
    margin-bottom: 32px;
}

.settings-section h3 {
    margin-bottom: 16px;
    font-size: 18px;
}

.setting-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 0;
    border-bottom: 1px solid var(--divider);
}

.setting-label {
    font-weight: 500;
}

.setting-description {
    font-size: 14px;
    color: var(--text-secondary);
}

.toggle {
    position: relative;
    display: inline-block;
    width: 48px;
    height: 24px;
}

.toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--border);
    transition: 0.3s;
    border-radius: 24px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: 0.3s;
    border-radius: 50%;
}

.toggle input:checked+.toggle-slider {
    background-color: var(--brand-primary);
}

.toggle input:checked+.toggle-slider:before {
    transform: translateX(24px);
}

/* Utilities */
.text-secondary {
    color: var(--text-secondary);
}

.loading {
    text-align: center;
    padding: 32px;
    color: var(--text-secondary);
}

/* Responsive */
@media (max-width: 768px) {
    .nav-rail {
        width: 60px;
    }

    .main-content {
        margin-left: 60px;
        padding: 16px;
    }

    .nav-label {
        display: none;
    }

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

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