/* ==========================================================================
   Watersports Calculators CSS
   Shared styles for fishing, scuba, swimming, kiteboarding, and boating tools
   ========================================================================== */

/* ==========================================================================
   CRITICAL: Box-sizing fix for all calculator form elements
   This prevents inputs from overflowing their containers
   ========================================================================== */
.bb-card,
.bb-card *,
.ws-card,
.ws-card *,
.bac-form-grid,
.bac-form-grid * {
    box-sizing: border-box;
}

/* Prevent grid children from overflowing */
.bac-form-grid > div {
    min-width: 0;
    overflow: hidden;
}

/* Ensure inputs respect container width */
.bac-form-grid .bb-input,
.bac-form-grid select.bb-input {
    max-width: 100%;
}

/* Watersports-specific color palette */
:root {
    --ws-primary: #0ea5e9;       /* Sky blue - water theme */
    --ws-secondary: #06b6d4;     /* Cyan */
    --ws-accent: #14b8a6;        /* Teal */
    --ws-success: #22c55e;       /* Green */
    --ws-warning: #f59e0b;       /* Amber */
    --ws-danger: #ef4444;        /* Red */
    --ws-deep: #0284c7;          /* Deep water blue */
    --ws-surface: #38bdf8;       /* Surface water */
}

/* Left Column - Content */
.left-column {
    min-width: 0;
}

/* Right Column - Calculator (Sticky) */
.right-column {
    position: sticky;
    top: 2rem;
    height: fit-content;
}

/* ==========================================================================
   Calculator Card Styling
   ========================================================================== */

.ws-card,
.bb-card {
    background: #1e293b;
    border: 1px solid #334155;
    border-radius: 20px;
    padding: 2.5rem;
    margin-bottom: 1.5rem;
}

.ws-card-header {
    text-align: center;
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid #334155;
}

.ws-card-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: #f8fafc;
    margin: 0 0 0.5rem 0;
}

.ws-card-subtitle {
    color: #94a3b8;
    font-size: 0.95rem;
    margin: 0;
}

/* ==========================================================================
   Form Elements
   ========================================================================== */

.ws-form-grid,
.bac-form-grid {
    display: grid;
    gap: 1.25rem;
}

.ws-form-grid.two-col {
    grid-template-columns: repeat(2, 1fr);
}

.ws-input-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.ws-label,
.bb-label {
    font-size: 0.875rem;
    font-weight: 600;
    color: #cbd5e1;
}

.ws-input,
.bb-input {
    width: 100%;
    padding: 0.875rem 1rem;
    background: #0f172a;
    border: 2px solid #334155;
    border-radius: 10px;
    color: #f8fafc;
    font-size: 16px; /* Prevents iOS zoom */
    transition: border-color 0.2s, box-shadow 0.2s;
}

.ws-input:focus,
.bb-input:focus {
    outline: none;
    border-color: var(--ws-primary, #0ea5e9);
    box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.15);
}

.ws-input::placeholder {
    color: #64748b;
}

/* Select Dropdowns */
.ws-select,
.bb-select {
    width: 100%;
    padding: 0.875rem 2.5rem 0.875rem 1rem;
    background: #0f172a url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2394a3b8' d='M6 8L1 3h10z'/%3E%3C/svg%3E") no-repeat right 1rem center;
    border: 2px solid #334155;
    border-radius: 10px;
    color: #f8fafc;
    font-size: 16px;
    appearance: none;
    cursor: pointer;
    transition: border-color 0.2s;
}

.ws-select:focus {
    outline: none;
    border-color: var(--ws-primary, #0ea5e9);
}

/* Unit Toggle Buttons */
.ws-unit-toggle {
    display: flex;
    background: #0f172a;
    border-radius: 8px;
    padding: 4px;
    gap: 4px;
}

.ws-unit-btn {
    flex: 1;
    padding: 0.625rem 1rem;
    background: transparent;
    border: none;
    border-radius: 6px;
    color: #94a3b8;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.ws-unit-btn.active {
    background: var(--ws-primary, #0ea5e9);
    color: white;
}

.ws-unit-btn:hover:not(.active) {
    color: #f8fafc;
    background: rgba(14, 165, 233, 0.1);
}

/* ==========================================================================
   Results Display
   ========================================================================== */

.ws-result-container,
.bac-result-container {
    margin-top: 1.5rem;
    padding: 1.5rem;
    background: linear-gradient(135deg, rgba(14, 165, 233, 0.1), rgba(6, 182, 212, 0.1));
    border: 1px solid rgba(14, 165, 233, 0.3);
    border-radius: 12px;
    text-align: center;
}

.ws-result-label {
    font-size: 0.875rem;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.5rem;
}

.ws-result-value,
.bb-result {
    font-size: 2.5rem;
    font-weight: 800;
    color: #f8fafc;
    line-height: 1.2;
}

.ws-result-unit {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--ws-primary, #0ea5e9);
    margin-left: 0.25rem;
}

.ws-result-secondary {
    display: flex;
    justify-content: center;
    gap: 2rem;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid rgba(14, 165, 233, 0.2);
}

.ws-result-item {
    text-align: center;
}

.ws-result-item-label {
    font-size: 0.75rem;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.ws-result-item-value {
    font-size: 1.25rem;
    font-weight: 700;
    color: #cbd5e1;
}

/* Feedback Messages */
.ws-feedback {
    margin-top: 1rem;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 500;
}

.ws-feedback-excellent {
    background: rgba(34, 197, 94, 0.1);
    color: #22c55e;
    border: 1px solid rgba(34, 197, 94, 0.3);
}

.ws-feedback-good {
    background: rgba(14, 165, 233, 0.1);
    color: #0ea5e9;
    border: 1px solid rgba(14, 165, 233, 0.3);
}

.ws-feedback-warning {
    background: rgba(245, 158, 11, 0.1);
    color: #f59e0b;
    border: 1px solid rgba(245, 158, 11, 0.3);
}

.ws-feedback-error {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

/* ==========================================================================
   Reset Button
   ========================================================================== */

.ws-reset,
.bb-reset {
    width: 100%;
    margin-top: 1rem;
    padding: 0.875rem;
    background: transparent;
    border: 2px solid #334155;
    border-radius: 10px;
    color: #94a3b8;
    font-size: 0.9375rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.ws-reset:hover,
.bb-reset:hover {
    border-color: #64748b;
    color: #f8fafc;
    background: rgba(100, 116, 139, 0.1);
}

/* ==========================================================================
   Error Handling
   ========================================================================== */

.ws-error,
.bb-error {
    color: #ef4444;
    font-size: 0.8125rem;
    margin-top: 0.375rem;
    display: none;
}

.ws-error.show,
.bb-error.show {
    display: block;
}

.ws-input.error,
.bb-input.error {
    border-color: #ef4444;
    background: rgba(239, 68, 68, 0.05);
}

/* ==========================================================================
   Tabs Component
   ========================================================================== */

.ws-tabs,
.rc-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    background: #0f172a;
    padding: 4px;
    border-radius: 10px;
}

.ws-tab-btn,
.rc-tab-btn {
    flex: 1;
    padding: 0.75rem 1rem;
    background: transparent;
    border: none;
    border-radius: 8px;
    color: #94a3b8;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.ws-tab-btn.active,
.rc-tab-btn.active {
    background: var(--ws-primary, #0ea5e9);
    color: white;
}

.ws-tab-btn:hover:not(.active),
.rc-tab-btn:hover:not(.active) {
    color: #f8fafc;
    background: rgba(14, 165, 233, 0.1);
}

.ws-tab-panel {
    display: none;
}

.ws-tab-panel.active {
    display: block;
}

/* ==========================================================================
   Species/Type Selector Grid
   ========================================================================== */

.ws-species-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.ws-species-btn {
    padding: 0.75rem 0.5rem;
    background: #0f172a;
    border: 2px solid #334155;
    border-radius: 8px;
    color: #94a3b8;
    font-size: 0.8125rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
}

.ws-species-btn.active {
    border-color: var(--ws-primary, #0ea5e9);
    background: rgba(14, 165, 233, 0.1);
    color: var(--ws-primary, #0ea5e9);
}

.ws-species-btn:hover:not(.active) {
    border-color: #475569;
    color: #cbd5e1;
}

/* ==========================================================================
   Page Header Styles
   ========================================================================== */

.bac-page-header {
    margin-bottom: 2rem;
}

.bac-header-title {
    font-size: clamp(2rem, 4vw, 2.75rem);
    font-weight: 800;
    color: #f8fafc;
    margin: 0 0 0.5rem 0;
    line-height: 1.2;
}

.bac-header-subtitle {
    font-size: 1.125rem;
    color: #94a3b8;
    margin: 0;
    line-height: 1.5;
}

/* ==========================================================================
   Content Sections
   ========================================================================== */

.bac-content {
    color: #cbd5e1;
    line-height: 1.7;
}

.bac-content h2 {
    font-size: 1.5rem;
    font-weight: 700;
    color: #f8fafc;
    margin: 2.5rem 0 1rem 0;
}

.bac-content h3 {
    font-size: 1.25rem;
    font-weight: 600;
    color: #e2e8f0;
    margin: 2rem 0 0.75rem 0;
}

.bac-content p {
    margin: 0 0 1rem 0;
}

.bac-content ul,
.bac-content ol {
    margin: 0 0 1rem 0;
    padding-left: 1.5rem;
}

.bac-content li {
    margin-bottom: 0.5rem;
}

/* Formula Display */
.bac-formula {
    background: #0f172a;
    border: 2px solid var(--ws-primary, #0ea5e9);
    border-radius: 12px;
    padding: 1.5rem;
    margin: 1.5rem 0;
    text-align: center;
}

.bac-formula-text {
    font-family: 'Courier New', Courier, monospace;
    font-size: 1.125rem;
    color: var(--ws-primary, #0ea5e9);
    font-weight: 600;
}

/* Example Box */
.bac-example {
    background: rgba(14, 165, 233, 0.05);
    border-left: 4px solid var(--ws-primary, #0ea5e9);
    padding: 1.25rem 1.5rem;
    margin: 1.5rem 0;
    border-radius: 0 8px 8px 0;
}

.bac-example-title {
    font-weight: 700;
    color: var(--ws-primary, #0ea5e9);
    margin-bottom: 0.5rem;
}

/* Benchmark Table */
.bac-benchmark-table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.5rem 0;
}

.bac-benchmark-table th,
.bac-benchmark-table td {
    padding: 0.875rem 1rem;
    text-align: left;
    border-bottom: 1px solid #334155;
}

.bac-benchmark-table th {
    background: #0f172a;
    color: #f8fafc;
    font-weight: 600;
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.bac-benchmark-table td {
    color: #cbd5e1;
}

.bac-benchmark-table tr:hover td {
    background: rgba(14, 165, 233, 0.05);
}

/* ==========================================================================
   Accessibility - Screen Reader Only
   ========================================================================== */

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ==========================================================================
   Mobile Responsive Layout
   ========================================================================== */

@media (max-width: 1023px) {
    .calculator-page-wrapper {
        display: flex;
        flex-direction: column;
        gap: 2rem;
    }

    .right-column {
        position: static;
        order: -1; /* Calculator appears first on mobile */
    }

    .left-column {
        order: 1;
    }

    .ws-card,
    .bb-card {
        padding: 1.5rem;
        border-radius: 16px;
    }

    .ws-form-grid.two-col {
        grid-template-columns: 1fr;
    }

    .ws-result-secondary {
        flex-direction: column;
        gap: 0.75rem;
    }

    .bac-header-title {
        font-size: 1.75rem;
    }

    .bac-related-widget {
        padding: 1.25rem;
    }
}

@media (max-width: 640px) {
    .site-container {
        padding: 0 1rem;
    }

    .ws-species-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .ws-result-value,
    .bb-result {
        font-size: 2rem;
    }

    .bac-content h2 {
        font-size: 1.25rem;
    }

    .bac-content h3 {
        font-size: 1.125rem;
    }
}

/* ==========================================================================
   Watersports-Specific Visual Elements
   ========================================================================== */

/* Wave decoration for headers */
.ws-wave-decoration {
    position: relative;
    padding-top: 1rem;
}

.ws-wave-decoration::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--ws-primary), var(--ws-secondary), var(--ws-accent));
    border-radius: 2px;
}

/* Depth indicator (for scuba) */
.ws-depth-indicator {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    background: linear-gradient(180deg, rgba(14, 165, 233, 0.1), rgba(2, 132, 199, 0.2));
    border-radius: 6px;
    font-size: 0.875rem;
    color: var(--ws-primary);
}

/* Wind strength indicator (for kiteboarding/windsurfing) */
.ws-wind-indicator {
    display: flex;
    gap: 2px;
}

.ws-wind-bar {
    width: 8px;
    height: 24px;
    background: #334155;
    border-radius: 2px;
    transition: background 0.2s;
}

.ws-wind-bar.active {
    background: var(--ws-primary);
}

.ws-wind-bar.warning {
    background: var(--ws-warning);
}

.ws-wind-bar.danger {
    background: var(--ws-danger);
}

/* Speed/Pace display ring (for swimming) */
.ws-pace-ring {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    border: 6px solid #334155;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    margin: 0 auto;
    position: relative;
}

.ws-pace-ring::before {
    content: '';
    position: absolute;
    inset: -6px;
    border-radius: 50%;
    border: 6px solid transparent;
    border-top-color: var(--ws-primary);
    animation: ws-rotate 2s linear infinite;
}

@keyframes ws-rotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Fish silhouette indicator */
.ws-fish-size {
    display: flex;
    align-items: flex-end;
    gap: 0.25rem;
    height: 40px;
}

.ws-fish-bar {
    width: 6px;
    background: linear-gradient(to top, var(--ws-primary), var(--ws-surface));
    border-radius: 3px;
    transition: height 0.3s ease-out;
}

/* Line capacity visual (for fishing reel) */
.ws-spool-visual {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    border: 12px solid #334155;
    position: relative;
    margin: 1rem auto;
}

.ws-spool-fill {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    border: 12px solid var(--ws-primary);
    clip-path: polygon(0 0, 100% 0, 100% 50%, 0 50%);
    transition: clip-path 0.5s ease-out;
}

/* ==========================================================================
   Hull Speed Calculator - Specific Styles
   ========================================================================== */

/* Hull Input Group - for length and speed with unit selectors */
.hull-input-group {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 0.5rem;
}

.hull-unit-select {
    min-width: 110px;
    font-size: 16px;
}

/* Hull Speed Result Display */
#hullSpeedResult {
    font-size: clamp(2rem, 5vw, 3rem);
    font-weight: 900;
    color: var(--ws-primary, #0ea5e9);
    margin-bottom: 0.5rem;
}

.hull-conversions {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-top: 1rem;
}

.hull-conversion-item {
    font-size: 1.25rem;
    font-weight: 600;
    color: #cbd5e1;
}

.hull-unit {
    font-size: 0.875rem;
    color: #64748b;
    font-weight: 400;
}

/* Hull Speed Divider */
.hull-divider {
    height: 2px;
    background: rgba(255, 255, 255, 0.08);
    margin: 2rem 0;
}

/* S/L Ratio Section */
.hull-section-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: #f8fafc;
    margin: 0 0 0.5rem;
}

.hull-section-desc {
    font-size: 0.9375rem;
    color: #94a3b8;
    margin: 0 0 1.5rem;
    line-height: 1.5;
}

.hull-sl-container {
    margin-top: 1.5rem;
    padding: 1.5rem;
    background: rgba(14, 165, 233, 0.05);
    border: 2px solid var(--ws-primary, #0ea5e9);
    border-radius: 12px;
}

.hull-sl-result {
    font-size: clamp(2.5rem, 6vw, 4rem);
    font-weight: 900;
    color: var(--ws-primary, #0ea5e9);
}

/* Card title styling */
.bb-card-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: #f8fafc;
    margin: 0 0 1.5rem 0;
    text-align: center;
}

/* Additional feedback class for warnings */
.bac-feedback {
    margin-top: 1rem;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    font-size: 0.9375rem;
    font-weight: 500;
    text-align: center;
}

.bac-feedback-excellent {
    background: rgba(34, 197, 94, 0.1);
    color: #22c55e;
    border: 1px solid rgba(34, 197, 94, 0.3);
}

.bac-feedback-good {
    background: rgba(14, 165, 233, 0.1);
    color: #0ea5e9;
    border: 1px solid rgba(14, 165, 233, 0.3);
}

.bac-feedback-average {
    background: rgba(100, 116, 139, 0.1);
    color: #94a3b8;
    border: 1px solid rgba(100, 116, 139, 0.3);
}

.bac-feedback-warning {
    background: rgba(251, 146, 20, 0.1);
    color: #fb923c;
    border: 1px solid rgba(251, 146, 20, 0.3);
}

/* Additional feedback class for warnings */
.bac-content-heading {
    font-size: 1.5rem;
    font-weight: 700;
    color: #f8fafc;
    margin: 2.5rem 0 1rem 0;
}

.bac-subheading {
    font-size: 1.25rem;
    font-weight: 600;
    color: #e2e8f0;
    margin: 2rem 0 0.75rem 0;
}

.bac-list {
    margin: 0 0 1rem 0;
    padding-left: 1.5rem;
}

.bac-list-item {
    margin-bottom: 0.5rem;
    color: #cbd5e1;
    line-height: 1.7;
}

.bac-example-box {
    background: rgba(14, 165, 233, 0.05);
    border-left: 4px solid var(--ws-primary, #0ea5e9);
    padding: 1.25rem 1.5rem;
    margin: 1.5rem 0;
    border-radius: 0 8px 8px 0;
}

.bac-example-label {
    font-weight: 700;
    color: var(--ws-primary, #0ea5e9);
    display: block;
    margin-bottom: 0.5rem;
}

.bac-example-text {
    color: #cbd5e1;
    margin: 0.5rem 0;
}

.bac-example-equation {
    font-family: 'Courier New', Courier, monospace;
    font-size: 1.125rem;
    color: #f8fafc;
    font-weight: 600;
    margin: 0.75rem 0;
}

.bac-strong {
    font-weight: 700;
    color: #f8fafc;
}

.bac-content-image {
    width: 100%;
    height: auto;
    border-radius: 12px;
    margin: 1.5rem 0;
}

.section-header {
    margin-bottom: 1.5rem;
}

.section-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: #f8fafc;
    margin: 0;
}

.bac-result-label {
    font-size: 0.875rem;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.5rem;
}

/* Responsive adjustments for hull calculator */
@media (max-width: 640px) {
    .hull-input-group {
        grid-template-columns: 1fr;
    }

    .hull-unit-select {
        min-width: 100%;
    }

    .hull-conversions {
        align-items: center;
    }

    .hull-conversion-item {
        font-size: 1.1rem;
    }

    .bb-card-title {
        font-size: 1.25rem;
    }

    .hull-section-title {
        font-size: 1.125rem;
    }
}

/* ==========================================================================
   Kiteboarding Calculator - Specific Styles
   ========================================================================== */

/* Kiteboarding Input Group - for weight and wind with unit selectors */
.kb-input-group {
    display: flex;
    flex-wrap: nowrap;
    gap: 0.5rem;
    align-items: stretch;
}

.kb-input-group > input.bb-input {
    flex: 1 1 0;
    min-width: 0;
    width: 0; /* Let flex handle the width */
}

.kb-input-group > select.bb-input,
.kb-unit-select {
    flex: 0 0 auto;
    width: auto;
    min-width: 70px;
    max-width: 90px;
}

/* Wind Range Info Box */
.kb-wind-range {
    margin-top: 1.5rem;
    padding: 1.25rem;
    background: rgba(14, 165, 233, 0.05);
    border: 1px solid rgba(14, 165, 233, 0.2);
    border-radius: 10px;
}

.kb-range-title {
    font-size: 1rem;
    font-weight: 600;
    color: #f8fafc;
    margin: 0 0 1rem 0;
}

.kb-range-content {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.kb-range-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.kb-range-label {
    font-size: 0.875rem;
    color: #94a3b8;
}

.kb-range-value {
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--ws-primary, #0ea5e9);
}

/* Responsive adjustments for kiteboarding calculator */
@media (max-width: 520px) {
    .kb-input-group {
        flex-direction: column;
    }

    .kb-input-group > input.bb-input,
    .kb-input-group > select.bb-input,
    .kb-unit-select {
        flex: 1 1 auto;
        width: 100%;
        max-width: none;
        min-width: 0;
    }
}

/* ==========================================================================
   Dynamic State Classes
   ========================================================================== */

/* Hidden by default - toggle with JS by removing class */
.ws-hidden {
    display: none !important;
}

/* Highlighted/selected result state */
.ws-result-selected {
    font-weight: bold !important;
}

/* Print Styles */
@media print {
    .right-column {
        position: static;
    }

    .ws-reset,
    .bb-reset,
    .bac-related-widget {
        display: none;
    }

    .ws-card,
    .bb-card {
        border: 1px solid #ccc;
        box-shadow: none;
    }
}
