/* =========================================
   BASE CONTAINERS & CSS FIXES
   ========================================= */
.dashboard-container {
    max-width: 1400px !important;
    width: 95% !important;
    margin: 0 auto;
    padding: 40px 0;
}

/* FIX: Ensure padding and borders don't expand elements past 100% width on mobile */
.dashboard-container *, .dashboard-container *:before, .dashboard-container *:after {
    box-sizing: border-box;
}

.auth-panel {
    text-align: left;
    background: var(--glass-bg, rgba(15, 23, 42, 0.6));
    border: 1px solid var(--glass-border, rgba(255, 255, 255, 0.1));
    border-radius: 24px;
    padding: 40px;
    box-shadow: var(--glass-shadow, 0 8px 32px rgba(0, 0, 0, 0.3));
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
}

.auth-panel h2 {
    font-family: 'Outfit', sans-serif;
    font-size: 1.8rem;
    color: #f8fafc;
    margin-bottom: 15px;
}

.auth-panel p {
    color: #94a3b8;
    font-size: 0.95rem;
    line-height: 1.6;
    margin-bottom: 30px;
}

/* =========================================
   BUTTONS
   ========================================= */
.google-btn {
    display: inline-block;
    background: #f8fafc;
    color: #0f172a;
    font-family: 'Outfit', sans-serif;
    font-weight: 700;
    font-size: 1.1rem;
    padding: 16px 32px;
    border-radius: 50px;
    text-decoration: none;
    width: 100%;
    text-align: center;
}

.action-btn {
    background: linear-gradient(135deg, #38bdf8 0%, #06b6d4 100%);
    color: #060c18;
    font-family: 'Outfit', sans-serif;
    font-weight: 800;
    padding: 12px 24px;
    border-radius: 12px;
    text-decoration: none;
    font-size: 1rem;
    box-shadow: 0 4px 15px rgba(6, 182, 212, 0.3);
}

.submit-btn {
    width: 100%;
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: #f8fafc;
    border: none;
    padding: 18px;
    border-radius: 50px;
    font-family: 'Outfit', sans-serif;
    font-weight: 800;
    font-size: 1.15rem;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.3);
    transition: all 0.3s ease;
    margin-top: 10px;
}

.submit-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(16, 185, 129, 0.5);
}

/* =========================================
   FORMS & INPUTS
   ========================================= */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: #cbd5e1;
    font-size: 0.95rem;
    font-weight: 600;
}

.form-control {
    width: 100%;
    padding: 14px 15px;
    background: rgba(15, 23, 42, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    color: #f8fafc;
    font-family: 'Inter', sans-serif;
    font-size: 1rem;
    outline: none;
    transition: border 0.3s;
}

.form-control:focus {
    border-color: #06b6d4;
}

.form-row {
    display: flex;
    gap: 15px;
    flex-wrap: wrap; /* FIX: Allows fields to stack on mobile */
}

.form-row .form-group {
    flex: 1;
    min-width: 200px; /* FIX: Triggers wrapping when too narrow */
}

/* =========================================
   TOGGLES & CHECKBOXES
   ========================================= */
.blank-toggle {
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(244, 63, 94, 0.1);
    border: 1px solid rgba(244, 63, 94, 0.3);
    padding: 18px;
    border-radius: 12px;
    margin-bottom: 25px;
    cursor: pointer;
    transition: background 0.3s;
}

.blank-toggle:hover {
    background: rgba(244, 63, 94, 0.15);
}

.blank-toggle input {
    width: 22px;
    height: 22px;
    cursor: pointer;
    accent-color: #f43f5e;
}

.blank-toggle span {
    color: #f43f5e;
    font-weight: 700;
    font-size: 1.05rem;
}

.toggle-group {
    display: flex;
    background: rgba(0,0,0,0.3);
    border-radius: 12px;
    padding: 5px;
}

.toggle-btn {
    flex: 1;
    text-align: center;
    padding: 10px;
    border-radius: 8px;
    cursor: pointer;
    font-family: 'Outfit', sans-serif;
    font-weight: 600;
    color: #94a3b8;
    transition: all 0.3s ease;
}

.toggle-btn.active-mode {
    background: rgba(6, 182, 212, 0.2);
    color: #06b6d4;
}

/* =========================================
   DASHBOARD HERO & STATS
   ========================================= */
.back-nav {
    display: flex;
    align-items: center;
    margin-bottom: 30px;
}

.back-nav a {
    color: #06b6d4;
    text-decoration: none;
    font-weight: 600;
    font-size: 1rem;
    margin-right: 15px;
    display: flex;
    align-items: center;
    gap: 5px;
}

.back-nav a:hover {
    color: #22d3ee;
}

.back-nav h2 {
    margin: 0;
    font-family: 'Outfit', sans-serif;
    font-size: 2rem;
    color: #f8fafc;
}

.hero-card {
    background: linear-gradient(135deg, rgba(30, 41, 59, 0.9) 0%, rgba(15, 23, 42, 0.9) 100%);
    border: 1px solid #06b6d4;
    border-radius: 20px;
    padding: 25px;
    margin-bottom: 20px;
    box-shadow: 0 10px 30px rgba(6, 182, 212, 0.15);
}

.hero-header {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 20px;
}

.profile-pic {
    width: 60px;
    height: 60px;
    background: #1e293b;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    border: 2px solid #38bdf8;
}

.hero-card h1 {
    font-family: 'Outfit', sans-serif;
    color: #f8fafc;
    margin: 0 0 5px 0;
    font-size: 1.5rem;
}

.rank-badge {
    display: inline-block;
    background: rgba(16, 185, 129, 0.2);
    color: #34d399;
    border: 1px solid rgba(16, 185, 129, 0.4);
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.points-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.points-val {
    font-family: 'Outfit', sans-serif;
    font-size: 1.5rem;
    font-weight: 800;
    color: #06b6d4;
}

.progress-bar-bg {
    background: rgba(255, 255, 255, 0.05);
    height: 8px;
    border-radius: 4px;
    overflow: hidden;
    position: relative;
}

.progress-bar-fill {
    background: linear-gradient(90deg, #06b6d4 0%, #34d399 100%);
    height: 100%;
    border-radius: 4px;
    transition: width 1s cubic-bezier(0.4, 0, 0.2, 1);
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(90px, 1fr));
    gap: 10px;
    margin-bottom: 20px;
}

.stat-card {
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 16px;
    padding: 15px 10px;
    text-align: center;
}

.stat-icon {
    font-size: 1.5rem;
    margin-bottom: 5px;
}

.stat-val {
    font-family: 'Outfit', sans-serif;
    font-size: 1.4rem;
    font-weight: 700;
    color: #f8fafc;
}

.stat-label {
    font-size: 0.65rem;
    color: #94a3b8;
    text-transform: uppercase;
    margin-top: 2px;
}

/* =========================================
   CHARTS & PERSONAL BESTS
   ========================================= */
.chart-card, .pb-card {
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 20px;
    padding: 20px;
    margin-bottom: 20px;
    overflow: hidden; /* FIX: Contains floating/flex issues */
}

.card-title {
    font-family: 'Outfit', sans-serif;
    color: #f8fafc;
    font-size: 1.1rem;
    margin: 0 0 15px 0;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    padding-bottom: 10px;
}

/* FIX: Absolute positioning detaches the canvas from the Flexbox calculation */
.chart-wrapper {
    position: relative;
    height: 250px;
    width: 100%;
}
canvas#speciesChart {
    position: absolute;
    left: 0;
    top: 0;
    width: 100% !important;
    height: 100% !important;
}

.pb-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.pb-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(30, 41, 59, 0.5);
    padding: 12px 15px;
    border-radius: 12px;
}

.pb-species {
    font-family: 'Outfit', sans-serif;
    font-weight: 700;
    color: #cbd5e1;
}

.pb-weight {
    color: #f59e0b;
    font-weight: 800;
    font-size: 1.1rem;
}

/* =========================================
   CATCH BUILDER & KEEPNET
   ========================================= */
.catch-builder {
    background: rgba(0,0,0,0.15);
    border: 1px solid rgba(255,255,255,0.05);
    border-radius: 16px;
    padding: 20px;
    margin-bottom: 20px;
}

.species-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 10px;
}

.species-btn {
    background: rgba(30, 41, 59, 0.5);
    border: 1px solid rgba(255,255,255,0.1);
    padding: 10px;
    border-radius: 10px;
    cursor: pointer;
    font-size: 0.85rem;
    color: #cbd5e1;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s ease;
}

.species-btn:hover {
    background: rgba(51, 65, 85, 0.8);
}

.species-btn.selected {
    background: rgba(15, 23, 42, 0.9);
    font-weight: 700;
    color: #f8fafc;
}

.species-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

.custom-slider {
    -webkit-appearance: none;
    width: 100%;
    height: 6px;
    background: rgba(255,255,255,0.1);
    border-radius: 5px;
    outline: none;
    margin-top: 10px;
}

.custom-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #06b6d4;
    cursor: pointer;
    border: 2px solid #f8fafc;
}

.add-fish-btn {
    width: 100%;
    background: rgba(6, 182, 212, 0.15);
    border: 1px dashed #06b6d4;
    color: #06b6d4;
    padding: 12px;
    border-radius: 12px;
    font-family: 'Outfit', sans-serif;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-top: 15px;
}

.add-fish-btn:not([disabled]):hover {
    background: #06b6d4;
    color: #060c18;
}

.add-fish-btn[disabled] {
    opacity: 0.5;
    cursor: not-allowed;
    border-color: rgba(255,255,255,0.2);
    color: #94a3b8;
}

.keepnet-panel {
    background: rgba(15, 23, 42, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 16px;
    padding: 20px;
}

.keepnet-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.basket-badge {
    background: rgba(16, 185, 129, 0.2);
    color: #34d399;
    font-size: 0.8rem;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 12px;
}

.empty-basket {
    text-align: center;
    color: #64748b;
    font-size: 0.9rem;
    padding: 20px 0;
}

.fish-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(0,0,0,0.2);
    padding: 12px 15px;
    border-radius: 12px;
    margin-bottom: 8px;
    border: 1px solid rgba(255,255,255,0.03);
}

.fish-details {
    display: flex;
    align-items: center;
    gap: 12px;
}

.fish-name {
    font-weight: 700;
    color: #f8fafc;
    margin-bottom: 2px;
}

.fish-stats {
    font-size: 0.8rem;
    color: #94a3b8;
}

.remove-fish {
    background: rgba(244, 63, 94, 0.1);
    color: #f43f5e;
    border: none;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.remove-fish:hover {
    background: rgba(244, 63, 94, 0.2);
}

/* =========================================
   TAGS
   ========================================= */
.tags-container {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.tag-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #cbd5e1;
    padding: 8px 14px;
    border-radius: 20px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.tag-btn.selected {
    background: rgba(6, 182, 212, 0.2);
    border-color: #06b6d4;
    color: #06b6d4;
}

/* =========================================
   DASHBOARD GRID
   ========================================= */
.dashboard-grid-layout {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
    margin-top: 20px;
}

@media (min-width: 1024px) {
    .dashboard-grid-layout {
        grid-template-columns: 320px minmax(0, 1fr);
    }
}

.dashboard-sidebar-column {
    display: flex;
    flex-direction: column;
    gap: 20px;
    min-width: 0;
}

.dashboard-main-column {
    display: flex;
    flex-direction: column;
    gap: 20px;
    min-width: 0;
}

/* Widget Styles */
.widget-card {
    background: #1e293b;
    border-radius: 12px;
    padding: 24px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    position: relative;
    min-width: 0;
    max-width: 100%;
    overflow: hidden; /* Keeps overlay blur inside */
}

/* Prediction Disclaimer Widget Overlay Styles */
.widget-overlay {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(15, 23, 42, 0.65);
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    transition: opacity 0.3s ease;
}
.widget-overlay.hidden {
    display: none;
    opacity: 0;
    pointer-events: none;
}
.overlay-content {
    background: #1e293b;
    border: 1px solid #06b6d4;
    padding: 25px 20px;
    border-radius: 12px;
    max-width: 400px;
    text-align: center;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
}
.overlay-btn {
    background: linear-gradient(135deg, #38bdf8 0%, #06b6d4 100%);
    color: #060c18;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    font-family: 'Outfit', sans-serif;
    font-weight: 800;
    font-size: 1rem;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    width: 100%;
}
.overlay-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(6, 182, 212, 0.3);
}

.widget-delete-btn {
    position: absolute;
    top: 15px;
    right: 15px;
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.2);
    border-radius: 6px;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.2rem;
    transition: all 0.2s;
    z-index: 51; /* Keep above overlay */
}

.widget-delete-btn:hover {
    background: #ef4444;
    color: #fff;
}

.widget-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
    border-bottom: 1px dashed rgba(255, 255, 255, 0.1);
    padding-bottom: 15px;
    margin-bottom: 20px;
    padding-right: 40px;
}

.widget-controls {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    flex-grow: 1;
}

.widget-select {
    background: #0f172a;
    color: #f8fafc;
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 8px 16px;
    border-radius: 8px;
    font-family: 'Outfit', sans-serif;
    outline: none;
    flex-grow: 1;
    min-width: 150px;
    max-width: 100%;
}

/* Region Picker UI */
.region-picker-msg {
    text-align: center;
    color: #94a3b8;
    margin-bottom: 20px;
    font-size: 1.05rem;
}

.region-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
}

.region-btn {
    background: #0f172a;
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 10px;
    padding: 30px 15px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    color: #f8fafc;
    font-family: 'Outfit', sans-serif;
}

.region-btn:hover {
    border-color: #06b6d4;
    background: rgba(6, 182, 212, 0.05);
    transform: translateY(-3px);
}

.region-btn .icon {
    font-size: 2.5rem;
    display: block;
    margin-bottom: 10px;
}

/* Timeline UI */
.timeline-column-grid {
    display: flex;
    flex-wrap: nowrap;
    gap: 12px;
    overflow-x: auto;
    padding-bottom: 12px;
    width: 100%;
    -webkit-overflow-scrolling: touch;
}

.timeline-column-grid::-webkit-scrollbar { height: 6px; }
.timeline-column-grid::-webkit-scrollbar-track { background: rgba(255, 255, 255, 0.05); border-radius: 10px; }
.timeline-column-grid::-webkit-scrollbar-thumb { background: rgba(6, 182, 212, 0.4); border-radius: 10px; }
.timeline-column-grid::-webkit-scrollbar-thumb:hover { background: rgba(6, 182, 212, 0.8); }

.timeline-day-column {
    flex: 1 0 130px;
    background: rgba(15, 23, 42, 0.4);
    border-radius: 10px;
    padding: 12px;
    border: 1px solid rgba(255, 255, 255, 0.02);
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.timeline-day-title {
    font-family: 'Outfit', sans-serif;
    font-size: 0.9rem;
    color: #94a3b8;
    text-align: center;
    margin: 0;
    padding-bottom: 6px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.timeline-item-card {
    background: #0f172a;
    border-radius: 8px;
    padding: 12px;
    border-left: 4px solid #64748b;
    cursor: pointer;
    transition: transform 0.15s ease;
}

.timeline-item-card:hover {
    transform: translateY(-2px);
}

.timeline-struct-name {
    font-size: 0.75rem;
    color: #cbd5e1;
    font-weight: 600;
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.timeline-prob-value {
    font-size: 1.2rem;
    font-weight: 700;
    margin-top: 4px;
    display: block;
}

.timeline-rating-badge {
    font-size: 0.65rem;
    font-weight: 800;
    padding: 2px 6px;
    border-radius: 4px;
    display: inline-block;
    margin-top: 6px;
}

.expanded-details-drawer {
    background: #0f172a;
    border-radius: 8px;
    padding: 16px;
    margin-top: 15px;
    border: 1px solid rgba(6, 182, 212, 0.2);
    display: none;
}

.add-widget-btn {
    background: transparent;
    border: 2px dashed rgba(255,255,255,0.2);
    color: #94a3b8;
    width: 100%;
    padding: 20px;
    border-radius: 12px;
    font-size: 1.1rem;
    font-family: 'Outfit', sans-serif;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.add-widget-btn:hover {
    border-color: #06b6d4;
    color: #06b6d4;
    background: rgba(6, 182, 212, 0.05);
}

/* Leaderboard Tabs */
.lb-tabs {
    display: flex;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    margin-bottom: 20px;
    overflow-x: auto;
}

.lb-tab {
    padding: 10px 15px;
    color: #94a3b8;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    white-space: nowrap;
}

.lb-tab.active {
    color: #06b6d4;
    border-bottom-color: #06b6d4;
    font-weight: 600;
}