/* ═══════════════════════════════════════════════════════════════
   ALEX AI v3.8 — Premium Redesign Stylesheet
   Reference: Minimal Dashboard with Sidebar + Feature Cards
   ═══════════════════════════════════════════════════════════════ */

/* ---------- Google Inter Font ---------- */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

/* ---------- Design Tokens ---------- */
:root {
    --r-bg: #f8f9fb;
    --r-bg-card: #ffffff;
    --r-sidebar-bg: #ffffff;
    --r-sidebar-border: #ebeef2;
    --r-text-primary: #1a1d26;
    --r-text-secondary: #6b7280;
    --r-text-muted: #9ca3af;
    --r-accent: #3b5bdb;
    --r-accent-light: #eef2ff;
    --r-accent-hover: #364fc7;
    --r-border: #e5e7eb;
    --r-border-light: #f0f1f3;
    --r-card-shadow: 0 1px 3px rgba(0, 0, 0, 0.04), 0 1px 2px rgba(0, 0, 0, 0.06);
    --r-card-shadow-hover: 0 4px 12px rgba(0, 0, 0, 0.08);
    --r-sidebar-width: 260px;
    --r-header-height: 56px;
    --r-radius: 12px;
    --r-radius-sm: 8px;
    --r-radius-xs: 6px;
    --r-transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ---------- Redesigned Sidebar ---------- */
.r-sidebar {
    width: var(--r-sidebar-width);
    min-width: var(--r-sidebar-width);
    max-width: var(--r-sidebar-width);
    height: 100vh;
    background: var(--r-sidebar-bg);
    border-right: 1px solid var(--r-sidebar-border);
    display: flex;
    flex-direction: column;
    padding: 20px 16px;
    position: fixed;
    left: 0;
    top: 0;
    z-index: 50;
    overflow-y: auto;
    transition: transform 0.3s ease;
}

.r-sidebar::-webkit-scrollbar {
    width: 0;
}

.r-sidebar {
    scrollbar-width: none;
}

/* 사이드바 내부 모든 스크롤바 숨김 */
.r-sidebar *::-webkit-scrollbar {
    display: none;
    width: 0;
}

.r-sidebar * {
    scrollbar-width: none;
    -ms-overflow-style: none;
}

/* Sidebar Logo Block */
.r-sidebar-logo {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    padding-bottom: 0;
}

.r-sidebar-logo .logo-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.r-sidebar-logo .logo-icon {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.r-sidebar-logo .logo-icon .alex-logo {
    height: 28px;
    width: auto;
}

.r-sidebar-logo .logo-text {
    display: flex;
    flex-direction: column;
}

.r-sidebar-logo .logo-text .brand {
    font-size: 16px;
    font-weight: 800;
    color: var(--r-text-primary);
    font-family: 'Inter', sans-serif;
    letter-spacing: -0.02em;
    line-height: 1.2;
}

.r-sidebar-logo .logo-text .edition {
    font-size: 10px;
    font-weight: 500;
    color: var(--r-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.r-sidebar-logo .close-btn {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    border: none;
    background: transparent;
    color: var(--r-text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--r-transition);
}

.r-sidebar-logo .close-btn:hover {
    background: var(--r-border-light);
    color: var(--r-text-primary);
}

/* Membership Card */
.r-membership-card {
    background: var(--r-bg);
    border: 1px solid var(--r-border);
    border-radius: var(--r-radius);
    padding: 14px 16px;
    margin-bottom: 24px;
}

.r-membership-card .card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}

.r-membership-card .membership-label {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--r-accent);
}

.r-membership-card .status-badge {
    font-size: 10px;
    font-weight: 600;
    color: var(--r-text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.r-membership-card .points-value {
    font-size: 28px;
    font-weight: 800;
    color: var(--r-text-primary);
    font-family: 'Inter', sans-serif;
    line-height: 1;
    margin-bottom: 10px;
}

.r-membership-card .progress-bar {
    height: 4px;
    background: var(--r-border);
    border-radius: 2px;
    overflow: hidden;
    margin-bottom: 6px;
}

.r-membership-card .progress-fill {
    height: 100%;
    background: var(--r-accent);
    border-radius: 2px;
    transition: width 0.6s ease;
}

.r-membership-card .progress-label {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    color: var(--r-text-muted);
}

/* Sidebar Section Labels */
.r-section-label {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--r-text-muted);
    padding: 0 8px;
    margin-bottom: 6px;
    margin-top: 4px;
}

/* Collapsible Section Headers */
.r-collapsible-header {
    padding: 6px 8px;
    border-radius: var(--r-radius-xs);
    transition: var(--r-transition);
}

.r-collapsible-header:hover {
    background: var(--r-bg);
    color: var(--r-text-secondary);
}

.r-collapse-arrow {
    opacity: 0.5;
    transition: transform 0.2s ease, opacity 0.15s ease;
}

.r-collapsible-header:hover .r-collapse-arrow {
    opacity: 0.8;
}

/* Menu Group Separator */
.r-menu-group+.r-menu-group {
    margin-top: 4px;
    padding-top: 4px;
    border-top: 1px solid var(--r-border-light);
}

/* Sidebar Navigation Items */
.r-nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: var(--r-radius-xs);
    color: var(--r-text-secondary);
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    transition: var(--r-transition);
    cursor: pointer;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
}

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

.r-nav-item.active {
    background: var(--r-accent-light);
    color: var(--r-accent);
}

.r-nav-item .nav-icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    opacity: 0.7;
}

.r-nav-item:hover .nav-icon,
.r-nav-item.active .nav-icon {
    opacity: 1;
}

.r-nav-item .nav-arrow {
    margin-left: auto;
    width: 14px;
    height: 14px;
    opacity: 0;
    transition: opacity 0.15s ease;
}

.r-nav-item:hover .nav-arrow {
    opacity: 0.5;
}

/* Sidebar Spacer */
.r-sidebar-spacer {
    flex: 1;
}

/* ---------- Redesigned Header ---------- */
.r-header {
    height: var(--r-header-height);
    background: var(--r-bg-card);
    border-bottom: 1px solid var(--r-border-light);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    position: sticky;
    top: 0;
    z-index: 30;
}

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

.r-header-info {
    display: flex;
    align-items: center;
    gap: 14px;
    font-size: 13px;
    color: var(--r-text-muted);
}

.r-header-info .info-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #22c55e;
}

.r-header-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

.r-header-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    border-radius: var(--r-radius-xs);
    border: none;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: var(--r-transition);
    font-family: 'Inter', 'Pretendard', sans-serif;
}

.r-header-btn.primary {
    background: var(--r-text-primary);
    color: white;
}

.r-header-btn.primary:hover {
    background: #2d3039;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.r-header-btn.ghost {
    background: transparent;
    color: var(--r-text-secondary);
}

.r-header-btn.ghost:hover {
    background: var(--r-bg);
}

.r-notification-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1px solid var(--r-border);
    background: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--r-transition);
    position: relative;
}

.r-notification-btn:hover {
    background: var(--r-bg);
    border-color: var(--r-text-muted);
}

/* ---------- Dashboard Welcome Section ---------- */
.r-dashboard {
    flex: 1;
    overflow-y: auto;
    background: var(--r-bg);
    display: flex;
    flex-direction: column;
}

.r-dashboard::-webkit-scrollbar {
    width: 0;
}

.r-dashboard {
    scrollbar-width: none;
}

.r-welcome-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 24px;
    min-height: 0;
}

.r-welcome-title {
    font-size: 36px;
    font-weight: 300;
    color: var(--r-text-primary);
    text-align: center;
    margin-bottom: 12px;
    font-family: 'Inter', 'Pretendard', sans-serif;
    letter-spacing: -0.02em;
}

.r-welcome-title .user-name {
    font-style: italic;
    font-weight: 700;
}

.r-welcome-subtitle {
    font-size: 14px;
    color: var(--r-text-muted);
    text-align: center;
    line-height: 1.6;
    max-width: 500px;
    margin-bottom: 40px;
}

/* ---------- Feature Cards ---------- */
.r-feature-cards {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    max-width: 720px;
    width: 100%;
    margin-bottom: 40px;
}

.r-feature-card {
    background: var(--r-bg-card);
    border: 1px solid var(--r-border);
    border-radius: var(--r-radius);
    padding: 24px 20px;
    text-align: center;
    cursor: pointer;
    transition: var(--r-transition);
    text-decoration: none;
    display: block;
}

.r-feature-card:hover {
    border-color: var(--r-accent);
    box-shadow: var(--r-card-shadow-hover);
    transform: translateY(-2px);
}

.r-feature-card .card-icon {
    width: 36px;
    height: 36px;
    margin: 0 auto 14px;
    color: var(--r-text-secondary);
    opacity: 0.6;
}

.r-feature-card:hover .card-icon {
    color: var(--r-accent);
    opacity: 1;
}

.r-feature-card .card-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--r-text-primary);
    margin-bottom: 4px;
    font-family: 'Inter', 'Pretendard', sans-serif;
}

.r-feature-card .card-desc {
    font-size: 11px;
    color: var(--r-text-muted);
    line-height: 1.4;
}

/* ---------- Inline Chat Input ---------- */
.r-chat-section {
    padding: 0 24px 20px;
    max-width: 720px;
    width: 100%;
    margin: 0 auto;
}

.r-chat-mode {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    padding-left: 4px;
}

.r-chat-mode .mode-label {
    font-size: 11px;
    color: var(--r-text-muted);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.r-chat-mode .mode-value {
    font-size: 11px;
    color: var(--r-accent);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.r-chat-input-wrap {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--r-bg-card);
    border: 1px solid var(--r-border);
    border-radius: 14px;
    padding: 6px 6px 6px 16px;
    transition: var(--r-transition);
}

.r-chat-input-wrap:focus-within {
    border-color: var(--r-accent);
    box-shadow: 0 0 0 3px rgba(59, 91, 219, 0.08);
}

.r-chat-plus-btn {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 1px solid var(--r-border);
    background: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    color: var(--r-text-muted);
    transition: var(--r-transition);
}

.r-chat-plus-btn:hover {
    border-color: var(--r-accent);
    color: var(--r-accent);
}

.r-chat-input {
    flex: 1;
    border: none;
    outline: none;
    font-size: 13px;
    color: var(--r-text-primary);
    background: transparent;
    font-family: 'Pretendard', 'Inter', sans-serif;
    padding: 8px 0;
}

.r-chat-input::placeholder {
    color: var(--r-text-muted);
    font-weight: 400;
}

.r-chat-send-btn {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    border: none;
    background: var(--r-bg);
    color: var(--r-text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    transition: var(--r-transition);
}

.r-chat-send-btn:hover {
    background: var(--r-accent);
    color: white;
}

/* Bottom Search Tabs */
.r-search-tabs {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 24px;
    padding: 14px 0 8px;
}

.r-search-tab {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--r-text-muted);
    cursor: pointer;
    transition: var(--r-transition);
    border: none;
    background: none;
    padding: 4px 8px;
    border-radius: var(--r-radius-xs);
}

.r-search-tab:hover,
.r-search-tab.active {
    color: var(--r-text-primary);
}

.r-search-tab svg {
    width: 14px;
    height: 14px;
}

/* ---------- Main Content Wrapper ---------- */
.r-main-wrap {
    margin-left: var(--r-sidebar-width);
    display: flex;
    flex-direction: column;
    height: 100vh;
    background: var(--r-bg);
}

/* ---------- Responsive ---------- */
@media (max-width: 768px) {
    .r-sidebar {
        transform: translateX(-100%);
    }

    .r-sidebar.open {
        transform: translateX(0);
        box-shadow: 4px 0 24px rgba(0, 0, 0, 0.12);
    }

    .r-main-wrap {
        margin-left: 0;
    }

    .r-feature-cards {
        grid-template-columns: 1fr;
        max-width: 400px;
    }

    .r-welcome-title {
        font-size: 24px;
    }

    .r-header-info {
        display: none;
    }
}

@media (min-width: 769px) and (max-width: 1024px) {
    .r-feature-cards {
        grid-template-columns: repeat(2, 1fr);
        max-width: 500px;
    }
}

/* ---------- Animations ---------- */
@keyframes r-fadeInUp {
    from {
        opacity: 0;
        transform: translateY(16px);
    }

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

.r-animate-in {
    animation: r-fadeInUp 0.5s ease forwards;
}

.r-animate-in:nth-child(1) {
    animation-delay: 0.05s;
}

.r-animate-in:nth-child(2) {
    animation-delay: 0.10s;
}

.r-animate-in:nth-child(3) {
    animation-delay: 0.15s;
}

/* ---------- Mobile Menu Toggle ---------- */
.r-mobile-menu-btn {
    display: none;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    border: 1px solid var(--r-border);
    background: white;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

@media (max-width: 768px) {
    .r-mobile-menu-btn {
        display: flex;
    }
}

/* Mobile sidebar overlay */
.r-sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.3);
    z-index: 45;
}

.r-sidebar-overlay.active {
    display: block;
}