/* Deploy CryptoHost — App Styles */
:root {
    --bg: #0b0d12;
    --surface: #11141d;
    --surface2: #1a1e29;
    --surface3: #242a38;
    --border: #2a3040;
    --text: #f0f2f7;
    --text-muted: #8b92a8;
    --accent: #3b82f6;
    --accent-hover: #2563eb;
    --success: #22c55e;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #06b6d4;
    --purple: #8b5cf6;
    --radius: 12px;
    --shadow: 0 4px 24px rgba(0,0,0,0.4);
    --font: 'Inter', system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; width: 100%; min-height: 100%; overflow-x: hidden; }
body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
    line-height: 1.5;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }

/* Layout */
.app-layout {
    display: block;
    min-height: 100vh;
    width: 100%;
}

.sidebar {
    background: var(--surface);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: fixed;
    width: 260px;
    height: 100vh;
    top: 0;
    left: 0;
    overflow-y: auto;
    z-index: 100;
}

.brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1.25rem;
    border-bottom: 1px solid var(--border);
}

.brand-logo {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--accent), var(--purple));
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: white;
}

.brand-title { font-weight: 700; font-size: 1rem; }
.brand-sub { font-size: 0.75rem; color: var(--text-muted); }

.nav {
    flex: 1;
    padding: 1rem 0.75rem;
}

.nav-group {
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    padding: 1rem 0.75rem 0.5rem;
    font-weight: 600;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.65rem 0.75rem;
    border-radius: 8px;
    color: var(--text-muted);
    margin-bottom: 0.25rem;
    transition: all 0.15s;
}

.nav-item:hover {
    background: var(--surface2);
    color: var(--text);
}

.nav-item.active {
    background: rgba(59, 130, 246, 0.15);
    color: var(--accent);
}

.nav-icon { font-size: 1.1rem; }

.sidebar-footer {
    padding: 1rem;
    border-top: 1px solid var(--border);
}

.user-mini {
    margin-bottom: 0.75rem;
}

.user-name { font-weight: 600; font-size: 0.85rem; }
.user-role { font-size: 0.75rem; color: var(--text-muted); }

.main-content {
    margin-left: 260px;
    width: calc(100% - 260px);
    min-width: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.topbar {
    height: 64px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
    position: sticky;
    top: 0;
    z-index: 10;
}

.page-title { font-size: 1.25rem; font-weight: 700; margin: 0; }

.status-badge {
    font-size: 0.75rem;
    padding: 0.35rem 0.75rem;
    border-radius: 999px;
    font-weight: 600;
}

.status-badge.online {
    background: rgba(34, 197, 94, 0.15);
    color: var(--success);
}

.content-wrapper {
    width: 100%;
    max-width: 1600px;
    margin: 0 auto;
    padding: 1.5rem;
    flex: 1;
}

/* Cards */
.card {
    width: 100%;
    min-width: 0;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
}

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

.card-title { font-weight: 600; font-size: 1rem; }

.card-body { padding: 1.25rem; }

/* Stats */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.25rem;
}

.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
    box-shadow: var(--shadow);
    border-left: 4px solid var(--stat-color, var(--accent));
}

.stat-label { font-size: 0.8rem; color: var(--text-muted); }
.stat-value { font-size: 1.75rem; font-weight: 700; margin: 0.25rem 0; }
.stat-sub { font-size: 0.75rem; color: var(--text-muted); }

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.6rem 1rem;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.85rem;
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 0.15s;
    text-decoration: none;
}

.btn-primary {
    background: var(--accent);
    color: white;
}
.btn-primary:hover { background: var(--accent-hover); color: white; }

.btn-outline {
    background: transparent;
    border-color: var(--border);
    color: var(--text);
}
.btn-outline:hover { background: var(--surface2); }

.btn-ghost { background: transparent; color: var(--text-muted); }
.btn-ghost:hover { background: var(--surface2); color: var(--text); }

.btn-sm { padding: 0.4rem 0.75rem; font-size: 0.8rem; }
.btn-block { width: 100%; }

/* Forms */
.form-group { margin-bottom: 1rem; }
.form-group label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    margin-bottom: 0.4rem;
    color: var(--text-muted);
}
.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    background: var(--surface2);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 0.6rem 0.8rem;
    border-radius: 8px;
    font-size: 0.9rem;
    font-family: inherit;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--accent);
}

/* Login */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 1rem;
}

.login-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 2rem;
    width: 100%;
    max-width: 400px;
    box-shadow: var(--shadow);
}

.login-card .brand { padding: 0 0 1.5rem 0; border-bottom: none; }

.alert {
    padding: 0.75rem 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    font-size: 0.85rem;
}

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

/* Tables */
.table-wrapper { overflow-x: auto; }
.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}
.table th, .table td {
    padding: 0.75rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
}
.table th {
    color: var(--text-muted);
    font-weight: 600;
    background: var(--surface2);
}
.table tr:last-child td { border-bottom: none; }

.badge {
    display: inline-block;
    padding: 0.2rem 0.5rem;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
}
.badge-success { background: rgba(34, 197, 94, 0.15); color: var(--success); }
.badge-danger { background: rgba(239, 68, 68, 0.15); color: var(--danger); }
.badge-warning { background: rgba(245, 158, 11, 0.15); color: var(--warning); }
.badge-muted { background: var(--surface3); color: var(--text-muted); }

.code-sm {
    font-family: monospace;
    font-size: 0.8rem;
    color: var(--text-muted);
    word-break: break-all;
}

/* Quick actions */
.quick-actions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
    padding: 1.25rem;
}

.quick-action {
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 1rem;
    transition: all 0.15s;
}

.quick-action:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
}

.quick-action-icon { font-size: 1.5rem; margin-bottom: 0.5rem; display: block; }
.quick-action-title { font-weight: 600; margin-bottom: 0.25rem; color: var(--text); }
.quick-action-sub { font-size: 0.75rem; color: var(--text-muted); }

.empty-state {
    padding: 2rem;
    text-align: center;
    color: var(--text-muted);
}

.deployment-list { padding: 0.5rem 1.25rem; }
.deployment-item {
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border);
}
.deployment-item:last-child { border-bottom: none; }
.deployment-name { font-weight: 600; }
.deployment-meta { font-size: 0.75rem; color: var(--text-muted); }
.deployment-address {
    font-family: monospace;
    font-size: 0.75rem;
    color: var(--text-muted);
    word-break: break-all;
}

/* Deploy page */
[hidden] { display: none !important; }

.deploy-page .toolkit-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1.25rem;
    border-bottom: 1px solid var(--border);
    padding-bottom: 0.75rem;
}

.toolkit-tab {
    background: var(--surface2);
    border: 1px solid var(--border);
    color: var(--text-muted);
    padding: 0.5rem 1rem;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
}

.toolkit-tab.active {
    background: var(--accent);
    border-color: var(--accent);
    color: white;
}

.toolkit-description {
    margin: -0.25rem 0 1.25rem;
    padding: 0.75rem 1rem;
    border-left: 3px solid var(--accent);
    background: rgba(59, 130, 246, 0.08);
    border-radius: 0 8px 8px 0;
}

.wallet-connect-wrap {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.75rem;
    min-width: 0;
}

.wallet-status {
    color: var(--text-muted);
    font-size: 0.75rem;
    white-space: nowrap;
}

.wallet-status.connected { color: var(--success); }
.wallet-connected { background: var(--success); }
.wallet-connected:hover { background: #16a34a; }
.wallet-connected::before {
    content: '';
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: white;
}

.deploy-form .two-col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.deploy-form .radio-group {
    display: flex;
    gap: 1.5rem;
    margin-top: 0.5rem;
}

.deploy-form .radio-group label {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    cursor: pointer;
    color: var(--text);
    font-weight: 500;
}

.deploy-form .hint {
    font-size: 0.75rem;
    color: var(--warning);
    margin-top: 0.25rem;
}

.form-actions {
    display: flex;
    gap: 1rem;
    margin-top: 1.5rem;
}

.result-panel {
    margin-top: 1.25rem;
    padding: 1rem;
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 8px;
}

/* IDE */
.ide-layout {
    display: grid;
    grid-template-columns: 220px 1fr;
    gap: 1rem;
    min-height: 500px;
}

.ide-sidebar {
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.75rem;
}

.project-tree {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.tree-item {
    padding: 0.35rem 0;
    cursor: pointer;
}

.tree-item.tree-file {
    padding-left: 1rem;
}

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

.ide-editor {
    display: flex;
    flex-direction: column;
}

.code-editor {
    width: 100%;
    flex: 1;
    min-height: 500px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    font-family: 'Fira Code', monospace;
    font-size: 0.9rem;
    padding: 1rem;
    resize: vertical;
}

.mobile-menu-btn {
    display: none;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface2);
    color: var(--text);
    cursor: pointer;
}

.header-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    flex-wrap: wrap;
}

.header-actions select,
.ide-toolbar input,
.ide-toolbar select {
    background: var(--surface2);
    border: 1px solid var(--border);
    color: var(--text);
    border-radius: 8px;
    padding: 0.45rem 0.65rem;
}

.ide-toolbar {
    display: grid;
    grid-template-columns: 1fr 180px 120px;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.ide-file {
    display: block;
    width: 100%;
    border: 0;
    background: transparent;
    text-align: left;
    color: var(--text-muted);
}

.toast {
    position: fixed;
    right: 1.25rem;
    bottom: 1.25rem;
    z-index: 1000;
    min-width: 240px;
    padding: 0.8rem 1rem;
    border-radius: 8px;
    background: var(--surface3);
    color: var(--text);
    border: 1px solid var(--border);
    opacity: 0;
    transform: translateY(12px);
    transition: all 0.2s;
    box-shadow: var(--shadow);
}

.toast.show { opacity: 1; transform: translateY(0); }
.toast-success { border-color: var(--success); }
.toast-danger { border-color: var(--danger); }

.tool-grid {
    display: grid;
    grid-template-columns: 220px 1fr;
    gap: 1rem;
}

.function-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.function-card {
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1rem;
}

.function-name { font-weight: 700; margin-bottom: 0.15rem; }
.function-signature { color: var(--text-muted); font-family: monospace; font-size: 0.75rem; margin-bottom: 0.75rem; }
.function-card input {
    width: 100%;
    background: var(--bg);
    border: 1px solid var(--border);
    color: var(--text);
    border-radius: 6px;
    padding: 0.5rem;
    margin-bottom: 0.5rem;
}
.result-panel pre { white-space: pre-wrap; overflow-wrap: anywhere; margin: 0; }

/* Coming soon */
.coming-soon {
    padding: 2rem;
    text-align: center;
    background: var(--surface2);
    border: 1px dashed var(--border);
    border-radius: 8px;
    color: var(--text-muted);
}

.text-muted { color: var(--text-muted); }
.market-up { color: var(--success); font-weight: 600; }
.market-down { color: var(--danger); font-weight: 600; }
.coin-cell { display: flex; align-items: center; gap: 0.65rem; }
.coin-cell img { width: 28px; height: 28px; border-radius: 50%; }
.header-actions input[type="search"] {
    background: var(--surface2);
    border: 1px solid var(--border);
    color: var(--text);
    border-radius: 8px;
    padding: 0.45rem 0.65rem;
}

.alert-success {
    background: rgba(34, 197, 94, 0.15);
    color: var(--success);
    border: 1px solid rgba(34, 197, 94, 0.3);
}

/* Responsive */
@media (max-width: 900px) {
    .sidebar {
        display: flex;
        width: min(290px, 86vw);
        transform: translateX(-105%);
        transition: transform 0.2s ease;
        box-shadow: 18px 0 48px rgba(0, 0, 0, 0.45);
    }
    .sidebar.mobile-open { transform: translateX(0); }
    .main-content { margin-left: 0; width: 100%; }
    .mobile-menu-btn { display: inline-flex; }
    .topbar { padding: 0 1rem; justify-content: flex-start; gap: 0.75rem; }
    .topbar-actions { margin-left: auto; }
    .content-wrapper { padding: 1rem; }
    .dashboard-grid { grid-template-columns: 1fr !important; }
    .deploy-form .two-col,
    .tool-grid,
    .ide-toolbar { grid-template-columns: 1fr; }
    .ide-layout { grid-template-columns: 1fr; }
    .ide-sidebar { max-height: 180px; overflow-y: auto; }
    .card-header { align-items: flex-start; gap: 0.75rem; flex-wrap: wrap; }
    .header-actions { width: 100%; }
    .wallet-connect-wrap { width: 100%; justify-content: space-between; }
}


@media (max-width: 600px) {
    .content-wrapper { padding: 0.75rem; }
    .stats-grid { grid-template-columns: 1fr; gap: 0.75rem; }
    .card-body, .card-header { padding: 1rem; }
    .quick-actions { grid-template-columns: 1fr; padding: 1rem; }
    .header-actions > input,
    .header-actions > select,
    .header-actions > .btn { width: 100%; }
    .form-actions { flex-direction: column; }
    .form-actions .btn { width: 100%; }
    .page-title { font-size: 1.05rem; }
    .status-badge { padding: 0.25rem 0.55rem; }
    .wallet-connect-wrap { align-items: stretch; flex-direction: column; }
    .wallet-connect-wrap .btn { width: 100%; }
    .wallet-status { white-space: normal; }
}
