/* Custom styles for Calculator Hub */

/* General styles */
body {
    background-color: #f8f9fa;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

h4 {
    color: #0d6efd;
}

/* Header styles */
.header-wrapper {
    background: linear-gradient(135deg, #0d6efd 0%, #0dcaf0 100%);
    color: white;
    position: relative;
    z-index: 1030; /* Add high z-index to ensure header stays above ads */
}

.header-container {
    background: transparent;
    padding: 1rem 1.5rem;
}

.header-wrapper::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 50px;
    background: linear-gradient(180deg, transparent, rgba(248, 249, 250, 0.1));
}

/* Search container styles */
.search-container {
    padding: 2rem 0;
    background: transparent;
    margin-top: 0;
}

.search-box {
    position: relative;
    max-width: 600px;
    margin: 0 auto;
    padding: 0 1rem;
}

.search-input-wrapper {
    position: relative;
    z-index: 1200;
    text-align: left;
    background: #fff;
    border-radius: 0;
}

.search-input-wrapper .input-group {
    margin-bottom: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

.search-input-wrapper .input-group .form-control {
    border: none;
    border-radius: 0;
    padding: 0.8rem 1.2rem;
    box-shadow: none;
    font-size: 1rem;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: transparent;
    transition: background-color 0.15s ease;
}

.search-input-wrapper .input-group .form-control:focus {
    background-color: rgba(255, 255, 255, 0.8);
    box-shadow: none;
}

.search-input-wrapper .input-group .form-control::placeholder {
    color: #6c757d;
    opacity: 0.75;
    font-size: 0.9375rem;
}

.search-input-wrapper .input-group .btn-primary {
    background-color: #ff7b00;
    border: none;
    border-radius: 0;
    padding: 0.8rem 1.2rem;
    transition: background-color 0.15s ease;
}

.search-input-wrapper .input-group .btn-primary:hover {
    background-color: #ff9e45;
}

.search-input-wrapper .input-group .btn-primary:active {
    background-color: #ff7b00 !important;
}

.search-results-dropdown {
    position: absolute;
    top: calc(100% - 1px);
    left: 0;
    right: 0;
    background: inherit;
    border: none;
    border-radius: 0 0 8px 8px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.08);
    max-height: 300px;
    overflow-y: auto;
    padding: 4px;
    scrollbar-width: thin;
    scrollbar-color: rgba(0, 0, 0, 0.15) transparent;
}

.search-results-dropdown::-webkit-scrollbar {
    width: 6px;
}

.search-results-dropdown::-webkit-scrollbar-track {
    background: transparent;
}

.search-results-dropdown::-webkit-scrollbar-thumb {
    background-color: rgba(0, 0, 0, 0.15);
    border-radius: 3px;
}

.search-result-item {
    padding: 10px 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
    color: #2c3338;
    min-height: 44px;
    border-radius: 6px;
    position: relative;
    background: transparent;
}

.search-result-item:hover {
    background-color: rgba(255, 123, 0, 0.1);
    transform: translateX(1px);
}

.search-result-item i {
    font-size: 1rem;
    width: 20px;
    min-width: 20px;
    text-align: center;
    color: #ff7b00;
    opacity: 0.85;
    transition: opacity 0.15s ease;
}

.search-result-item:hover i {
    opacity: 1;
}

.search-result-item span {
    flex: 1;
    font-size: 0.9375rem;
    line-height: 1.4;
    font-weight: 400;
    color: #2c3338;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    letter-spacing: -0.01em;
    padding: 2px 0;
}

/* Dark mode adjustments */
[data-bs-theme="dark"] .search-input-wrapper {
    background: #2b3035;
}

[data-bs-theme="dark"] .search-input-wrapper .input-group {
    background: transparent;
}

[data-bs-theme="dark"] .search-input-wrapper .input-group .form-control {
    color: rgba(255, 255, 255, 0.9);
}

[data-bs-theme="dark"] .search-input-wrapper .input-group .form-control:focus {
    background-color: rgba(255, 255, 255, 0.05);
}

[data-bs-theme="dark"] .search-input-wrapper .input-group .form-control::placeholder {
    color: rgba(255, 255, 255, 0.5);
}

[data-bs-theme="dark"] .search-results-dropdown {
    background: inherit;
    scrollbar-color: rgba(255, 255, 255, 0.15) transparent;
}

[data-bs-theme="dark"] .search-results-dropdown::-webkit-scrollbar-thumb {
    background-color: rgba(255, 255, 255, 0.15);
}

[data-bs-theme="dark"] .search-result-item {
    color: rgba(255, 255, 255, 0.9);
}

[data-bs-theme="dark"] .search-result-item:not(:last-child) {
    border-bottom-color: rgba(255, 255, 255, 0.05);
}

[data-bs-theme="dark"] .search-result-item:hover {
    background-color: rgba(255, 123, 0, 0.18);
}

[data-bs-theme="dark"] .search-result-item span {
    color: rgba(255, 255, 255, 0.9);
}

/* Quick access container */
.quick-access-container {
    position: relative;
    z-index: 1;
    margin-top: 1rem;
}

.quick-access {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: center;
    padding: 0.5rem;
}

/* Quick access buttons */
.quick-access-container {
    position: relative;
    z-index: 1;
    margin-top: 1rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    overflow: visible;
}

.badge-toggle-btn {
    background-color: rgba(255, 255, 255, 0.9);
    border: none;
    border-radius: 50px;
    padding: 0.5rem 1.2rem;
    color: #0d6efd;
    font-size: 0.9rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: all 0.3s ease;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    width: auto;
    min-width: 160px;
    min-height: 40px;
    line-height: 1;
    margin: 0 auto;
}

.badge-toggle-btn i {
    transition: transform 0.3s ease;
}

.badge-toggle-btn.collapsed i {
    transform: rotate(-180deg);
}

.badge-toggle-btn:hover {
    background-color: rgba(255, 255, 255, 1);
    transform: translateY(-1px);
}

.badge-toggle-btn:active {
    transform: translateY(0);
}

.quick-access {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: center;
    padding: 0.5rem;
    margin-bottom: 0.5rem;
}

@media (max-width: 768px) {
    .header-wrapper {
        padding: 0.5rem 0;
    }

    .search-container {
        padding: 1rem 0;
    }

    .search-box {
        width: 90%;
        margin-bottom: 0.25rem;
    }

    .quick-access {
        max-height: none;
        visibility: visible;
        overflow: visible;
        transition: all 0.3s ease-out;
        gap: 0.35rem;
        padding: 0.35rem;
    }

    .quick-access.collapsed {
        max-height: 0;
        visibility: hidden;
        margin: 0;
        padding: 0;
        overflow: hidden;
    }

    .badge-button {
        padding: 0.35rem 0.75rem;
    }

    h1.display-4 {
        font-size: 1.75rem;
        margin-bottom: 0.75rem !important;
    }
}

.badge-button {
    background-color: rgba(255, 255, 255, 0.9);
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 50px;
    color: #0d6efd;
    font-size: 0.9rem;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.3s ease;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.badge-button i {
    font-size: 1rem;
}

.badge-button:hover {
    background-color: #0d6efd;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(13, 110, 253, 0.25);
}

.badge-button:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(13, 110, 253, 0.25);
}

/* Toggle button styles */
.btn-check:checked + .btn-outline-primary {
    background-color: #ff7b00;
    border-color: #ff7b00;
    color: white;
}

.btn-check + .btn-outline-primary {
    color: #ff7b00;
    border-color: #ff7b00;
}

.btn-check + .btn-outline-primary:hover {
    background-color: #fff0e3;
    border-color: #ff7b00;
    color: #ff7b00;
}

.btn-check:focus + .btn-outline-primary,
.btn-outline-primary:focus {
    box-shadow: 0 0 0 0.25rem rgba(255, 123, 0, 0.25);
}

/* Override any active state */
.btn-check:active + .btn-outline-primary,
.btn-check:checked + .btn-outline-primary:focus,
.btn-outline-primary:active,
.btn-outline-primary.active,
.btn-outline-primary.dropdown-toggle.show {
    background-color: #ff7b00;
    border-color: #ff7b00;
    color: white;
}

/* Calculator display area */
.calculator-container {
    padding: 2rem 0;
    background-color: #f8f9fa;
    margin-top: -1rem;
}

/* Welcome message */
#welcome-message {
    opacity: 0.7;
    padding: 1rem;
}

#welcome-message .bi {
    opacity: 0.5;
}

/* Calculator cards */
.calculator-card {
    max-width: 500px;
    margin: 0 auto;
    display: none;
}

.calculator-card.active {
    display: block;
    animation: fadeIn 0.3s ease-in;
}

.card {
    border: none;
    border-radius: 16px;
    background: white;
    box-shadow: 0 8px 24px rgba(13, 110, 253, 0.12);
    overflow: hidden;
    margin: 0.5rem;
    backdrop-filter: blur(10px);
}

.card-header {
    border: none;
    padding: 1.25rem;
    background: linear-gradient(135deg, #0d6efd 0%, #0dcaf0 100%);
    color: white;
}

.card-header .card-title {
    font-weight: 600;
    letter-spacing: 0.5px;
}

.card-body {
    padding: 1.5rem;
}

/* Info panel transition styles */
.info-section {
    background-color: rgba(0, 0, 0, 0.02);
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.info-section .card-body {
    padding: 0.5rem 1rem;
}

.info-section p {
    font-size: 0.9rem;
    line-height: 1.4;
    color: #666;
    margin: 0;
}

.collapse {
    transition: none;
}

.collapsing {
    transition: height 0.25s ease;
}

/* Form control styles */
.form-control, .form-select {
    border: 2px solid #e9ecef;
    padding: 0.8rem 1rem;
    border-radius: 12px;
    transition: all 0.2s ease;
    font-size: 1rem;
    background-color: #f8f9fa;
}

.form-control:focus, .form-select:focus {
    box-shadow: none;
    border-color: #0d6efd;
    background-color: white;
}

.form-label {
    font-weight: 500;
    color: #495057;
    margin-bottom: 0.5rem;
}

/* Button styles in calculators */
.card .btn {
    border-radius: 12px;
    padding: 0.8rem 1.5rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: all 0.3s ease;
}

.card .btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(13, 110, 253, 0.2);
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Dark mode styles */
[data-theme="dark"] {
    color-scheme: dark;
}

[data-theme="dark"] body {
    background-color: #121212;
    color: #e0e0e0;
}

[data-theme="dark"] .header-wrapper {
    background: linear-gradient(135deg, #1a1a1a 0%, #2d2d2d 100%);
}

[data-theme="dark"] .header-wrapper::after {
    background: linear-gradient(180deg, transparent, rgba(18, 18, 18, 0.1));
}

[data-theme="dark"] .calculator-container {
    background-color: #121212;
}

[data-theme="dark"] .card {
    background-color: #1e1e1e;
    border-color: #2d2d2d;
}

[data-theme="dark"] .card-body {
    color: #e0e0e0;
}

[data-theme="dark"] .form-control,
[data-theme="dark"] .form-select {
    background-color: #2d2d2d;
    border-color: #404040;
    color: #e0e0e0;
}

[data-theme="dark"] .form-control:focus,
[data-theme="dark"] .form-select:focus {
    background-color: #363636;
    border-color: #505050;
    color: #ffffff;
}

[data-theme="dark"] table,
[data-theme="dark"] .table {
    color: #e0e0e0;
    background-color: #1e1e1e;
    border-color: #2d2d2d;
}

[data-theme="dark"] .table > :not(caption) > * > * {
    background-color: #1e1e1e;
    border-color: #2d2d2d;
    color: #e0e0e0;
}

[data-theme="dark"] .table-striped > tbody > tr:nth-of-type(odd) > * {
    background-color: #252525;
}

[data-theme="dark"] .table-hover > tbody > tr:hover > * {
    background-color: #303030;
}

[data-theme="dark"] .modal-content {
    background-color: #1e1e1e;
    border-color: #2d2d2d;
}

[data-theme="dark"] .modal-header {
    border-bottom-color: #2d2d2d;
}

[data-theme="dark"] .modal-footer {
    border-top-color: #2d2d2d;
}

[data-theme="dark"] .bg-light {
    background-color: #1a1a1a !important;
}

[data-theme="dark"] footer {
    color: #e0e0e0;
}

[data-theme="dark"] .badge-button {
    background-color: #2d2d2d;
    color: #e0e0e0;
}

[data-theme="dark"] .badge-button:hover {
    background-color: #363636;
}

[data-theme="dark"] #theme-toggle .bi-sun-fill::before {
    content: "\F497";  /* Bootstrap Icons moon-fill icon */
}

[data-theme="dark"] .dropdown-menu {
    background-color: #1e1e1e;
    border-color: #2d2d2d;
}

[data-theme="dark"] .dropdown-item {
    color: #e0e0e0;
}

[data-theme="dark"] .dropdown-item:hover,
[data-theme="dark"] .dropdown-item:focus {
    background-color: #363636;
    color: #ffffff;
}

/* Label and placeholder styles for dark mode */
[data-theme="dark"] label,
[data-theme="dark"] .form-label {
    color: #b0b0b0;
    font-weight: 500;
}

[data-theme="dark"] .form-control::placeholder {
    color: #909090;
    opacity: 1;
}

[data-theme="dark"] .form-control::-webkit-input-placeholder {
    color: #909090;
    opacity: 1;
}

[data-theme="dark"] .form-control::-moz-placeholder {
    color: #909090;
    opacity: 1;
}

[data-theme="dark"] .form-control:-ms-input-placeholder {
    color: #909090;
    opacity: 1;
}

[data-theme="dark"] .form-control:disabled,
[data-theme="dark"] .form-control[readonly] {
    background-color: #252525;
    color: #909090;
}

/* Article styles */
.article-content {
    max-width: 800px;
    margin: 0 auto;
    line-height: 1.7;
}

.article-content h1 {
    color: #333;
    font-size: 2.5rem;
}

.article-content h2 {
    color: #444;
    font-size: 1.8rem;
    margin-top: 2rem;
}

.article-content p, .article-content ul {
    color: #555;
    margin-bottom: 1.5rem;
}

.article-meta {
    font-size: 0.9rem;
}

/* Related articles section */
.related-articles {
    background: #f8f9fa;
    border-top: 1px solid #e9ecef;
    padding: 1rem;
    margin-top: 1rem;
    border-radius: 0.5rem;
}

.related-articles h5 {
    color: #6c757d;
    margin-bottom: 0.5rem;
}

.related-articles a {
    color: #0d6efd;
    text-decoration: none;
}

.related-articles a:hover {
    text-decoration: underline;
}

/* Footer */
footer {
    background-color: white !important;
    box-shadow: 0 -2px 4px rgba(0, 0, 0, 0.1);
    margin-top: auto;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .calculator-card {
        width: 95%;
    }

    .card {
        margin: 0.25rem;
    }

    .calculator-container {
        padding: 1.5rem 0;
    }

    .card-body {
        padding: 1.25rem;
    }
}
