/* ============================================================
   TamaDog – Main Stylesheet
   Cartoon style inspired by CryptoKitties
   ============================================================ */

/* ---- Variables ---- */
:root {
    --primary:     #ff6b9d;
    --primary-h:   #ff4d88;
    --secondary:   #a78bfa;
    --accent:      #fbbf24;
    --success:     #34d399;
    --danger:      #f87171;
    --info:        #60a5fa;

    --bg:          #fdf6ff;
    --bg-card:     #ffffff;
    --bg-dark:     #2d1b69;

    --text:        #2d1b69;
    --text-muted:  #7c6fa0;
    --border:      #e9d8fd;

    --radius:      16px;
    --radius-sm:   8px;
    --shadow:      0 4px 20px rgba(100,50,200,.10);
    --shadow-card: 0 8px 32px rgba(100,50,200,.14);

    --font: 'Nunito', 'Segoe UI', sans-serif;
}

/* ---- Reset ---- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; }
body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
img, canvas { display: block; }

/* ---- Navbar ---- */
.navbar {
    background: var(--bg-dark);
    padding: 0 24px;
    position: sticky; top: 0; z-index: 100;
    box-shadow: 0 2px 12px rgba(0,0,0,.2);
}
.navbar-inner {
    max-width: 1280px; margin: 0 auto;
    display: flex; align-items: center; gap: 24px;
    height: 60px;
}
.navbar-brand {
    display: flex; align-items: center; gap: 8px;
    font-size: 1.5rem; font-weight: 900; color: #fff;
    text-decoration: none; flex-shrink: 0;
}
.brand-icon { font-size: 1.6rem; }
.brand-name { color: var(--primary); }
.navbar-links {
    display: flex; align-items: center; gap: 12px;
    margin-left: auto; flex-wrap: wrap;
}
.nav-link {
    color: rgba(255,255,255,.8); font-weight: 700;
    padding: 6px 10px; border-radius: var(--radius-sm);
    transition: background .2s, color .2s;
    text-decoration: none;
}
.nav-link:hover, .nav-link.active {
    background: rgba(255,255,255,.15); color: #fff;
    text-decoration: none;
}
.admin-link { color: var(--accent) !important; }
.nav-user {
    display: flex; align-items: center; gap: 10px;
    border-left: 1px solid rgba(255,255,255,.2);
    padding-left: 12px;
}
.nav-username { color: rgba(255,255,255,.9); font-weight: 700; text-decoration: none; }
.nav-coins { color: var(--accent); font-weight: 800; font-size: .95rem; }

/* ---- Buttons ---- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    padding: 10px 22px; border-radius: 50px;
    font-family: var(--font); font-weight: 800; font-size: .95rem;
    cursor: pointer; border: 2px solid transparent;
    transition: all .2s; text-decoration: none; white-space: nowrap;
}
.btn-primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-h); border-color: var(--primary-h); transform: translateY(-1px); text-decoration: none; color: #fff; }
.btn-outline { background: transparent; color: var(--primary); border-color: var(--primary); }
.btn-outline:hover { background: var(--primary); color: #fff; text-decoration: none; }
.btn-siring { background: var(--secondary); color: #fff; border-color: var(--secondary); }
.btn-siring:hover { background: #8b5cf6; border-color: #8b5cf6; text-decoration: none; color: #fff; }
.btn-breed { background: var(--success); color: #fff; border-color: var(--success); }
.btn-breed:hover { background: #10b981; text-decoration: none; color: #fff; }
.btn-danger { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn-lg { padding: 14px 32px; font-size: 1.05rem; }
.btn-sm { padding: 6px 14px; font-size: .85rem; }
.btn-block { width: 100%; }
.btn-buy { background: linear-gradient(135deg, var(--accent), #f59e0b); color: #1a1a1a; border: none; }

/* ---- Alerts ---- */
.alert {
    padding: 14px 20px; border-radius: var(--radius-sm);
    margin: 16px auto; max-width: 1280px;
    font-weight: 700;
}
.alert-success { background: #d1fae5; color: #065f46; border: 1.5px solid #6ee7b7; }
.alert-error   { background: #fee2e2; color: #991b1b; border: 1.5px solid #fca5a5; }
.alert-info    { background: #dbeafe; color: #1e40af; border: 1.5px solid #93c5fd; }

/* ---- Main content ---- */
.main-content {
    flex: 1; max-width: 1280px; width: 100%;
    margin: 0 auto; padding: 32px 24px;
}

/* ---- Hero ---- */
.hero {
    display: flex; align-items: center; justify-content: space-between;
    gap: 40px; padding: 60px 0 40px;
}
.hero-content { max-width: 520px; }
.hero-content h1 { font-size: 2.8rem; font-weight: 900; line-height: 1.15; }
.hero-accent { color: var(--primary); }
.hero-content p { color: var(--text-muted); font-size: 1.1rem; margin: 16px 0 28px; }
.hero-cta { display: flex; gap: 14px; flex-wrap: wrap; }
.hero-dog { flex-shrink: 0; }
.hero-dog canvas {
    border-radius: 50%; background: white;
    box-shadow: 0 0 0 8px var(--border), var(--shadow-card);
}

/* ---- Stats bar ---- */
.stats-bar {
    display: flex; gap: 2px;
    background: linear-gradient(135deg, var(--bg-dark), #4c1d95);
    border-radius: var(--radius); padding: 24px 32px;
    margin: 32px 0; justify-content: space-around;
}
.stat { text-align: center; color: white; }
.stat-value { display: block; font-size: 2rem; font-weight: 900; color: var(--accent); }
.stat-label { font-size: .85rem; color: rgba(255,255,255,.7); }

/* ---- Section ---- */
.section { margin: 48px 0; }
.section-header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 20px;
}
.section-header h2 { font-size: 1.5rem; font-weight: 900; }

/* ---- Dog Grid ---- */
.dog-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
}
.dog-grid-full {
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
}

/* ---- Dog Card ---- */
.dog-card {
    background: var(--bg-card); border-radius: var(--radius);
    border: 2px solid var(--border);
    overflow: hidden; text-decoration: none; color: var(--text);
    transition: transform .2s, box-shadow .2s, border-color .2s;
    display: flex; flex-direction: column;
}
.dog-card:hover {
    transform: translateY(-4px); box-shadow: var(--shadow-card);
    border-color: var(--primary); text-decoration: none; color: var(--text);
}
.dog-card-fancy { border-color: var(--accent) !important; }
.dog-card-art {
    position: relative; background: linear-gradient(135deg, #fdf4ff, #ede9fe);
    display: flex; align-items: center; justify-content: center; padding: 16px;
}
.dog-card-art canvas { margin: 0 auto; }
.dog-card-info {
    padding: 12px 14px; display: flex; flex-direction: column; gap: 3px;
}
.dog-name  { font-weight: 800; font-size: .95rem; }
.dog-gen   { color: var(--text-muted); font-size: .8rem; }
.dog-price { color: var(--primary); font-weight: 800; }
.dog-owner { color: var(--text-muted); font-size: .8rem; }
.dog-timer { color: var(--text-muted); font-size: .78rem; }
.price-range-bar {
    display: flex; align-items: center; gap: 6px;
    font-size: .78rem; color: var(--text-muted);
}
.cooldown-overlay {
    position: absolute; inset: 0;
    background: rgba(0,0,0,.45); color: white;
    display: flex; align-items: center; justify-content: center;
    font-weight: 800; font-size: .85rem; border-radius: inherit;
}

/* ---- Badges ---- */
.badge {
    display: inline-flex; align-items: center;
    padding: 3px 10px; border-radius: 50px;
    font-size: .72rem; font-weight: 800;
    position: absolute; top: 8px; left: 8px;
}
.badge-fancy  { background: var(--accent);    color: #1a1a1a; }
.badge-gen0   { background: var(--secondary); color: white;   top: 8px; right: 8px; left: auto; }
.badge-sale   { background: var(--primary);   color: white; }
.badge-siring { background: var(--secondary); color: white; }

/* ---- Dog Page ---- */
.dog-page {
    display: grid; grid-template-columns: 1fr 1fr; gap: 40px;
    align-items: start;
}
.dog-visual { position: relative; text-align: center; }
.dog-canvas-lg {
    border-radius: var(--radius); background: linear-gradient(135deg, #fdf4ff, #ede9fe);
    box-shadow: var(--shadow-card); margin: 0 auto;
}
.fancy-banner, .gen0-banner {
    margin-top: 12px; padding: 8px 16px;
    border-radius: 50px; font-weight: 800; display: inline-block;
}
.fancy-banner { background: var(--accent);    color: #1a1a1a; }
.gen0-banner  { background: var(--secondary); color: white;   }
.dog-title { font-size: 2rem; font-weight: 900; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.dog-meta-row { display: flex; flex-wrap: wrap; gap: 12px; margin: 12px 0; color: var(--text-muted); font-size: .9rem; }
.cooldown-banner {
    background: #fef3c7; border: 1.5px solid #fbbf24;
    color: #92400e; padding: 10px 16px; border-radius: var(--radius-sm);
    font-weight: 700; margin: 12px 0;
}
.auction-box {
    background: linear-gradient(135deg, #fdf4ff, #ede9fe);
    border: 2px solid var(--border); border-radius: var(--radius);
    padding: 20px; margin: 16px 0;
}
.auction-type { font-weight: 800; color: var(--text-muted); margin-bottom: 8px; }
.price-current { font-size: 2rem; font-weight: 900; color: var(--primary); display: block; }
.price-range   { color: var(--text-muted); font-size: .85rem; }
.auction-timer { color: var(--text-muted); font-size: .85rem; margin: 8px 0 16px; }
.owner-actions { margin: 16px 0; display: flex; flex-direction: column; gap: 10px; }
.owner-actions h3 { font-size: 1.1rem; margin-bottom: 4px; }
.action-panel {
    border: 1.5px solid var(--border); border-radius: var(--radius-sm);
    padding: 12px 16px;
}
.action-panel summary { cursor: pointer; font-weight: 700; }
.mini-form { display: flex; flex-direction: column; gap: 10px; margin-top: 12px; }
.mini-form label { display: flex; flex-direction: column; gap: 4px; font-size: .9rem; font-weight: 700; }
.mini-form input, .mini-form select { padding: 8px 12px; border: 1.5px solid var(--border); border-radius: var(--radius-sm); font-family: var(--font); font-size: .9rem; }
.offer-section { margin: 16px 0; }
.offer-section h3 { margin-bottom: 10px; }
.offer-input-row { display: flex; gap: 10px; }
.offer-input-row input { flex: 1; padding: 10px 14px; border: 1.5px solid var(--border); border-radius: var(--radius-sm); font-family: var(--font); }
.offers-list { margin: 20px 0; }
.offers-list h3 { margin-bottom: 10px; }
.offer-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 10px; background: #f9f5ff; border-radius: var(--radius-sm); margin-bottom: 8px; }
.offer-expiry { color: var(--text-muted); font-size: .8rem; margin-left: auto; }
.offer-actions { display: flex; gap: 8px; }

/* ---- Traits ---- */
.traits-section { margin: 40px 0; }
.traits-section h2 { margin-bottom: 16px; }
.traits-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px;
}
.trait-card {
    background: var(--bg-card); border: 1.5px solid var(--border);
    border-radius: var(--radius-sm); padding: 12px 14px;
    display: flex; flex-direction: column; gap: 4px;
}
.trait-slot { font-size: .75rem; color: var(--text-muted); font-weight: 700; text-transform: uppercase; }
.trait-value { font-weight: 800; color: var(--text); }

/* ---- Genome table ---- */
.genome-section { margin: 32px 0; }
.genome-section h2 { margin-bottom: 10px; }
.genome-section small { color: var(--text-muted); font-size: .85rem; }
.genome-details { margin-top: 8px; }
.genome-details summary { cursor: pointer; font-weight: 700; color: var(--primary); }
.genome-table-wrap { overflow-x: auto; margin-top: 12px; }
.genome-table { width: 100%; border-collapse: collapse; font-size: .85rem; }
.genome-table th, .genome-table td { padding: 8px 12px; border: 1px solid var(--border); text-align: left; }
.genome-table th { background: #f3f0ff; font-weight: 800; }
.genome-table .rare { color: var(--secondary); font-weight: 700; }

/* ---- Parents ---- */
.parents-section { margin: 32px 0; }
.parents-section h2 { margin-bottom: 14px; }
.parents-row { display: flex; gap: 20px; }
.parent-card {
    display: flex; flex-direction: column; align-items: center; gap: 6px;
    text-decoration: none; color: var(--text);
    background: var(--bg-card); border: 1.5px solid var(--border);
    border-radius: var(--radius); padding: 14px; transition: all .2s;
}
.parent-card:hover { border-color: var(--primary); text-decoration: none; }
.parent-card span { font-size: .85rem; font-weight: 700; }

/* ---- Auth ---- */
.auth-page {
    min-height: 70vh; display: flex; align-items: center; justify-content: center;
}
.auth-card {
    background: var(--bg-card); border-radius: var(--radius);
    box-shadow: var(--shadow-card); padding: 48px 40px;
    width: 100%; max-width: 420px; border: 1.5px solid var(--border);
}
.auth-logo { font-size: 3rem; text-align: center; margin-bottom: 8px; }
.auth-title { font-size: 1.8rem; font-weight: 900; text-align: center; }
.auth-sub { color: var(--text-muted); text-align: center; margin-bottom: 24px; }
.auth-form { display: flex; flex-direction: column; gap: 16px; margin-top: 20px; }
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group label { font-weight: 700; font-size: .9rem; }
.form-group input, .form-group select, .form-group textarea {
    padding: 11px 14px; border: 1.5px solid var(--border);
    border-radius: var(--radius-sm); font-family: var(--font); font-size: .95rem;
    transition: border-color .2s;
}
.form-group input:focus, .form-group select:focus {
    outline: none; border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(255,107,157,.15);
}
.form-group small { color: var(--text-muted); font-size: .78rem; }
.auth-footer { text-align: center; margin-top: 20px; color: var(--text-muted); font-size: .9rem; }

/* ---- Page header ---- */
.page-header { margin-bottom: 28px; }
.page-header h1 { font-size: 2rem; font-weight: 900; }
.page-header-meta { display: flex; align-items: center; gap: 8px; color: var(--text-muted); margin-top: 4px; }
.page-header-meta .sep { color: var(--border); }
.page-sub { color: var(--text-muted); margin-top: 6px; }

/* ---- Empty state ---- */
.empty-state {
    text-align: center; padding: 64px 24px;
}
.empty-icon { font-size: 4rem; margin-bottom: 16px; }
.empty-state h2 { font-size: 1.5rem; margin-bottom: 8px; }
.empty-state p { color: var(--text-muted); margin-bottom: 24px; }

/* ---- How it works ---- */
.how-it-works h2 { font-size: 1.8rem; font-weight: 900; text-align: center; margin-bottom: 32px; }
.steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 24px; }
.step {
    background: var(--bg-card); border-radius: var(--radius);
    padding: 28px 24px; border: 1.5px solid var(--border); text-align: center;
}
.step-icon { font-size: 2.5rem; margin-bottom: 12px; }
.step h3 { font-size: 1.15rem; font-weight: 800; margin-bottom: 8px; }
.step p { color: var(--text-muted); font-size: .9rem; }

/* ---- Breed ---- */
.breed-section { background: var(--bg-card); border-radius: var(--radius); padding: 28px; border: 1.5px solid var(--border); margin-bottom: 32px; }
.breed-section h2 { margin-bottom: 20px; }
.breed-form { display: flex; flex-direction: column; gap: 20px; }
.breed-selectors { display: grid; grid-template-columns: 1fr auto 1fr; gap: 20px; align-items: start; }
.breed-selector h3 { margin-bottom: 12px; font-size: 1rem; }
.breed-dog-list { display: flex; flex-wrap: wrap; gap: 12px; }
.breed-dog-option input[type="radio"] { display: none; }
.breed-dog-card {
    display: flex; flex-direction: column; align-items: center; gap: 4px;
    padding: 10px; border: 2px solid var(--border); border-radius: var(--radius-sm);
    cursor: pointer; transition: all .2s; font-size: .8rem;
}
.breed-dog-option input:checked + .breed-dog-card {
    border-color: var(--primary); background: #fff0f6;
}
.breed-heart { font-size: 2rem; align-self: center; }
.breed-cost { color: var(--text-muted); font-size: .9rem; }
.btn-breed-submit { max-width: 320px; }
.sire-breed-form { padding: 10px 12px; border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: 8px; }
.sire-breed-form select { padding: 7px 10px; border: 1.5px solid var(--border); border-radius: var(--radius-sm); font-family: var(--font); font-size: .85rem; width: 100%; }

/* ---- Profile ---- */
.profile-header { display: flex; align-items: center; gap: 20px; margin-bottom: 32px; }
.profile-avatar { font-size: 4rem; }
.profile-info { display: flex; flex-direction: column; gap: 6px; }
.profile-info h1 { font-size: 1.8rem; font-weight: 900; }
.profile-coins { color: var(--accent); font-weight: 800; }
.profile-joined { color: var(--text-muted); font-size: .85rem; }
.role-badge {
    display: inline-block; padding: 3px 12px; border-radius: 50px; font-weight: 800; font-size: .8rem;
}
.role-user { background: #e0e7ff; color: #3730a3; }
.role-cfo  { background: #d1fae5; color: #065f46; }
.role-coo  { background: #fef3c7; color: #92400e; }
.role-ceo  { background: #fce7f3; color: #9d174d; }

/* ---- Admin ---- */
.admin-layout { display: grid; grid-template-columns: 200px 1fr; gap: 32px; align-items: start; }
.admin-sidebar {
    background: var(--bg-card); border-radius: var(--radius);
    border: 1.5px solid var(--border); padding: 20px;
    display: flex; flex-direction: column; gap: 6px; position: sticky; top: 80px;
}
.admin-sidebar h3 { font-size: 1rem; color: var(--text-muted); margin-bottom: 8px; }
.admin-sidebar a {
    padding: 9px 14px; border-radius: var(--radius-sm);
    color: var(--text); font-weight: 700; text-decoration: none;
    transition: background .2s;
}
.admin-sidebar a:hover, .admin-sidebar a.active { background: #f3f0ff; color: var(--primary); }
.admin-main h1 { margin-bottom: 24px; }
.admin-main h2 { margin: 24px 0 14px; }
.admin-card {
    background: var(--bg-card); border-radius: var(--radius);
    border: 1.5px solid var(--border); padding: 24px; margin-bottom: 24px;
}
.admin-card h2 { margin-top: 0; }
.admin-card .hint { color: var(--text-muted); font-size: .88rem; margin-bottom: 16px; }
.stats-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; margin-bottom: 32px; }
.stats-card {
    background: linear-gradient(135deg, var(--bg-dark), #4c1d95);
    border-radius: var(--radius); padding: 20px; color: white; text-align: center;
}
.stats-card-value { display: block; font-size: 1.8rem; font-weight: 900; color: var(--accent); }
.stats-card-label { font-size: .82rem; color: rgba(255,255,255,.7); }
.settings-form { display: flex; flex-direction: column; gap: 16px; }
.form-row { display: flex; gap: 16px; flex-wrap: wrap; }
.form-row .form-group { flex: 1; min-width: 180px; }

/* ---- Data table ---- */
.data-table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.data-table th, .data-table td { padding: 10px 14px; border: 1px solid var(--border); text-align: left; }
.data-table th { background: #f3f0ff; font-weight: 800; }
.data-table tr:hover td { background: #fdf9ff; }
.tx-income td { color: #065f46; }
.tx-expense td { color: #991b1b; }

/* ---- Error pages ---- */
.error-page { text-align: center; padding: 80px 24px; }
.error-icon { font-size: 5rem; margin-bottom: 16px; }
.error-page h1 { font-size: 5rem; font-weight: 900; color: var(--primary); }
.error-page p { color: var(--text-muted); font-size: 1.1rem; margin: 12px 0 28px; }

/* ---- Footer ---- */
.site-footer {
    background: var(--bg-dark); color: rgba(255,255,255,.6);
    padding: 20px 24px; font-size: .85rem;
}
.footer-inner {
    max-width: 1280px; margin: 0 auto;
    display: flex; align-items: center; gap: 12px;
}
.footer-inner a { color: rgba(255,255,255,.7); }
.footer-inner a:hover { color: white; }
.footer-sep { opacity: .3; }

/* ---- SVG Dog Renderer ---- */
.dog-svg-wrap {
    position: relative;
    display: inline-block;
    flex-shrink: 0;
}
.dog-svg-layer {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    pointer-events: none;
}
.dog-svg-layer svg {
    width: 100%; height: 100%;
}
/* Container for dog-card-art with SVG dog */
.dog-card-art .dog-svg-wrap {
    width: 100%; height: 100%;
    min-height: 160px;
}

/* ---- Toast notifications ---- */
.toast {
    position: fixed; bottom: 28px; left: 50%; transform: translateX(-50%) translateY(20px);
    background: var(--bg-dark); color: white;
    padding: 12px 28px; border-radius: 50px;
    font-weight: 700; font-size: .95rem;
    opacity: 0; transition: opacity .3s, transform .3s;
    z-index: 9999; box-shadow: 0 4px 20px rgba(0,0,0,.3);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast-warning { background: #92400e; }
.toast-error   { background: #991b1b; }
.toast-success { background: #065f46; }

/* ---- Responsive ---- */
@media (max-width: 900px) {
    .dog-page { grid-template-columns: 1fr; }
    .hero { flex-direction: column; text-align: center; padding: 40px 0; }
    .hero-cta { justify-content: center; }
    .hero-dog { display: none; }
    .admin-layout { grid-template-columns: 1fr; }
    .admin-sidebar { position: static; display: flex; flex-direction: row; flex-wrap: wrap; }
    .breed-selectors { grid-template-columns: 1fr; }
    .breed-heart { display: none; }
}
@media (max-width: 600px) {
    .navbar-inner { flex-wrap: wrap; height: auto; padding: 10px; }
    .dog-grid { grid-template-columns: repeat(2, 1fr); }
    .auth-card { padding: 32px 20px; }
    .stats-bar { padding: 16px; }
    .stat-value { font-size: 1.4rem; }
}
