/* ==================== DESIGN SYSTEM & VARIABLES ==================== */
:root {
    --bg-main: #0b0f19;
    --bg-card: rgba(17, 24, 39, 0.7);
    --bg-card-hover: rgba(31, 41, 55, 0.85);
    --border-color: rgba(255, 255, 255, 0.08);
    
    --primary: #4f46e5;
    --primary-hover: #4338ca;
    --accent: #2563eb;
    
    --buy-color: #10b981;
    --buy-hover: #059669;
    --buy-glow: rgba(16, 185, 129, 0.15);
    
    --sell-color: #f59e0b;
    --sell-hover: #d97706;
    --sell-glow: rgba(245, 158, 11, 0.15);
    
    --text-main: #f3f4f6;
    --text-muted: #9ca3af;
    --text-dark: #6b7280;
    
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-glow: 0 0 20px rgba(79, 70, 229, 0.15);
    
    --font-outfit: 'Outfit', 'Noto Sans KR', sans-serif;
    --transition-fast: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-normal: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ==================== GLOBAL STYLES ==================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: var(--bg-main);
    background-image: 
        radial-gradient(circle at 10% 20%, rgba(79, 70, 229, 0.08) 0%, transparent 40%),
        radial-gradient(circle at 90% 80%, rgba(37, 99, 235, 0.08) 0%, transparent 40%);
    background-attachment: fixed;
    color: var(--text-main);
    font-family: var(--font-outfit);
    min-height: 100vh;
    line-height: 1.6;
    overflow-x: hidden;
}

/* ==================== GLASSMORPHISM CORE ==================== */
.glass {
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    box-shadow: var(--shadow-lg);
}

.hidden {
    display: none !important;
}

a {
    color: #818cf8;
    text-decoration: none;
    transition: var(--transition-fast);
}

a:hover {
    color: #a5b4fc;
    text-decoration: underline;
}

/* ==================== BUTTONS ==================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 24px;
    border-radius: 10px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-fast);
    border: none;
    gap: 8px;
}

.btn-block {
    display: flex;
    width: 100%;
}

.btn-primary {
    background-color: var(--primary);
    color: white;
}
.btn-primary:hover {
    background-color: var(--primary-hover);
    box-shadow: 0 0 12px rgba(79, 70, 229, 0.4);
}

.btn-accent {
    background-color: var(--accent);
    color: white;
}
.btn-accent:hover {
    background-color: #1d4ed8;
    box-shadow: 0 0 12px rgba(37, 99, 235, 0.4);
}

.btn-buy {
    background-color: var(--buy-color);
    color: white;
}
.btn-buy:hover {
    background-color: var(--buy-hover);
    box-shadow: 0 0 12px rgba(16, 185, 129, 0.4);
}

.btn-sell {
    background-color: var(--sell-color);
    color: white;
}
.btn-sell:hover {
    background-color: var(--sell-hover);
    box-shadow: 0 0 12px rgba(245, 158, 11, 0.4);
}

.btn-outline {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: var(--text-main);
}
.btn-outline:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.25);
}

.btn-xs {
    padding: 6px 12px;
    font-size: 0.8rem;
    border-radius: 6px;
}

/* ==================== TOAST NOTIFICATIONS ==================== */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    background: rgba(17, 24, 39, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: white;
    padding: 14px 20px;
    border-radius: 10px;
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 300px;
    max-width: 450px;
    backdrop-filter: blur(8px);
    animation: slideIn 0.3s ease forwards;
}

.toast-success {
    border-left: 4px solid var(--buy-color);
}
.toast-error {
    border-left: 4px solid #ef4444;
}
.toast-info {
    border-left: 4px solid var(--accent);
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* ==================== AUTH VIEW ==================== */
.auth-view {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
}

.auth-card {
    width: 100%;
    max-width: 460px;
    padding: 40px;
}

.auth-header {
    text-align: center;
    margin-bottom: 30px;
}

.logo {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-size: 1.8rem;
    font-weight: 800;
    letter-spacing: -0.5px;
    color: var(--text-main);
}

.logo-icon {
    background: linear-gradient(135deg, #818cf8 0%, #2563eb 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

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

.auth-subtitle {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-top: 8px;
}

.auth-form h2 {
    font-size: 1.4rem;
    font-weight: 700;
    margin-bottom: 20px;
    text-align: center;
}

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

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

.form-group input {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 12px;
    font-size: 0.95rem;
    color: white;
    font-family: var(--font-outfit);
    transition: var(--transition-fast);
}

.form-group input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.input-unit {
    position: relative;
    display: flex;
    align-items: center;
}

.input-unit input {
    width: 100%;
    padding-right: 60px;
}

.input-unit .unit {
    position: absolute;
    right: 15px;
    color: var(--text-muted);
    font-size: 0.9rem;
    font-weight: 600;
}

.form-hint {
    font-size: 0.78rem;
    color: var(--text-dark);
    margin-top: 4px;
}

.auth-toggle-text {
    text-align: center;
    font-size: 0.88rem;
    color: var(--text-muted);
    margin-top: 20px;
}

/* ==================== MAIN APPLICATION LAYOUT ==================== */
.main-view {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* NAVBAR */
.navbar {
    position: sticky;
    top: 0;
    z-index: 100;
    border-radius: 0;
    border-bottom: 1px solid var(--border-color);
    border-top: none;
    border-left: none;
    border-right: none;
    margin-bottom: 30px;
}

.navbar-container {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
}

.nav-links {
    display: flex;
    gap: 10px;
}

.nav-link {
    color: var(--text-muted);
    padding: 10px 16px;
    border-radius: 8px;
    font-weight: 500;
    font-size: 0.92rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.nav-link:hover {
    color: white;
    background: rgba(255, 255, 255, 0.04);
    text-decoration: none;
}

.nav-link.active {
    color: white;
    background: rgba(79, 70, 229, 0.15);
    border: 1px solid rgba(79, 70, 229, 0.3);
}

.nav-user-info {
    display: flex;
    align-items: center;
    gap: 15px;
}

.user-badge {
    font-size: 0.88rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.badge {
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 700;
}

.badge-pending {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-muted);
}

.badge-success {
    background: rgba(16, 185, 129, 0.2);
    color: var(--buy-color);
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.btn-logout {
    background: transparent;
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #ef4444;
    padding: 8px 14px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.85rem;
    transition: var(--transition-fast);
}

.btn-logout:hover {
    background: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.5);
}

/* CONTENT CONTAINER */
.content-container {
    flex: 1;
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
    padding: 0 20px 40px 20px;
}

.panel-header {
    margin-bottom: 30px;
}

.panel-header h1 {
    font-size: 1.8rem;
    font-weight: 800;
    margin-bottom: 6px;
}

.panel-header p {
    color: var(--text-muted);
    font-size: 1rem;
}

/* ==================== TAB PANELS ==================== */
.tab-panel {
    display: none;
    animation: fadeIn 0.4s ease forwards;
}

.tab-panel.active {
    display: block;
}

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

/* ==================== MARKET TAB (GRID) ==================== */
.market-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 25px;
}

.market-col {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.col-title {
    padding: 14px 20px;
    border-radius: 12px;
    display: flex;
    align-items: center;
}

.col-title h2 {
    font-size: 1.15rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 10px;
    color: white;
}

.bg-buy {
    background: linear-gradient(135deg, #064e3b 0%, #022c22 100%);
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.bg-sell {
    background: linear-gradient(135deg, #78350f 0%, #451a03 100%);
    border: 1px solid rgba(245, 158, 11, 0.2);
}

.listings-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
    max-height: 70vh;
    overflow-y: auto;
    padding-right: 5px;
}

.empty-state {
    text-align: center;
    padding: 40px 20px;
    border-radius: 12px;
    border: 1px dashed var(--border-color);
    color: var(--text-muted);
}

/* LISTING CARDS */
.listing-card {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 15px;
    transition: var(--transition-normal);
}

.listing-card:hover {
    background: var(--bg-card-hover);
    transform: translateY(-2px);
}

.card-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.user-info {
    display: flex;
    flex-direction: column;
}

.user-name {
    font-weight: 600;
    font-size: 1rem;
}

.listing-time {
    font-size: 0.75rem;
    color: var(--text-dark);
    margin-top: 2px;
}

.card-metrics {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    padding: 12px;
    background: rgba(0, 0, 0, 0.25);
    border-radius: 8px;
}

.metric-box {
    display: flex;
    flex-direction: column;
}

.metric-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 2px;
}

.metric-value {
    font-weight: 700;
    font-size: 1.1rem;
}

.card-bottom {
    display: flex;
    flex-direction: column;
    gap: 12px;
    border-top: 1px solid var(--border-color);
    padding-top: 12px;
}

.price-row {
    display: flex;
    justify-content: space-between;
    font-size: 0.9rem;
}

.price-row.total-price {
    font-size: 1.1rem;
    font-weight: 700;
}

.font-buy {
    color: var(--buy-color) !important;
}

.font-sell {
    color: var(--sell-color) !important;
}

.account-info-box {
    padding: 10px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 6px;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.account-info-box strong {
    color: var(--text-main);
}

/* ==================== CREATE TAB ==================== */
.create-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
}

.create-card {
    padding: 30px;
}

.border-buy-glow {
    border-color: rgba(16, 185, 129, 0.3);
    box-shadow: 0 0 15px rgba(16, 185, 129, 0.05);
}

.border-sell-glow {
    border-color: rgba(245, 158, 11, 0.3);
    box-shadow: 0 0 15px rgba(245, 158, 11, 0.05);
}

.card-header {
    margin-bottom: 25px;
}

.card-header h2 {
    font-size: 1.3rem;
    font-weight: 800;
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.card-header p {
    color: var(--text-muted);
    font-size: 0.85rem;
}

.calc-box {
    padding: 18px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    margin-bottom: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.calc-row {
    display: flex;
    justify-content: space-between;
    font-size: 0.9rem;
}

.calc-row.total-row {
    border-top: 1px solid var(--border-color);
    padding-top: 10px;
    font-size: 1.15rem;
    font-weight: 800;
}

.warning-banner {
    display: flex;
    gap: 15px;
    padding: 15px 20px;
    border-left: 4px solid var(--sell-color);
    border-radius: 8px;
    margin-bottom: 25px;
    background: rgba(245, 158, 11, 0.05);
}

.warning-icon {
    font-size: 1.5rem;
    color: var(--sell-color);
    margin-top: 3px;
}

.warning-banner h4 {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--sell-color);
    margin-bottom: 4px;
}

.warning-banner p {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* ==================== TRADES TAB (TABLE) ==================== */
.trades-card {
    padding: 20px;
}

.table-responsive {
    overflow-x: auto;
    width: 100%;
}

.trades-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

.trades-table th {
    padding: 15px;
    border-bottom: 2px solid var(--border-color);
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
}

.trades-table td {
    padding: 15px;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.9rem;
}

.trades-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.02);
}

/* ==================== PROFILE TAB ==================== */
.profile-card {
    padding: 30px;
    max-width: 800px;
    margin: 0 auto;
}

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

.profile-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.full-width {
    grid-column: span 2;
}

.input-disabled {
    background: rgba(255, 255, 255, 0.03) !important;
    border-color: rgba(255, 255, 255, 0.05) !important;
    color: var(--text-muted) !important;
    cursor: not-allowed;
}

.profile-actions {
    display: flex;
    justify-content: flex-end;
}

.debug-actions {
    display: flex;
    gap: 15px;
}

/* FOOTER */
.footer {
    border-top: 1px solid var(--border-color);
    padding: 30px 20px;
    text-align: center;
    color: var(--text-dark);
    font-size: 0.8rem;
    margin-top: auto;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.text-xs {
    font-size: 0.72rem;
}

.text-sm {
    font-size: 0.85rem;
}

.mb-3 {
    margin-bottom: 15px;
}

.mt-2 {
    margin-top: 8px;
}

.mt-4 {
    margin-top: 30px;
}

.py-4 {
    padding-top: 30px;
    padding-bottom: 30px;
}

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

/* Responsive adjustments */
@media (max-width: 900px) {
    .market-grid, .create-grid, .profile-grid {
        grid-template-columns: 1fr;
    }
    
    .full-width {
        grid-column: span 1;
    }
    
    .navbar-container {
        flex-direction: column;
        gap: 15px;
    }
    
    .nav-links {
        width: 100%;
        overflow-x: auto;
        padding-bottom: 5px;
    }
}

/* ==================== LANGUAGE SELECTORS ==================== */
.lang-selector-container, .auth-lang-container {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 6px 12px;
    transition: var(--transition-fast);
}

.lang-selector-container:hover, .auth-lang-container:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
}

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

.lang-select {
    background: transparent;
    border: none;
    color: var(--text-main);
    font-family: var(--font-outfit);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    outline: none;
}

.lang-select option {
    background: #111827;
    color: white;
}

.auth-view {
    position: relative;
}

.auth-lang-container {
    position: absolute;
    top: 20px;
    right: 20px;
}

