﻿:root {
    --brand-blue: #0082c9;
    --brand-orange: #f37021;

    /* Light Theme Defaults */
    --bg-primary: #ffffff;
    --bg-secondary: #f4f6f9;
    --bg-card: #ffffff;

    --text-primary: #212529;
    --text-secondary: #6c757d;
    --text-muted: #6c757d;

    --border-color: #dee2e6;
    --input-bg: #ffffff;
    --input-border: #ced4da;

    --admin-sidebar-bg: linear-gradient(180deg, var(--brand-blue) 0%, var(--brand-orange) 100%);
    --admin-sidebar-text: #c2c7d0;
}

[data-theme="dark"] {
    /* Dark Theme Overrides */
    --bg-primary: #121212;
    --bg-secondary: #1e1e1e;
    --bg-card: #2d2d2d;

    --text-primary: #e0e0e0;
    --text-secondary: #b0b0b0;
    --text-muted: #9e9e9e;

    --border-color: #444;
    --input-bg: #333;
    --input-border: #555;

    /* Keep brand gradient or darken it? Making it slightly darker for better contrast if needed, 
       but for now keeping brand identity strong */
}

[data-theme="dark"] {
    color-scheme: dark;
}

html,
body {
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
    background-color: var(--bg-secondary);
    color: var(--text-primary);
}

.top-row-background{
    background-color: var(--bg-primary) !important;
}

a,
.btn-link {
    color: var(--brand-blue);
}

.btn-primary {
    color: #fff;
    background-color: var(--brand-blue);
    border-color: var(--brand-blue);
    font-weight: 600;
}

.btn-primary:hover {
    background-color: #006bb7;
    border-color: #006bb7;
}

.text-brand-blue {
    color: var(--brand-blue) !important;
}

.text-brand-orange {
    color: var(--brand-orange) !important;
}

.text-muted {
    color: var(--text-muted) !important;
}


.btn:focus,
.btn:active:focus,
.btn-link.nav-link:focus,
.form-control:focus,
.form-check-input:focus {
    box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #258cfb;
}

.content {
    padding-top: 1.1rem;
}

h1:focus {
    outline: none;
}

.valid.modified:not([type=checkbox]) {
    outline: 1px solid #26b050;
}

.invalid {
    outline: 1px solid #e50000;
}

.validation-message {
    color: #e50000;
}

.blazor-error-boundary {
    background: url(data:image/svg+xml;base64,PHN2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S44NjA4IDI1OS4zNzEgNzAuMDg4N0wyNjEuNzk1IDg0LjAxNjEgMjY1LjM4IDg0LjAxNjEgMjY3LjgyMSA2OS43NDc1QzI2Ny44NiA2OS43MzA5IDI2Ny44NzkgNjkuNTg3NyAyNjcuODc9IDY5LjMxNzkgMjY3Ljg3OSA2Ny4xMTgyIDI2Ni40NDggNjYuMDE4MyAyNjMuNTg2IDY2LjAxODNaTTI2My41NzYgODYuMDU0N0MyNjEuMDQ5IDg2LjA1NDcgMjU5Ljc4NiA4Ny4zMDA1IDI1OS43ODYgODkuNzkyMSAyNTkuNzg2IDkyLjI4MzcgMjYxLjA0OSA5My41Mjk1IDI2My41NzYgOTMuNTI5NSAyNjYuMTE2IDkzLjUyOTUgMjY3LjM4NyA5Mi4yODM3IDI2Ny4zODcgODkuNzkyMSAyNjcuMzg3IDg3LjMwMDUgMjY2LjExNiA4Ni4wNTQ3IDI2My41NzYgODYuMDU0N1oiIGZpbGw9IiNGRkU1MDAiIGZpbGwtcnVsZT0iZXZlbm9kZCIvPjwvZz48L3N2Zz4=) no-repeat 1rem/1.8rem, #b32121;
    padding: 1rem 1rem 1rem 3.7rem;
    color: white;
}

.blazor-error-boundary::after {
    content: "An error has occurred."
}

.darker-border-checkbox.form-check-input {
    border-color: #929292;
}

.bold {
    font-weight: bold;
}

/* Login page css */
.auth-shell {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 1.5rem;
}

/* Password toggles */
.pw-wrap {
    position: relative;
    display: inline-block;
    width: 100%;
    max-width: 420px;
    /* optional */
}

.pw-input {
    width: 100%;
    padding-right: 4.5rem;
    /* space for the button */
}

.pw-btn {
    position: absolute;
    right: .5rem;
    top: 50%;
    transform: translateY(-50%);
    padding: .25rem .5rem;
    font-size: .9rem;
}


/*Drill sheet*/
.drill-sheet-container {
    position: relative;
    width: 860px;
    height: 1160px;
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    margin: 0 auto;
    font-family: 'Arial', sans-serif;
    color: var(--text-primary);
    background-image: radial-gradient(color-mix(in srgb, var(--text-muted) 35%, transparent) 1px, transparent 1px);
    background-size: 22px 22px;
    border-radius: 0.35rem;
}

/* Common Input Style */
.drill-input-box {
    position: absolute;
    width: 90px;
    background: var(--bg-card);
    border: 1px solid var(--input-border);
    border-radius: 0.35rem;
    padding: 5px 6px;
    text-align: center;
    z-index: 10;
}

.drill-input-box label {
    display: block;
    font-size: 0.7rem;
    font-weight: bold;
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-primary);
}

.drill-input-box input {
    width: 100%;
    border: none;
    text-align: center;
    font-weight: bold;
    padding: 4px 6px;
    line-height: 1.2;
    border-radius: 0.25rem;
    color: var(--text-primary);
    background: transparent;
}

.drill-input-box input:focus {
    outline: none;
    background: var(--input-bg);
}

/* Holes */
.hole {
    position: absolute;
    border: 3px solid var(--input-border);
    border-radius: 50%;
    background: color-mix(in srgb, var(--bg-secondary) 75%, transparent);
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Finger Holes */
.hole.finger {
    width: 164px;
    height: 164px;
    top: 168px;
}

.hole.finger.left {
    left: 120px;
    justify-content: center;
    flex-direction: column;
    gap: 0.45rem;
}

.hole.finger.right {
    right: 120px;
    justify-content: center;
    flex-direction: column;
    gap: 0.45rem;
}

/* Thumb Hole */
.hole.thumb {
    width: 216px;
    height: 216px;
    bottom: 340px;
    left: 50%;
    transform: translateX(-50%);
    justify-content: center;
    flex-direction: column;
    gap: 0.45rem;
}

/* Spans Lines */
.span-line {
    position: absolute;
    height: 2px;
    background: var(--input-border);
    transform-origin: top center;
    width: 340px;
    z-index: 1;
}

.span-line.left {
    top: 480px;
    left: 112px;
    transform: rotate(65deg);
}

.span-line.right {
    top: 480px;
    right: 112px;
    transform: rotate(-65deg);
}

/* Bridge */
.bridge-box {
    position: absolute;
    top: 220px;
    left: 50%;
    transform: translateX(-50%);
    width: 104px;
}

/* Arrows helper */
.arrow-up::before {
    content: '↑';
    display: block;
    font-size: 1.2rem;
    line-height: 10px;
}

.arrow-down::after {
    content: '↓';
    display: block;
    font-size: 1.2rem;
    line-height: 10px;
}

.arrow-left::before {
    content: '←';
    display: inline-block;
    margin-right: 5px;
}

.arrow-right::before {
    content: '→';
    display: inline-block;
    margin-left: 5px;
}


/* Specific Inputs Positioning */

/* LEFT FINGER Cluster */
.left-finger h4 {
    position: absolute;
    top: 110px;
    left: 180px;
    margin: 0;
}

.input-left-reverse {
    top: 85px;
    left: 155px;
}

.input-left-lateral {
    top: 200px;
    left: 20px;
}

.input-left-forward {
    top: 340px;
    left: 155px;
}

/* RIGHT FINGER Cluster */
.right-finger h4 {
    position: absolute;
    top: 110px;
    right: 180px;
    margin: 0;
}

.input-right-reverse {
    top: 85px;
    right: 155px;
}

.input-right-lateral {
    top: 200px;
    right: 20px;
}

.input-right-forward {
    top: 340px;
    right: 155px;
}


/* THUMB Cluster */
.thumb h4 {
    position: absolute;
    bottom: 350px;
    left: 50%;
    transform: translateX(-50%);
    margin: 0;
}

.input-thumb-forward {
    bottom: 565px;
    left: 50%;
    transform: translateX(-50%);
}

/* Actually "Forward" for thumb is often "Up" visually in diagrams, but let's stick to standard flow */
.input-thumb-reverse {
    bottom: 250px;
    left: 50%;
    transform: translateX(-50%);
}

.input-thumb-lateral-left {
    bottom: 420px;
    left: 220px;
}

.input-thumb-lateral-right {
    bottom: 420px;
    right: 220px;
}


/* Spans on lines */
.input-span-left {
    top: 444px;
    left: 266px;
}

.input-span-right {
    top: 444px;
    right: 266px;
}


/* Sizes / Extras tables at bottom */
.extras-panel {
    position: absolute;
    bottom: 24px;
    left: 24px;
    right: 24px;
    display: flex;
    justify-content: space-between;
    gap: 16px;
}

.extras-box {
    border: 1px solid var(--input-border);
    border-radius: 0.35rem;
    padding: 12px 14px;
    flex: 1;
    background: var(--bg-card);
}

.drillsheet-upsert-page .page-header {
    margin-bottom: 1.25rem;
}

.drillsheet-actions {
    gap: 0.75rem !important;
}

.drill-sheet-card {
    overflow-x: auto;
    padding: 1.25rem;
}

.drill-sheet-header-fields {
    position: absolute;
    top: 24px;
    left: 24px;
    right: 24px;
    display: flex;
    gap: 24px;
    align-items: end;
}

.drill-sheet-header-fields label {
    display: block;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    margin-bottom: 0.35rem;
}

.drill-sheet-name-field {
    flex: 2;
}

.drill-sheet-grip-field {
    flex: 1;
}

.drill-sheet-playstyle-field {
    flex: 1;
}

/* =========================
   ADMIN THEME
   ========================= */

/* Layout & Containers */
.admin-shell {
    display: flex;
    min-height: 100vh;
    background-color: var(--bg-secondary);
}

.admin-sidebar {
    width: 260px;
    background-image: var(--admin-sidebar-bg);
    /* Dark sidebar */
    color: var(--admin-sidebar-text);
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    padding: 1.5rem 0;
    box-shadow: 2px 0 5px rgba(0, 0, 0, 0.1);
}

.admin-sidebar h4 {
    color: #fff;
    padding: 0 1.5rem;
    margin-bottom: 2rem;
    font-size: 1.25rem;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.app-sidebar-logo {
    padding: 0.25rem 1rem 0 1rem;
    margin-bottom: 1rem;
    display: flex;
    justify-content: center;
}

.app-sidebar-logo img {
    width: 160px;
    max-width: 100%;
    height: auto;
}

.admin-nav {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.admin-nav-link {
    display: block;
    padding: 0.75rem 1.5rem;
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    transition: all 0.2s ease-in-out;
    border-radius: 4px;
    margin: 0 0.5rem;
    /* Add some spacing to sides like navmenu items often have implicitly */
}

.admin-nav-link:hover {
    background-color: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.admin-nav-link.active {
    background-color: rgba(255, 255, 255, 0.37);
    color: #fff;
}

.admin-content {
    flex-grow: 1;
    padding: 2rem;
    overflow-y: auto;
}

.admin-container {
    max-width: 1200px;
    margin: 0 auto;
}

/* Cards */
.admin-card {
    background: var(--bg-card);
    border-radius: 0.5rem;
    box-shadow: 0 0 1px rgba(0, 0, 0, .125), 0 1px 3px rgba(0, 0, 0, .2);
    padding: 1.5rem;
    margin-bottom: 2rem;
    border-top: 3px solid var(--brand-blue);
    /* Top accent */
}

.admin-card h4 {
    margin-top: 0;
    margin-bottom: 1.5rem;
    color: var(--text-primary);
    font-weight: 600;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.75rem;
}

/* Page Headers */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.page-header h3 {
    margin: 0;
    color: var(--text-primary);
    font-weight: 700;
}

/* Tables */
.admin-table {
    width: 100%;
    margin-bottom: 1rem;
    background-color: transparent;
    border-collapse: collapse;
}

.admin-table th,
.admin-table td {
    padding: 0.75rem;
    vertical-align: top;
    border-top: 1px solid var(--border-color);
    text-align: left;
    color: var(--text-primary);
}

.admin-table thead th {
    vertical-align: bottom;
    border-bottom: 2px solid var(--border-color);
    background-color: var(--bg-secondary);
    color: var(--text-secondary);
    font-weight: 600;
}

.admin-table tbody tr:hover {
    background-color: rgba(0, 0, 0, .025);
}

[data-theme="dark"] .admin-table tbody tr:hover {
    background-color: rgba(255, 255, 255, .05);
}


/* Forms */
.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: inline-block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.form-control,
.form-select,
.input-group-text,
.admin-card input[type="text"],
.admin-card input[type="email"],
.admin-card input[type="password"],
.admin-card select {
    display: block;
    width: 100%;
    padding: 0.375rem 0.75rem;
    font-size: 1rem;
    line-height: 1.5;
    color: var(--text-primary);
    background-color: var(--input-bg);
    background-clip: padding-box;
    border: 1px solid var(--input-border);
    border-radius: 0.25rem;
    transition: border-color .15s ease-in-out, box-shadow .15s ease-in-out;
}

.form-control:focus,
.admin-card input:focus,
.admin-card select:focus {
    border-color: #80bdff;
    outline: 0;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, .25);
}

/* Buttons */
.btn-admin-primary {
    color: #fff;
    background-color: #007bff;
    border-color: #007bff;
    display: inline-block;
    font-weight: 400;
    text-align: center;
    vertical-align: middle;
    user-select: none;
    border: 1px solid transparent;
    padding: 0.375rem 0.75rem;
    font-size: 1rem;
    line-height: 1.5;
    border-radius: 0.25rem;
    cursor: pointer;
    transition: color .15s ease-in-out, background-color .15s ease-in-out, border-color .15s ease-in-out, box-shadow .15s ease-in-out;
}

.btn-admin-primary:hover {
    background-color: #0069d9;
    border-color: #0062cc;
}

.btn-admin-secondary {
    color: #fff;
    background-color: #6c757d;
    border-color: #6c757d;
    display: inline-block;
    font-weight: 400;
    text-align: center;
    vertical-align: middle;
    user-select: none;
    border: 1px solid transparent;
    padding: 0.375rem 0.75rem;
    font-size: 1rem;
    line-height: 1.5;
    border-radius: 0.25rem;
    cursor: pointer;
    margin-left: 0.25rem;
}

.btn-admin-secondary:hover {
    background-color: #5a6268;
    border-color: #545b62;
}

.btn-sm {
    padding: 0.25rem 0.5rem;
    font-size: 0.875rem;
    line-height: 1.5;
    border-radius: 0.2rem;
}

.text-danger {
    color: #dc3545 !important;
}

.admin-mobile-header,
.admin-sidebar-backdrop,
.admin-mobile-toggle {
    display: none;
}

/* Customer list controls */
.customer-list-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.85rem;
    align-items: end;
    margin-bottom: 1.5rem;
}

.customer-search-input {
    max-width: 440px;
}

.customer-page-size-wrap {
    display: flex;
    align-items: center;
    gap: 0.55rem;
}

.customer-page-size-select {
    width: 92px;
}

.customer-pagination-wrap {
    margin-top: 1.5rem;
    display: flex;
    justify-content: center;
}

.customer-pagination-meta {
    margin-top: 0.75rem;
    color: var(--text-muted);
    text-align: center;
    font-size: 0.92rem;
}

/* Pagination theming */
.admin-pagination .page-link {
    border-color: var(--input-border);
    background: var(--input-bg);
    color: var(--text-primary);
}

.admin-pagination .page-link:hover {
    background: color-mix(in srgb, var(--brand-blue) 12%, var(--input-bg));
    color: var(--text-primary);
}

.admin-pagination .page-item.active .page-link {
    background: var(--brand-blue);
    border-color: var(--brand-blue);
    color: #fff;
}

.admin-pagination .page-item.disabled .page-link {
    background: color-mix(in srgb, var(--input-bg) 85%, transparent);
    color: var(--text-muted);
}

@media (max-width: 992px) {
    .admin-shell {
        display: block;
        min-height: 100vh;
    }

    .admin-mobile-header {
        display: flex;
        align-items: center;
        gap: 0.75rem;
        position: sticky;
        top: 0;
        z-index: 1045;
        padding: 0.5rem 0.75rem;
        background: var(--bg-card);
        border-bottom: 1px solid var(--border-color);
    }

    .admin-mobile-toggle {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 2rem;
        height: 2rem;
        border-radius: 0.35rem;
        border: 1px solid var(--input-border);
        background: var(--input-bg);
        color: var(--text-primary);
    }

    .admin-mobile-logo {
        width: 120px;
        max-width: 100%;
        height: auto;
    }

    .admin-sidebar {
        position: fixed;
        inset: 0 auto 0 0;
        width: min(78vw, 280px);
        max-width: 280px;
        z-index: 1060;
        transform: translateX(-105%);
        transition: transform 0.22s ease;
        box-shadow: 8px 0 22px rgba(0, 0, 0, 0.25);
    }

    .admin-nav {
        flex-direction: column;
        gap: 0.3rem;
        padding: 0 0.6rem;
    }

    .admin-nav-link {
        margin: 0;
        padding: 0.65rem 0.9rem;
    }

    .admin-shell.sidebar-open .admin-sidebar {
        transform: translateX(0);
    }

    .admin-sidebar-backdrop {
        display: block;
        position: fixed;
        inset: 0;
        z-index: 1050;
        background: rgba(0, 0, 0, 0.45);
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.2s ease;
    }

    .admin-shell.sidebar-open .admin-sidebar-backdrop {
        opacity: 1;
        pointer-events: auto;
    }

    .admin-content {
        padding: 1rem;
    }

    .page-header {
        flex-wrap: wrap;
        gap: 0.75rem;
    }

    .customer-search-input {
        max-width: 100%;
    }

    .customer-page-size-wrap {
        width: 100%;
        justify-content: space-between;
    }

    .drillsheet-upsert-page .page-header {
        flex-direction: column;
        align-items: stretch;
        gap: 0.75rem;
    }

    .drillsheet-actions {
        flex-wrap: wrap;
    }

    .drill-sheet-container {
        width: 100%;
        max-width: 680px;
        height: auto;
        min-height: 0;
        padding: 1rem;
        background-size: 18px 18px;
    }

    .drill-sheet-header-fields,
    .hole,
    .drill-input-box,
    .bridge-box,
    .span-line,
    .extras-panel {
        position: static !important;
        top: auto !important;
        right: auto !important;
        bottom: auto !important;
        left: auto !important;
        transform: none !important;
    }

    .drill-sheet-header-fields {
        display: grid;
        grid-template-columns: 1fr;
        gap: 0.85rem;
        margin-bottom: 1.1rem;
    }

    .left-finger,
    .right-finger,
    .thumb {
        display: grid;
        gap: 0.75rem;
        padding: 0.75rem;
        border: 1px solid var(--input-border);
        border-radius: 0.45rem;
        background: color-mix(in srgb, var(--bg-secondary) 58%, transparent);
        margin-bottom: 0.9rem;
    }

    .hole.finger,
    .hole.thumb {
        width: min(100%, 280px);
        height: auto;
        min-height: 170px;
        margin: 0 auto;
        padding: 0.75rem;
        border-width: 2px;
    }

    .hole.thumb {
        min-height: 210px;
    }

    .drill-input-box {
        width: 100%;
        max-width: 280px;
        margin: 0 auto;
    }

    .bridge-box,
    .input-span-left,
    .input-span-right {
        width: 100%;
        max-width: 280px;
        margin: 0 auto;
    }

    .span-line {
        display: none;
    }

    .extras-panel {
        display: grid;
        gap: 0.85rem;
        margin-top: 0.85rem;
    }

    .extras-box {
        min-width: 0;
    }
}

@media (max-width: 1200px) {
    .drill-sheet-card {
        padding: 0.75rem;
    }
}
