/* ==================== Stock Trading Calculators Global Stylesheet ==================== */

/* ==================== Sticky Navigation ==================== */
.calc-sticky-nav {
    position: sticky;
    top: 0;
    z-index: 3050;
    background-color: #fff;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.calc-control-bar {
    padding: 5px 0;
}

/* ==================== Tab Content ==================== */
.calc-tab-content {
    margin-top: 10px;
}

#percent-gain,
#cost-basis,
#basic-calc {
    background-color: rgb(229, 254, 234);
    border-left: 1px solid darkgreen;
    border-right: 1px solid darkgreen;
    border-bottom: 1px solid darkgreen;
}

/* User Guide Tab - white background */
#users-guide {
    background-color: #ffffff;
}

/* ==================== Form Controls ==================== */
.calc-controls {
    padding: 0.25rem;
}

.calc-form-label {
    font-weight: 600;
    margin-bottom: 0.5rem;
    display: block;
}

.calc-form-control {
    display: block;
    width: 100%;
    padding: 0.625rem 0.75rem;
    font-size: 1rem;
    font-weight: 400;
    line-height: 1.5;
    color: #212529;
    background-color: #fff;
    background-clip: padding-box;
    border: 2px solid #dee2e6;
    border-radius: 0.375rem;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.calc-form-control:focus {
    color: #212529;
    background-color: #fff;
    border-color: #0d6efd;
    outline: 0;
    box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.15);
}

.calc-form-range {
    width: 100%;
    height: 1.5rem;
    padding: 0;
    background-color: transparent;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

.calc-form-range:focus {
    outline: 0;
}

.calc-form-range:focus::-webkit-slider-thumb {
    box-shadow: 0 0 0 1px #fff, 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
}

.calc-form-range:focus::-moz-range-thumb {
    box-shadow: 0 0 0 1px #fff, 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
}

/* ==================== Results Display Area ==================== */
.calc-results-display {
    max-height: 820px;
    overflow-y: auto;
    padding: 0.25rem;
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 0.375rem;
    min-height: 200px;
}

/* Scrollbar Styling for Results Display */
.calc-results-display::-webkit-scrollbar {
    width: 8px;
}

.calc-results-display::-webkit-scrollbar-thumb {
    background-color: #adb5bd;
    border-radius: 4px;
}

.calc-results-display::-webkit-scrollbar-track {
    background-color: #f8f9fa;
}

/* Individual Result Card */
.calc-result-card {
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 0.375rem;
    padding: 1rem;
    margin-bottom: 0.75rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    transition: box-shadow 0.2s ease;
}

.calc-result-card:hover {
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.15);
}

/* ==================== Toggle Switches ==================== */
.calc-form-switch .calc-form-check-input {
    cursor: pointer;
    width: 3em;
    height: 1.5em;
}

.calc-form-switch .calc-form-check-label {
    cursor: pointer;
    user-select: none;
}

/* ==================== Card Styling ==================== */
.calc-card {
    border-radius: 0.5rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    border: 1px solid #dee2e6;
}

.calc-card-body {
    padding: 0.5rem;
}

/* ==================== Button Styling Enhancements ==================== */
.calc-btn {
    display: inline-block;
    font-weight: 600;
    line-height: 1.5;
    text-align: center;
    text-decoration: none;
    vertical-align: middle;
    cursor: pointer;
    user-select: none;
    border: 1px solid transparent;
    padding: 0.625rem 1rem;
    font-size: 1rem;
    border-radius: 0.375rem;
    transition: all 0.3s ease;
}

.calc-btn-lg {
    padding: 0.75rem 1.5rem;
    font-size: 1.125rem;
    font-weight: 600;
}

.calc-btn-primary {
    color: #fff;
    background-color: #0d6efd;
    border-color: #0d6efd;
}

.calc-btn-primary:hover {
    color: #fff;
    background-color: #0b5ed7;
    border-color: #0a58ca;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.calc-btn-primary:active {
    transform: translateY(0);
}

.calc-btn-success {
    color: #fff;
    background-color: #28a745;
    border-color: #28a745;
}

.calc-btn-success:hover {
    color: #fff;
    background-color: #218838;
    border-color: #1e7e34;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.calc-btn-success:active {
    transform: translateY(0);
}

/* ==================== Tab Navigation Enhancements ==================== */
.calc-nav-tabs .calc-nav-link {
    color: #495057;
    font-weight: 500;
    padding: 0.75rem 1.5rem;
    border: none;
    transition: all 0.2s ease;
}

.calc-nav-tabs .calc-nav-link:hover {
    color: #0d6efd;
    border-color: transparent;
}

.calc-nav-tabs .calc-nav-link.active {
    color: #0d6efd;
    font-weight: 600;
    border-bottom: 3px solid #0d6efd;
    background-color: transparent;
}

/* ==================== Input Focus States ==================== */
.calc-form-control:focus,
.calc-form-range:focus,
.calc-form-check-input:focus {
    border-color: #0d6efd;
    box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.15);
}

/* ==================== Textarea Enhancements ==================== */
textarea.calc-form-control {
    resize: vertical;
    font-family: 'Courier New', monospace;
    font-size: 0.875rem;
}

/* ==================== Small Text Helper ==================== */
.calc-form-text {
    display: block;
    margin-top: 0.25rem;
    font-size: 0.875rem;
    color: #6c757d;
}

/* ==================== Badge Styling ==================== */
.calc-badge {
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    font-weight: 600;
    border-radius: 0.375rem;
}

.calc-badge-primary {
    color: #fff;
    background-color: #0d6efd;
}

.calc-badge-success {
    color: #fff;
    background-color: #28a745;
}

/* ==================== Alert Styling ==================== */
.calc-alert {
    position: relative;
    padding: 1rem 1.25rem;
    margin-bottom: 1rem;
    border: 1px solid transparent;
    border-radius: 0.375rem;
}

.calc-alert-info {
    color: #084298;
    background-color: #cfe2ff;
    border-color: #b6d4fe;
}

.calc-alert-warning {
    color: #664d03;
    background-color: #fff3cd;
    border-color: #ffecb5;
}

.calc-alert-danger {
    color: #842029;
    background-color: #f8d7da;
    border-color: #f5c2c7;
}

.calc-alert-success {
    color: #0f5132;
    background-color: #d1e7dd;
    border-color: #badbcc;
}

/* ==================== Table Styling ==================== */
.calc-table {
    width: 100%;
    margin-bottom: 1rem;
    color: #212529;
    border-collapse: collapse;
}

.calc-table th,
.calc-table td {
    padding: 0.75rem;
    vertical-align: top;
    border-top: 1px solid #dee2e6;
}

.calc-table thead th {
    vertical-align: bottom;
    border-bottom: 2px solid #dee2e6;
    background-color: #f8f9fa;
    font-weight: 600;
}

.calc-table-striped tbody tr:nth-of-type(odd) {
    background-color: rgba(0, 0, 0, 0.05);
}

.calc-table-sm th,
.calc-table-sm td {
    padding: 0.5rem;
}

/* ==================== Calculator Bubble Effect ==================== */

:root {
  --calc-spring-easing: linear(0, 0.0018, 0.0069 1.15%, 0.026 2.3%, 0.0637, 0.1135 5.18%, 0.2229 7.78%, 0.5977 15.84%, 0.7014, 0.7904, 0.8641, 0.9228, 0.9676 28.8%, 1.0032 31.68%, 1.0225, 1.0352 36.29%, 1.0431 38.88%, 1.046 42.05%, 1.0448 44.35%, 1.0407 47.23%, 1.0118 61.63%, 1.0025 69.41%, 0.9981 80.35%, 0.9992 99.94%);
}

/* Calculator Tab Bubble Indicator */
.calc-bubble-container {
  position: relative;
  display: contents;
}

.calc-anchored-bubble {
  position: absolute;
  position-anchor: --calculator-selected;
  top: anchor(center);
  transform: translateY(-50%);
  left: anchor(left);
  width: anchor-size(width);
  height: anchor-size(height);
  border: 2px solid rgba(13, 110, 253, 0.5);
  border-radius: 999px;
  transition: all 1s var(--calc-spring-easing);
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
  pointer-events: none;
  backdrop-filter: url(#calculator-bubble-filter);
  z-index: 0;
}

.calc-anchored-bubble::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse, rgba(13, 110, 253, 0.3), transparent);
  border-radius: 999px;
}

/* ==================== Custom Tooltips ==================== */
.calc-tooltip {
  font-size: 0.875rem;
  z-index: 9999 !important;
}

.calc-tooltip-inner {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  padding: 0.5rem 0.75rem;
  border-radius: 0.5rem;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2);
  font-weight: 500;
}

.calc-tooltip .calc-tooltip-arrow::before {
  border-top-color: #667eea !important;
}

/* ==================== Utility Classes ==================== */
.calc-text-center {
    text-align: center;
}

.calc-text-muted {
    color: #6c757d;
}

.calc-text-success {
    color: #28a745;
}

.calc-text-danger {
    color: #dc3545;
}

.calc-w-100 {
    width: 100%;
}

.calc-mb-2 { margin-bottom: 0.5rem; }
.calc-mb-3 { margin-bottom: 1rem; }
.calc-mb-4 { margin-bottom: 1.5rem; }
.calc-mt-2 { margin-top: 0.5rem; }
.calc-mt-3 { margin-top: 1rem; }

/* ==================== Responsive Design ==================== */
@media (max-width: 768px) {
    .calc-controls {
        padding: 1rem;
    }

    .calc-results-display {
        margin-top: 1rem;
        max-height: 400px;
    }

    .calc-card-body {
        padding: 1rem;
    }
}

@media (max-width: 576px) {
    .calc-card-body {
        padding: 1rem;
    }

    .calc-controls {
        padding: 0.5rem;
    }
}

/* Responsive adjustments for bubble on mobile */
@media (max-width: 768px) {
  .calc-anchored-bubble {
    border-width: 1px;
  }
}
