/**
 * OKIDOKEY Customer Interface - Dark Theme
 * Deep Space meets Electric Aurora Design
 */

:root {
    /* Core palette - Deep space meets electric */
    --bg-primary: #0a0a12;
    --bg-secondary: #12121f;
    --bg-tertiary: #1a1a2e;
    --bg-elevated: #22223a;
    --bg-glass: rgba(30, 30, 50, 0.7);

    /* Accent colors - Electric aurora */
    --color-primary: #7c3aed;
    --color-primary-glow: rgba(124, 58, 237, 0.4);
    --color-secondary: #06b6d4;
    --color-secondary-glow: rgba(6, 182, 212, 0.3);
    --color-success: #10b981;
    --color-warning: #f59e0b;
    --color-danger: #ef4444;
    --color-info: #3b82f6;

    /* Text hierarchy */
    --color-text: #f8fafc;
    --color-text-secondary: #94a3b8;
    --color-text-dim: #64748b;
    --color-text-muted: #475569;

    /* Gradients */
    --gradient-primary: linear-gradient(135deg, #7c3aed 0%, #a855f7 50%, #06b6d4 100%);
    --gradient-card: linear-gradient(180deg, rgba(124, 58, 237, 0.08) 0%, transparent 100%);
    --gradient-glow: radial-gradient(ellipse at center, var(--color-primary-glow) 0%, transparent 70%);

    /* Borders */
    --color-border: rgba(148, 163, 184, 0.1);
    --color-border-accent: rgba(124, 58, 237, 0.3);

    /* Shadows */
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
    --shadow-md: 0 8px 32px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 40px var(--color-primary-glow);

    /* Radius */
    --radius-sm: 6px;
    --radius: 12px;
    --radius-lg: 20px;
    --radius-xl: 28px;

    /* Spacing */
    --space-1: 4px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;
    --space-5: 20px;
    --space-6: 24px;
    --space-8: 32px;
    --space-10: 40px;
    --space-12: 48px;

    /* Nav */
    --nav-width: 280px;
    --nav-collapsed-width: 64px;
    --header-height: 72px;
    --mobile-nav-height: 64px;

    /* Legacy compatibility */
    --color-surface: var(--bg-secondary);
    --color-surface-hover: var(--bg-tertiary);
    --color-bg: var(--bg-primary);
}

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

body {
    font-family: 'DM Sans', 'Noto Sans JP', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 14px;
    line-height: 1.6;
    color: var(--color-text);
    background: var(--bg-primary);
    min-height: 100vh;
}

/* Ambient background effect */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    background:
        radial-gradient(ellipse 600px 400px at 20% 30%, rgba(124, 58, 237, 0.1) 0%, transparent 50%),
        radial-gradient(ellipse 500px 300px at 80% 70%, rgba(6, 182, 212, 0.08) 0%, transparent 50%);
}

/* Layout */
.buyer-layout {
    display: flex;
    min-height: 100vh;
    position: relative;
    z-index: 1;
}

/* Navigation */
.buyer-nav {
    width: var(--nav-width);
    background: var(--bg-secondary);
    border-right: 1px solid var(--color-border);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
}

.nav-brand {
    padding: var(--space-6);
    border-bottom: 1px solid var(--color-border);
}

.nav-brand a {
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.brand-text {
    font-size: 22px;
    font-weight: 700;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -0.02em;
}

.nav-list {
    list-style: none;
    padding: var(--space-4) var(--space-3);
    flex: 1;
    overflow-y: auto;
}

.nav-section-title {
    font-size: 10px;
    font-weight: 600;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.15em;
    padding: var(--space-5) var(--space-4) var(--space-2);
    margin-top: var(--space-2);
}

.nav-item {
    margin-bottom: var(--space-1);
}

.nav-item a {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    border-radius: var(--radius);
    color: var(--color-text-secondary);
    text-decoration: none;
    transition: all 0.2s ease;
}

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

.nav-item.active a {
    background: linear-gradient(135deg, rgba(124, 58, 237, 0.2) 0%, rgba(6, 182, 212, 0.1) 100%);
    color: var(--color-text);
    border: 1px solid var(--color-border-accent);
}

.nav-item svg {
    width: 20px;
    height: 20px;
}

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

.nav-badge {
    font-size: 9px;
    padding: 2px 8px;
    background: linear-gradient(135deg, #ff9800, #ff5722);
    color: white;
    border-radius: 100px;
    margin-left: auto;
    font-weight: 600;
}

.nav-item.disabled a {
    opacity: 0.4;
    cursor: not-allowed;
    pointer-events: none;
}

.nav-footer {
    padding: var(--space-4) var(--space-5);
    border-top: 1px solid var(--color-border);
}

.logout-link {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    color: var(--color-text-dim);
    text-decoration: none;
    font-size: 14px;
    padding: var(--space-2) var(--space-3);
    border-radius: var(--radius);
    transition: all 0.2s ease;
}

.logout-link:hover {
    background: rgba(239, 68, 68, 0.15);
    color: var(--color-danger);
}

.logout-link svg {
    width: 18px;
    height: 18px;
}

/* Main Content */
.buyer-main {
    flex: 1;
    margin-left: var(--nav-width);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header */
.buyer-header {
    height: var(--header-height);
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--color-border);
    padding: 0 var(--space-6);
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 50;
}

.page-title {
    font-size: 22px;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.header-right {
    display: flex;
    align-items: center;
    gap: var(--space-4);
}

.header-notifications {
    position: relative;
}

.btn-icon {
    width: 44px;
    height: 44px;
    border-radius: var(--radius);
    border: 1px solid var(--color-border);
    background: var(--bg-tertiary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-text-secondary);
    transition: all 0.2s ease;
}

.btn-icon:hover {
    background: var(--bg-elevated);
    border-color: var(--color-border-accent);
    color: var(--color-text);
}

.notification-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: var(--color-danger);
    color: white;
    font-size: 10px;
    font-weight: 600;
    min-width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
}

.header-user {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    padding: var(--space-2) var(--space-4);
    background: var(--bg-tertiary);
    border-radius: var(--radius);
    border: 1px solid var(--color-border);
}

.user-name {
    font-weight: 600;
    font-size: 14px;
}

.user-plan {
    font-size: 12px;
    color: var(--color-secondary);
    font-weight: 500;
}

/* Content Area */
.content {
    padding: var(--space-6);
    flex: 1;
}

/* Cards */
.card {
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    border: 1px solid var(--color-border);
    transition: all 0.2s ease;
}

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

.card-header {
    padding: var(--space-4) var(--space-5);
    border-bottom: 1px solid var(--color-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-title {
    font-size: 16px;
    font-weight: 600;
}

.card-body {
    padding: var(--space-5);
}

.card-footer {
    padding: var(--space-4) var(--space-5);
    border-top: 1px solid var(--color-border);
    background: var(--bg-tertiary);
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-5);
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all 0.2s ease;
    text-decoration: none;
    font-family: inherit;
}

.btn-sm {
    padding: var(--space-2) var(--space-4);
    font-size: 13px;
}

.btn-lg {
    padding: var(--space-4) var(--space-8);
    font-size: 16px;
}

.btn-primary {
    background: var(--gradient-primary);
    color: white;
    box-shadow: var(--shadow-sm), 0 0 20px var(--color-primary-glow);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow), 0 0 30px var(--color-primary-glow);
}

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

.btn-secondary:hover {
    background: var(--bg-elevated);
    border-color: var(--color-border-accent);
}

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

.btn-outline:hover {
    background: var(--bg-tertiary);
    border-color: var(--color-border-accent);
    color: var(--color-text);
}

.btn-danger {
    background: rgba(239, 68, 68, 0.15);
    color: var(--color-danger);
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.btn-danger:hover {
    background: rgba(239, 68, 68, 0.25);
}

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

.btn-success:hover {
    background: rgba(16, 185, 129, 0.25);
}

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

/* Forms */
.form-group {
    margin-bottom: var(--space-5);
}

.form-label {
    display: block;
    margin-bottom: var(--space-2);
    font-weight: 500;
    color: var(--color-text-secondary);
    font-size: 14px;
}

.form-input {
    width: 100%;
    padding: var(--space-3) var(--space-4);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    font-size: 14px;
    font-family: inherit;
    transition: all 0.2s ease;
    background: var(--bg-tertiary);
    color: var(--color-text);
}

.form-input:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px var(--color-primary-glow);
}

.form-input::placeholder {
    color: var(--color-text-muted);
}

.form-input:disabled {
    background: var(--bg-elevated);
    color: var(--color-text-dim);
    cursor: not-allowed;
}

.form-hint {
    font-size: 12px;
    color: var(--color-text-dim);
    margin-top: var(--space-2);
}

.form-error {
    font-size: 12px;
    color: var(--color-danger);
    margin-top: var(--space-2);
}

/* Checkbox & Radio */
.form-check {
    display: flex;
    align-items: flex-start;
    gap: var(--space-3);
    cursor: pointer;
}

.form-check input[type="checkbox"],
.form-check input[type="radio"] {
    width: 18px;
    height: 18px;
    margin-top: 2px;
    accent-color: var(--color-primary);
}

/* Alerts */
.alert {
    padding: var(--space-4) var(--space-5);
    border-radius: var(--radius);
    margin-bottom: var(--space-4);
    display: flex;
    align-items: flex-start;
    gap: var(--space-3);
    font-size: 14px;
}

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

.alert-warning {
    background: rgba(245, 158, 11, 0.15);
    color: var(--color-warning);
    border: 1px solid rgba(245, 158, 11, 0.3);
}

.alert-danger {
    background: rgba(239, 68, 68, 0.15);
    color: var(--color-danger);
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.alert-info {
    background: rgba(59, 130, 246, 0.15);
    color: var(--color-info);
    border: 1px solid rgba(59, 130, 246, 0.3);
}

/* Progress Bar */
.progress {
    height: 8px;
    background: var(--bg-elevated);
    border-radius: 100px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background: var(--gradient-primary);
    border-radius: 100px;
    transition: width 0.3s ease;
}

.progress-bar.warning {
    background: var(--color-warning);
}

.progress-bar.danger {
    background: var(--color-danger);
}

/* Tables */
.table {
    width: 100%;
    border-collapse: collapse;
}

.table th,
.table td {
    padding: var(--space-3) var(--space-4);
    text-align: left;
    border-bottom: 1px solid var(--color-border);
}

.table th {
    font-weight: 600;
    background: var(--bg-tertiary);
    font-size: 11px;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.table tbody tr {
    transition: background 0.2s ease;
}

.table tbody tr:hover {
    background: rgba(124, 58, 237, 0.05);
}

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    border-radius: 100px;
    font-size: 12px;
    font-weight: 500;
}

.badge-success {
    background: rgba(16, 185, 129, 0.15);
    color: var(--color-success);
}

.badge-warning {
    background: rgba(245, 158, 11, 0.15);
    color: var(--color-warning);
}

.badge-danger {
    background: rgba(239, 68, 68, 0.15);
    color: var(--color-danger);
}

.badge-info {
    background: rgba(59, 130, 246, 0.15);
    color: var(--color-info);
}

.badge-primary {
    background: rgba(124, 58, 237, 0.15);
    color: var(--color-primary);
}

/* Stats Card */
.stat-card {
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    padding: var(--space-5);
    border: 1px solid var(--color-border);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--gradient-primary);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.stat-card:hover {
    border-color: var(--color-border-accent);
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.stat-card:hover::before {
    opacity: 1;
}

.stat-label {
    font-size: 12px;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: var(--space-2);
}

.stat-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--color-text);
    letter-spacing: -0.02em;
}

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

/* Usage Card */
.usage-item {
    margin-bottom: var(--space-5);
}

.usage-item:last-child {
    margin-bottom: 0;
}

.usage-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: var(--space-2);
}

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

.usage-value {
    color: var(--color-text-secondary);
    font-size: 13px;
    font-family: 'JetBrains Mono', monospace;
}

/* Subscription Card */
.subscription-card {
    background: linear-gradient(135deg, rgba(124, 58, 237, 0.15) 0%, rgba(6, 182, 212, 0.1) 100%);
    border: 1px solid var(--color-border-accent);
    border-radius: var(--radius-lg);
    padding: var(--space-6);
    position: relative;
    overflow: hidden;
}

.subscription-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--gradient-primary);
}

/* Grid */
.grid {
    display: grid;
    gap: var(--space-4);
}

.grid-2 {
    grid-template-columns: repeat(2, 1fr);
}

.grid-3 {
    grid-template-columns: repeat(3, 1fr);
}

.grid-4 {
    grid-template-columns: repeat(4, 1fr);
}

/* Mobile Nav */
.mobile-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: var(--mobile-nav-height);
    background: var(--bg-secondary);
    border-top: 1px solid var(--color-border);
    z-index: 100;
}

.mobile-services-popup {
    position: fixed;
    bottom: var(--mobile-nav-height);
    left: 0;
    right: 0;
    background: var(--bg-secondary);
    border-top: 1px solid var(--color-border);
    padding: var(--space-5);
    z-index: 100;
    box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.4);
}

.mobile-services-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--space-4);
}

.mobile-service-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: var(--space-4);
    background: var(--bg-tertiary);
    border-radius: var(--radius);
    text-decoration: none;
    color: var(--color-text);
    font-size: 12px;
    transition: all 0.2s ease;
}

.mobile-service-item:hover {
    background: var(--bg-elevated);
}

.mobile-service-item i {
    margin-bottom: var(--space-2);
}

/* Auth Pages */
.auth-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-4);
    background: var(--bg-primary);
}

.auth-card {
    width: 100%;
    max-width: 420px;
    background: var(--bg-secondary);
    border-radius: var(--radius-xl);
    border: 1px solid var(--color-border);
    box-shadow: var(--shadow-lg), var(--shadow-glow);
    padding: var(--space-10);
}

.auth-header {
    text-align: center;
    margin-bottom: var(--space-8);
}

.auth-logo {
    font-size: 32px;
    font-weight: 700;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: var(--space-4);
}

.auth-title {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: var(--space-2);
}

.auth-subtitle {
    color: var(--color-text-secondary);
}

.auth-divider {
    display: flex;
    align-items: center;
    margin: var(--space-6) 0;
    color: var(--color-text-dim);
    font-size: 13px;
}

.auth-divider::before,
.auth-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--color-border);
}

.auth-divider::before {
    margin-right: var(--space-4);
}

.auth-divider::after {
    margin-left: var(--space-4);
}

.auth-footer {
    text-align: center;
    margin-top: var(--space-6);
    color: var(--color-text-secondary);
}

.auth-footer a {
    color: var(--color-secondary);
    text-decoration: none;
    font-weight: 500;
}

.auth-footer a:hover {
    text-decoration: underline;
}

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

.btn-google:hover {
    background: var(--bg-elevated);
    border-color: var(--color-border-accent);
}

.btn-google img {
    width: 20px;
    height: 20px;
}

/* Password Toggle */
.password-wrapper {
    position: relative;
}

.password-toggle {
    position: absolute;
    right: var(--space-3);
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--color-text-dim);
    cursor: pointer;
    padding: var(--space-1);
}

.password-toggle:hover {
    color: var(--color-text);
}

/* Pricing Page */
.pricing-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: var(--space-10) var(--space-6);
}

.pricing-header {
    text-align: center;
    margin-bottom: var(--space-12);
}

.pricing-title {
    font-size: 42px;
    font-weight: 700;
    margin-bottom: var(--space-4);
    letter-spacing: -0.02em;
}

.pricing-subtitle {
    font-size: 18px;
    color: var(--color-text-secondary);
}

.billing-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-4);
    margin-top: var(--space-6);
    padding: 4px;
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    width: fit-content;
    margin-left: auto;
    margin-right: auto;
}

.billing-toggle label {
    cursor: pointer;
    padding: var(--space-3) var(--space-5);
    border-radius: var(--radius);
    transition: all 0.2s ease;
    font-weight: 500;
}

.billing-toggle label.active {
    background: var(--color-primary);
    color: white;
}

.pricing-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--space-4);
    margin-bottom: var(--space-12);
}

.pricing-card {
    background: var(--bg-secondary);
    border-radius: var(--radius-xl);
    border: 1px solid var(--color-border);
    padding: var(--space-6);
    position: relative;
    transition: all 0.3s ease;
}

.pricing-card:hover {
    border-color: var(--color-border-accent);
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.pricing-card.popular {
    border-color: var(--color-primary);
    box-shadow: var(--shadow-glow);
}

.pricing-badge {
    position: absolute;
    top: -12px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--gradient-primary);
    color: white;
    padding: 6px 20px;
    border-radius: 100px;
    font-size: 12px;
    font-weight: 600;
}

.pricing-name {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: var(--space-4);
}

.pricing-price {
    margin-bottom: var(--space-4);
}

.pricing-amount {
    font-size: 40px;
    font-weight: 700;
    letter-spacing: -0.02em;
}

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

.pricing-features {
    list-style: none;
    margin: var(--space-6) 0;
}

.pricing-features li {
    display: flex;
    align-items: flex-start;
    gap: var(--space-2);
    margin-bottom: var(--space-3);
    font-size: 14px;
}

.pricing-features li svg {
    width: 16px;
    height: 16px;
    color: var(--color-success);
    flex-shrink: 0;
    margin-top: 2px;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: var(--space-12) var(--space-6);
}

.empty-state-icon {
    font-size: 48px;
    margin-bottom: var(--space-4);
    opacity: 0.5;
}

.empty-state-title {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: var(--space-2);
}

.empty-state-text {
    color: var(--color-text-secondary);
    max-width: 400px;
    margin: 0 auto;
}

/* Responsive */
@media (max-width: 1023px) {
    .buyer-nav {
        display: none;
    }

    .buyer-main {
        margin-left: 0;
        padding-bottom: var(--mobile-nav-height);
    }

    .mobile-nav {
        display: flex;
        justify-content: space-around;
        align-items: center;
    }

    .mobile-nav-item {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 2px;
        text-decoration: none;
        color: var(--color-text-secondary);
        font-size: 10px;
        padding: var(--space-2);
        transition: color 0.2s ease;
    }

    .mobile-nav-item.active {
        color: var(--color-primary);
    }

    .mobile-nav-item svg {
        width: 22px;
        height: 22px;
    }

    .grid-2, .grid-3, .grid-4 {
        grid-template-columns: 1fr;
    }

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

@media (min-width: 640px) and (max-width: 1023px) {
    .grid-2 {
        grid-template-columns: repeat(2, 1fr);
    }

    .pricing-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Loading Spinner */
.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-10);
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--color-border);
    border-top-color: var(--color-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ================================================
   Modal System
   ================================================ */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(8px);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 40px;
}

.modal-overlay.active {
    display: flex;
}

.modal {
    background: var(--bg-secondary);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-xl);
    width: 100%;
    max-width: 600px;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-lg), var(--shadow-glow);
    animation: modalEnter 0.3s ease-out;
}

.modal.modal-lg {
    max-width: 900px;
}

.modal.modal-sm {
    max-width: 400px;
}

@keyframes modalEnter {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-5) var(--space-6);
    border-bottom: 1px solid var(--color-border);
    background: linear-gradient(180deg, rgba(124, 58, 237, 0.08) 0%, transparent 100%);
}

.modal-title {
    font-size: 18px;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.modal-close {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-tertiary);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    color: var(--color-text-secondary);
    cursor: pointer;
    font-size: 18px;
    transition: all 0.2s ease;
}

.modal-close:hover {
    background: var(--bg-elevated);
    color: var(--color-text);
    border-color: var(--color-border-accent);
}

.modal-body {
    padding: var(--space-6);
    overflow-y: auto;
    flex: 1;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: var(--space-3);
    padding: var(--space-4) var(--space-6);
    border-top: 1px solid var(--color-border);
    background: var(--bg-tertiary);
}

/* ================================================
   Tabs System
   ================================================ */
.tabs-container {
    border-bottom: 1px solid var(--color-border);
}

.tabs {
    display: flex;
    padding: 0 var(--space-5);
    gap: var(--space-1);
    overflow-x: auto;
}

.tab {
    padding: var(--space-4) var(--space-5);
    font-size: 14px;
    font-weight: 500;
    color: var(--color-text-secondary);
    background: transparent;
    border: none;
    cursor: pointer;
    position: relative;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.tab:hover {
    color: var(--color-text);
}

.tab.active {
    color: var(--color-primary);
}

.tab.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--gradient-primary);
    border-radius: 2px 2px 0 0;
}

.tab-content {
    display: none;
    padding: var(--space-5);
}

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

/* ================================================
   Toast Notifications
   ================================================ */
.toast-container {
    position: fixed;
    top: var(--space-4);
    right: var(--space-4);
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

.toast {
    display: flex;
    align-items: flex-start;
    gap: var(--space-3);
    padding: var(--space-4) var(--space-5);
    background: var(--bg-secondary);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    min-width: 320px;
    max-width: 420px;
    animation: toastEnter 0.3s ease-out;
}

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

.toast-icon {
    width: 24px;
    height: 24px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.toast-content {
    flex: 1;
}

.toast-title {
    font-weight: 600;
    margin-bottom: var(--space-1);
}

.toast-message {
    font-size: 13px;
    color: var(--color-text-secondary);
}

.toast-close {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    color: var(--color-text-dim);
    cursor: pointer;
    transition: color 0.2s;
}

.toast-close:hover {
    color: var(--color-text);
}

.toast.success {
    border-left: 3px solid var(--color-success);
}

.toast.success .toast-icon {
    color: var(--color-success);
}

.toast.error {
    border-left: 3px solid var(--color-danger);
}

.toast.error .toast-icon {
    color: var(--color-danger);
}

.toast.warning {
    border-left: 3px solid var(--color-warning);
}

.toast.warning .toast-icon {
    color: var(--color-warning);
}

.toast.info {
    border-left: 3px solid var(--color-info);
}

.toast.info .toast-icon {
    color: var(--color-info);
}

/* ================================================
   Data List (for billing, history, etc.)
   ================================================ */
.data-list {
    list-style: none;
}

.data-list-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-4) var(--space-5);
    border-bottom: 1px solid var(--color-border);
    transition: background 0.2s;
}

.data-list-item:last-child {
    border-bottom: none;
}

.data-list-item:hover {
    background: rgba(124, 58, 237, 0.03);
}

.data-list-left {
    display: flex;
    align-items: center;
    gap: var(--space-4);
}

.data-list-icon {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-tertiary);
    border-radius: var(--radius);
    color: var(--color-text-secondary);
}

.data-list-info h4 {
    font-weight: 600;
    margin-bottom: var(--space-1);
}

.data-list-info p {
    font-size: 13px;
    color: var(--color-text-secondary);
}

.data-list-right {
    text-align: right;
}

.data-list-amount {
    font-weight: 600;
    font-family: 'JetBrains Mono', monospace;
}

.data-list-date {
    font-size: 12px;
    color: var(--color-text-dim);
}

/* ================================================
   Settings Page Components
   ================================================ */
.settings-section {
    margin-bottom: var(--space-8);
}

.settings-section-title {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: var(--space-4);
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.settings-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-4) 0;
    border-bottom: 1px solid var(--color-border);
}

.settings-row:last-child {
    border-bottom: none;
}

.settings-label {
    flex: 1;
}

.settings-label h4 {
    font-weight: 500;
    margin-bottom: var(--space-1);
}

.settings-label p {
    font-size: 13px;
    color: var(--color-text-secondary);
}

/* Toggle Switch */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 48px;
    height: 26px;
}

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

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

.toggle-slider::before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 2px;
    bottom: 2px;
    background: var(--color-text-secondary);
    border-radius: 50%;
    transition: 0.3s;
}

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

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

/* ================================================
   Usage Meter Component
   ================================================ */
.usage-meter {
    background: var(--bg-tertiary);
    border-radius: var(--radius);
    padding: var(--space-4);
    margin-bottom: var(--space-4);
}

.usage-meter-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-3);
}

.usage-meter-label {
    font-weight: 500;
}

.usage-meter-value {
    font-family: 'JetBrains Mono', monospace;
    font-size: 13px;
    color: var(--color-text-secondary);
}

.usage-meter-bar {
    height: 8px;
    background: var(--bg-elevated);
    border-radius: 100px;
    overflow: hidden;
}

.usage-meter-fill {
    height: 100%;
    background: var(--gradient-primary);
    border-radius: 100px;
    transition: width 0.3s ease;
}

.usage-meter-fill.warning {
    background: var(--color-warning);
}

.usage-meter-fill.danger {
    background: var(--color-danger);
}

.usage-meter-footer {
    display: flex;
    justify-content: space-between;
    margin-top: var(--space-2);
    font-size: 12px;
    color: var(--color-text-dim);
}

/* ================================================
   Notification Item
   ================================================ */
.notification-item {
    display: flex;
    gap: var(--space-4);
    padding: var(--space-4);
    border-radius: var(--radius);
    transition: background 0.2s;
    cursor: pointer;
}

.notification-item:hover {
    background: var(--bg-tertiary);
}

.notification-item.unread {
    background: rgba(124, 58, 237, 0.05);
}

.notification-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-tertiary);
    border-radius: var(--radius);
    flex-shrink: 0;
}

.notification-content {
    flex: 1;
}

.notification-title {
    font-weight: 600;
    margin-bottom: var(--space-1);
}

.notification-message {
    font-size: 13px;
    color: var(--color-text-secondary);
    margin-bottom: var(--space-2);
}

.notification-time {
    font-size: 12px;
    color: var(--color-text-dim);
}

/* ================================================
   Cancellation Page
   ================================================ */
.cancel-warning {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: var(--radius-lg);
    padding: var(--space-6);
    margin-bottom: var(--space-6);
}

.cancel-warning-icon {
    font-size: 48px;
    margin-bottom: var(--space-4);
    text-align: center;
}

.cancel-warning h3 {
    font-size: 18px;
    font-weight: 600;
    color: var(--color-danger);
    margin-bottom: var(--space-2);
    text-align: center;
}

.cancel-warning p {
    color: var(--color-text-secondary);
    text-align: center;
}

.cancel-benefits {
    background: var(--bg-tertiary);
    border-radius: var(--radius);
    padding: var(--space-5);
    margin-bottom: var(--space-6);
}

.cancel-benefits h4 {
    font-weight: 600;
    margin-bottom: var(--space-3);
}

.cancel-benefits ul {
    list-style: none;
}

.cancel-benefits li {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2) 0;
    color: var(--color-text-secondary);
}

.cancel-benefits li svg {
    color: var(--color-danger);
}

/* ================================================
   Animations
   ================================================ */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.animate-fadeIn {
    animation: fadeIn 0.3s ease-out;
}

.animate-slideUp {
    animation: slideUp 0.3s ease-out;
}

.animate-pulse {
    animation: pulse 2s infinite;
}

/* ================================================
   Mypage Dashboard - Welcome Card
   ================================================ */
.welcome-card {
    background: linear-gradient(135deg, rgba(124, 58, 237, 0.15) 0%, rgba(6, 182, 212, 0.1) 100%);
    border: 1px solid var(--color-border-accent);
    border-radius: var(--radius-xl);
    padding: var(--space-8);
    margin-bottom: var(--space-8);
    position: relative;
    overflow: hidden;
}

.welcome-card::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -20%;
    width: 400px;
    height: 400px;
    background: radial-gradient(ellipse, rgba(124, 58, 237, 0.2) 0%, transparent 70%);
    pointer-events: none;
}

.welcome-greeting {
    font-size: 28px;
    font-weight: 700;
    color: var(--color-text);
    margin-bottom: var(--space-3);
    position: relative;
}

.welcome-plan {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    font-size: 16px;
    color: var(--color-text-secondary);
    margin-bottom: var(--space-2);
    position: relative;
}

.welcome-billing {
    font-size: 14px;
    color: var(--color-text-dim);
    margin-bottom: var(--space-5);
    position: relative;
}

/* ================================================
   Service Grid
   ================================================ */
.service-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--space-5);
    margin-bottom: var(--space-8);
}

.service-card {
    background: var(--bg-secondary);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: var(--space-6);
    text-align: center;
    transition: all 0.3s ease;
    cursor: pointer;
    text-decoration: none;
    display: block;
}

.service-card:hover {
    border-color: var(--color-border-accent);
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

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

.service-card.disabled:hover {
    transform: none;
    box-shadow: none;
}

.service-icon {
    font-size: 40px;
    margin-bottom: var(--space-3);
}

.service-name {
    font-size: 16px;
    font-weight: 600;
    color: var(--color-text);
    margin-bottom: var(--space-2);
}

.service-status {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
}

.service-status.active {
    background: rgba(16, 185, 129, 0.15);
    color: var(--color-success);
}

.service-status.upgrade {
    background: rgba(124, 58, 237, 0.15);
    color: var(--color-primary);
}

.service-status.soon {
    background: rgba(100, 116, 139, 0.15);
    color: var(--color-text-muted);
}

.service-status.subscribe {
    background: rgba(59, 130, 246, 0.15);
    color: #3b82f6;
}

.service-status.trial {
    background: rgba(16, 185, 129, 0.2);
    color: #10b981;
    animation: pulse-glow 2s ease-in-out infinite;
}

@keyframes pulse-glow {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

/* ================================================
   Activity List
   ================================================ */
.activity-item {
    display: flex;
    align-items: center;
    gap: var(--space-4);
    padding: var(--space-4) 0;
    border-bottom: 1px solid var(--color-border);
}

.activity-item:last-child {
    border-bottom: none;
}

.activity-icon {
    width: 40px;
    height: 40px;
    background: rgba(124, 58, 237, 0.1);
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
}

.activity-content {
    flex: 1;
}

.activity-text {
    font-size: 14px;
    color: var(--color-text);
    margin-bottom: 4px;
}

.activity-time {
    font-size: 12px;
    color: var(--color-text-dim);
}

/* ================================================
   Notification Card
   ================================================ */
.notification-card-item {
    display: flex;
    gap: var(--space-4);
    padding: var(--space-4);
    background: var(--bg-tertiary);
    border-radius: var(--radius);
    margin-bottom: var(--space-3);
    transition: all 0.2s;
}

.notification-card-item:hover {
    background: var(--bg-elevated);
}

.notification-card-item:last-child {
    margin-bottom: 0;
}

.notification-card-icon {
    font-size: 24px;
}

.notification-card-content {
    flex: 1;
}

.notification-card-text {
    font-size: 14px;
    color: var(--color-text);
    margin-bottom: 4px;
}

.notification-card-link {
    font-size: 13px;
    color: var(--color-secondary);
    text-decoration: none;
}

.notification-card-link:hover {
    text-decoration: underline;
}

.notification-card-time {
    font-size: 12px;
    color: var(--color-text-dim);
    flex-shrink: 0;
}

/* ================================================
   Badge Pro
   ================================================ */
.badge-pro {
    background: linear-gradient(135deg, rgba(124, 58, 237, 0.2), rgba(168, 85, 247, 0.2));
    color: var(--color-primary);
    border: 1px solid rgba(124, 58, 237, 0.3);
}

/* ================================================
   Responsive Service Grid
   ================================================ */
@media (max-width: 1023px) {
    .service-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 639px) {
    .service-grid {
        grid-template-columns: 1fr;
    }

    .welcome-greeting {
        font-size: 22px;
    }
}

/* ================================================
   Nav Divider
   ================================================ */
.nav-divider {
    height: 1px;
    background: var(--color-border);
    margin: var(--space-4) var(--space-4);
}
