/* =====================================================================
   MineShare — design tokens
   Palette grounded in the subject: circuitry teal (signal/data) paired
   with a warm amber (raw hash power / energy), on a cool graphite-white
   card surface rather than the generic cream+terracotta AI default.
   Type: Space Grotesk (display, geometric/technical) + Inter (body).
   ===================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@500;600;700&family=Inter:wght@400;500;600;700&display=swap');

:root {
    --bg:            #F4F6F8;
    --surface:        #FFFFFF;
    --surface-alt:    #EEF1F4;
    --border:         #E1E6EB;
    --text:           #101720;
    --text-muted:     #5C6672;
    --text-faint:     #8993A1;

    --teal:           #0E8E82;
    --teal-dark:      #0A6B62;
    --teal-tint:      #E4F4F2;

    --amber:          #C9821F;
    --amber-tint:     #FBF0DE;

    --danger:         #C4432E;
    --danger-tint:    #FBEAE6;

    --success:        #1E8E5A;
    --success-tint:   #E6F5EC;

    --radius-sm:      10px;
    --radius-md:      14px;
    --radius-lg:      20px;
    --shadow-card:    0 1px 2px rgba(16,23,32,0.04), 0 6px 16px rgba(16,23,32,0.05);

    --font-display:   'Space Grotesk', 'Segoe UI', sans-serif;
    --font-body:      'Inter', 'Segoe UI', sans-serif;
}

html[data-theme="dark"] {
    --bg:             #0B1116;
    --surface:        #131B22;
    --surface-alt:    #182028;
    --border:         #232E38;
    --text:           #E7ECF1;
    --text-muted:     #9AA7B4;
    --text-faint:     #6B7784;

    --teal:           #29B6A6;
    --teal-dark:      #1F8E82;
    --teal-tint:      #142A28;

    --amber:          #E2A64A;
    --amber-tint:     #2B2214;

    --danger:         #E2685A;
    --danger-tint:    #2C1815;

    --success:        #4CBE87;
    --success-tint:   #12271C;

    --shadow-card:    0 1px 2px rgba(0,0,0,0.3), 0 8px 20px rgba(0,0,0,0.35);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

html, body { overflow-x: hidden; width: 100%; }

body {
    margin: 0;
    font-family: var(--font-body);
    background: var(--bg);
    color: var(--text);
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
    transition: background .2s ease, color .2s ease;
}

h1, h2, h3, h4, .display {
    font-family: var(--font-display);
    font-weight: 600;
    line-height: 1.2;
    margin: 0 0 .4em;
    letter-spacing: -0.01em;
}

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

p { color: var(--text-muted); margin: 0 0 1em; }

img { max-width: 100%; display: block; }

.container {
    max-width: 1180px;
    margin: 0 auto;
    padding: 0 24px;
}

/* ---------- Cards ---------- */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-card);
    padding: 22px;
    transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
}
.card-hover:hover {
    transform: translateY(-3px);
    border-color: var(--teal);
    box-shadow: 0 4px 10px rgba(16,23,32,0.06), 0 14px 28px rgba(16,23,32,0.08);
}
.card-icon {
    width: 42px; height: 42px;
    border-radius: 11px;
    display: flex; align-items: center; justify-content: center;
    background: var(--teal-tint); color: var(--teal);
    margin-bottom: 14px;
}
.card-icon.amber { background: var(--amber-tint); color: var(--amber); }

.card-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
}

.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 18px 20px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
}
.stat-card:hover {
    transform: translateY(-2px);
    border-color: var(--teal);
    box-shadow: 0 4px 10px rgba(16,23,32,0.05), 0 10px 22px rgba(16,23,32,0.06);
}

.stat-card .stat-icon {
    width: 38px; height: 38px;
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    background: var(--teal-tint);
    color: var(--teal);
    margin-bottom: 6px;
}
.stat-card .stat-label { font-size: 13px; color: var(--text-muted); }
.stat-card .stat-value { font-family: var(--font-display); font-size: 24px; font-weight: 700; }

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-family: var(--font-body);
    font-weight: 600;
    font-size: 14.5px;
    padding: 11px 20px;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    cursor: pointer;
    transition: transform .05s ease, background .15s ease, border-color .15s ease;
    text-decoration: none;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--teal); color: #fff; }
.btn-primary:hover { background: var(--teal-dark); text-decoration: none; }
.btn-outline { background: transparent; border-color: var(--border); color: var(--text); }
.btn-outline:hover { border-color: var(--teal); color: var(--teal); text-decoration: none; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-block { width: 100%; }
.btn-sm { padding: 7px 14px; font-size: 13px; }

/* ---------- Forms ---------- */
.form-group { margin-bottom: 16px; }
label { display: block; font-size: 13.5px; font-weight: 600; margin-bottom: 6px; color: var(--text); }
input[type="text"], input[type="email"], input[type="password"], input[type="number"], select, textarea {
    width: 100%;
    padding: 11px 13px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    font-family: var(--font-body);
    font-size: 14.5px;
}
input:focus, select:focus, textarea:focus {
    outline: 2px solid var(--teal);
    outline-offset: 1px;
    border-color: var(--teal);
}

/* ---------- Tables ---------- */
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { padding: 12px 14px; text-align: left; border-bottom: 1px solid var(--border); }
th { color: var(--text-muted); font-weight: 600; font-size: 12.5px; }
.table-wrap { overflow-x: auto; }

.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
}
.badge-success { background: var(--success-tint); color: var(--success); }
.badge-pending { background: var(--amber-tint); color: var(--amber); }
.badge-danger  { background: var(--danger-tint); color: var(--danger); }

/* ---------- Public navbar / footer ---------- */
.site-navbar {
    display: flex; align-items: center; justify-content: space-between;
    padding: 18px 0;
    border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 10px; font-family: var(--font-display); font-weight: 700; font-size: 20px; }
.brand .brand-mark { flex-shrink: 0; }
.nav-links { display: flex; gap: 26px; align-items: center; }
.nav-links a { display: inline-flex; align-items: center; gap: 6px; color: var(--text); font-weight: 500; font-size: 14.5px; }
.nav-links a svg { width: 16px; height: 16px; opacity: .8; }
.nav-links a:hover { color: var(--teal); text-decoration: none; }
.nav-links a:hover svg { opacity: 1; }

.site-footer { border-top: 1px solid var(--border); padding: 28px 0; margin-top: 60px; }
.footer-row { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 14px; }
.footer-links { display: flex; gap: 22px; }
.footer-links a { display: inline-flex; align-items: center; gap: 6px; color: var(--text-muted); font-size: 14px; }
.footer-links a svg { width: 15px; height: 15px; opacity: .75; }
.footer-links a:hover svg { opacity: 1; }

/* ---------- Theme toggle ---------- */
.theme-toggle {
    width: 40px; height: 40px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--surface);
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
    color: var(--text);
}
.theme-toggle:hover { border-color: var(--teal); }

/* ---------- Auth pages ---------- */
.auth-wrap {
    min-height: 100vh;
    display: flex; align-items: center; justify-content: center;
    background: var(--bg);
    padding: 24px;
}
.auth-card {
    width: 100%; max-width: 400px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
    padding: 36px 32px;
}
.auth-card .brand { justify-content: center; margin-bottom: 20px; }
.auth-foot { text-align: center; margin-top: 18px; font-size: 14px; color: var(--text-muted); }

/* ---------- App shell (user + admin) ---------- */
.app-shell { display: flex; min-height: 100vh; }

.app-sidebar {
    width: 250px;
    flex-shrink: 0;
    background: var(--surface);
    border-right: 1px solid var(--border);
    padding: 20px 14px;
    position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.app-sidebar .brand { padding: 0 8px 20px; }
.sidebar-nav a {
    display: flex; align-items: center; gap: 11px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-weight: 500; font-size: 14.5px;
    margin-bottom: 2px;
}
.sidebar-nav a:hover { background: var(--surface-alt); color: var(--text); text-decoration: none; }
.sidebar-nav a.active { background: var(--teal-tint); color: var(--teal); }
.sidebar-nav svg { width: 18px; height: 18px; flex-shrink: 0; }

.app-main { flex: 1; min-width: 0; }
.app-topbar {
    display: flex; align-items: center; justify-content: space-between;
    padding: 14px 24px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    position: sticky; top: 0; z-index: 20;
}
.app-content { padding: 24px; max-width: 1180px; }

.menu-btn { display: none; background: none; border: 1px solid var(--border); border-radius: 9px; width: 38px; height: 38px; cursor: pointer; color: var(--text); }

.profile-menu { position: relative; }
.profile-btn { display: flex; align-items: center; gap: 8px; cursor: pointer; background: none; border: none; }
.profile-avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--teal-tint); color: var(--teal); display: flex; align-items: center; justify-content: center; font-weight: 700; }
.profile-dropdown {
    display: none;
    position: absolute; right: 0; top: 46px;
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm);
    box-shadow: var(--shadow-card); min-width: 180px; overflow: hidden; z-index: 30;
}
.profile-dropdown.open { display: block; }
.profile-dropdown a { display: block; padding: 11px 16px; color: var(--text); font-size: 14px; }
.profile-dropdown a:hover { background: var(--surface-alt); text-decoration: none; }

/* ---------- Quick action grid ---------- */
.quick-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.quick-item {
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md);
    padding: 18px 14px; text-align: center; color: var(--text);
    transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
}
.quick-item:hover {
    border-color: var(--teal); text-decoration: none;
    transform: translateY(-3px);
    box-shadow: 0 4px 10px rgba(16,23,32,0.06), 0 14px 26px rgba(16,23,32,0.07);
}
.quick-item .qi-icon { width: 40px; height: 40px; margin: 0 auto 10px; border-radius: 10px; background: var(--amber-tint); color: var(--amber); display: flex; align-items: center; justify-content: center; }
.quick-item .qi-label { font-size: 13.5px; font-weight: 600; }

/* ---------- Mining machine ---------- */
.mining-rig {
    display: flex; align-items: center; justify-content: center;
    padding: 30px; background: var(--surface-alt); border-radius: var(--radius-lg);
    margin: 18px 0;
}
.rig-fan { animation: spin 3s linear infinite; transform-origin: center; }
@keyframes spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .rig-fan { animation: none; } }

/* ---------- Modal ---------- */
.modal-overlay {
    display: none;
    position: fixed; inset: 0; background: rgba(10,14,18,.5);
    align-items: center; justify-content: center; z-index: 100; padding: 20px;
}
.modal-overlay.open { display: flex; }
.modal-box {
    background: var(--surface); border-radius: var(--radius-lg); border: 1px solid var(--border);
    width: 100%; max-width: 400px; padding: 26px; box-shadow: var(--shadow-card);
}
.modal-close { float: right; background: none; border: none; cursor: pointer; color: var(--text-muted); font-size: 20px; line-height: 1; }

/* ---------- Utility ---------- */
.flex { display: flex; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.gap-8 { gap: 8px; } .gap-12 { gap: 12px; } .gap-16 { gap: 16px; }
.mt-8 { margin-top: 8px; } .mt-16 { margin-top: 16px; } .mt-24 { margin-top: 24px; }
.mb-8 { margin-bottom: 8px; } .mb-16 { margin-bottom: 16px; } .mb-24 { margin-bottom: 24px; }
.text-muted { color: var(--text-muted); }
.text-sm { font-size: 13px; }
.alert { padding: 12px 16px; border-radius: var(--radius-sm); margin-bottom: 16px; font-size: 14px; }
.alert-success { background: var(--success-tint); color: var(--success); }
.alert-error { background: var(--danger-tint); color: var(--danger); }
.section { padding: 56px 0; }
.hero { display: grid; grid-template-columns: 1.1fr 0.9fr; gap: 40px; align-items: center; padding: 64px 0; }
.faq-item { border-bottom: 1px solid var(--border); padding: 16px 0; cursor: pointer; }
.faq-q { display: flex; justify-content: space-between; align-items: center; font-weight: 600; }
.faq-a { display: none; margin-top: 10px; color: var(--text-muted); }
.faq-item.open .faq-a { display: block; }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
    .card-grid { grid-template-columns: repeat(2, 1fr); }
    .quick-grid { grid-template-columns: repeat(2, 1fr); }
    .hero { grid-template-columns: 1fr; padding: 40px 0; }
    .app-sidebar {
        position: fixed; left: 0; top: 0; z-index: 50;
        transform: translateX(-100%);
        transition: transform .2s ease;
        box-shadow: var(--shadow-card);
    }
    .app-sidebar.open { transform: translateX(0); }
    .menu-btn { display: flex; align-items: center; justify-content: center; }
    .nav-links { display: none; }
}
@media (max-width: 600px) {
    .card-grid { grid-template-columns: 1fr; }
    .quick-grid { grid-template-columns: 1fr; }
    .app-content { padding: 16px; }
    .footer-row { flex-direction: column; align-items: flex-start; }
}
