/* ============================================
   Custom Styles for Pipe Specifications
   Based on old calc-interpipe design
   ============================================ */

/* Phase 1: Typography & Base Styles */
@import url('https://fonts.googleapis.com/css2?family=PT+Sans:wght@400;700&family=Inter:wght@400;500;700&display=swap');

:root {
    --color-menu: #778085;
    --color-text: #202020;
    --color-button: #f5eb26;
    --color-button-hover: #fff300;
    --color-border: #636b70;
    --color-border-light: #7a7a7a;
    --color-footer-bg: rgba(45, 50, 54, 0.5);
    --color-calculator-bg: rgba(255, 255, 255, 0.93);
    --color-shadow: rgba(0, 0, 0, 0.4);
}

* {
    box-sizing: border-box;
}

html {
    font-size: 14px;
}

body {
    font-family: 'Inter', 'PT Sans', sans-serif;
    color: var(--color-text);
    background: #fff url('../images/back/premium-bg.jpg') center center no-repeat;
    background-size: cover;
    margin: 0;
    padding: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    position: relative;
    line-height: normal;
    transition: background 0.4s;
}

body a {
    color: var(--color-menu);
    text-decoration: none;
    transition: all 0.4s;
}

body a:hover {
    color: var(--color-text);
}

/* Phase 2: Header/Navigation */
.navbar {
    background-color: var(--color-menu) !important;
    padding: 0;
    min-height: 100px !important;
    height: 100px !important;
    position: relative;
    z-index: 1030;
}

.navbar .container {
    padding: 0 15px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    position: relative;
}

.navbar-brand {
    font-weight: 500;
    font-size: 18px;
    color: #fff !important;
    text-transform: uppercase;
    margin-left: 30px;
    padding: 15px 0;
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

.navbar-brand .logo-img {
    max-width: 100%;
    height: auto;
    max-height: 60px;
}

/* Desktop: navbar-collapse is flex */
@media (min-width: 992px) {
    .navbar-collapse {
        flex: 1;
        display: flex;
        justify-content: center;
        align-items: center;
    }
}

/* Mobile: let Bootstrap handle collapse, just style when shown */
@media (max-width: 991.98px) {
    .navbar-collapse.show {
        display: flex !important;
        flex-direction: column;
        width: 100%;
        margin-top: 10px;
        padding: 10px 0;
        background-color: var(--color-menu) !important;
        z-index: 1030;
        position: relative;
    }
    
    .navbar-nav {
        width: 100%;
        flex-direction: column;
    }
    
    .navbar-nav.me-auto {
        width: 100%;
        margin: 0;
    }
    
    .navbar-toggler {
        z-index: 1050;
        position: relative;
    }
    
    /* Ensure form selects don't overflow the menu when it's open */
    .navbar-collapse.show ~ * .form-select,
    body:has(.navbar-collapse.show) .form-select {
        z-index: 1;
    }
}

.navbar-nav.me-auto {
    margin: 0 auto;
    display: flex;
    justify-content: center;
    align-items: center;
}

.navbar-nav .nav-link {
    color: #fff !important;
    font-size: 14px;
    font-weight: 400;
    text-transform: uppercase;
    padding: 15px 20px;
    transition: all 0.4s;
}

.navbar-nav .nav-link:hover,
.navbar-nav .nav-link:focus {
    color: #fff !important;
    background-color: rgba(255, 255, 255, 0.1);
}

.navbar-nav .nav-item.active .nav-link {
    background-color: rgba(255, 255, 255, 0.2);
}

.navbar-toggler {
    border-color: rgba(255, 255, 255, 0.5);
}

.navbar-toggler-icon {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba%28255, 255, 255, 0.85%29' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
}

/* Dropdown menus */
.dropdown-menu {
    border-radius: 0;
    border: 1px solid var(--color-border);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.dropdown-item {
    font-size: 14px;
    padding: 10px 20px;
    transition: all 0.2s;
}

.dropdown-item:hover,
.dropdown-item.active {
    background-color: var(--color-menu);
    color: #fff;
}

.dropdown-item button {
    background: none;
    border: none;
    width: 100%;
    text-align: left;
    padding: 0;
    color: inherit;
}

/* Phase 3: Main Content Area - Calculator Container */
main {
    flex: 1;
    padding: 0;
    margin: 0;
    padding-bottom: 100px;
}

/* Contacts page - full screen layout */
body.custom {
    padding: 0;
    background: #ccc;
    overflow: hidden;
}

body.custom main {
    padding-bottom: 0;
    flex: 0;
    height: calc(100vh - 100px);
    overflow: visible;
    position: relative;
}

body.custom footer {
    position: fixed !important;
    display: block !important;
    visibility: visible !important;
    z-index: 1000;
    bottom: 0 !important;
}

.calculator-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: calc(100vh - 100px - 100px);
    width: 100%;
    padding: 15px;
    background: rgba(0, 0, 0, 0.05);
}

.calculator-container {
    width: 100%;
    max-width: 1120px;
    margin: 15px 0;
}

.calculator-box {
    margin-top: -2px;
    padding: 30px 30px 30px 30px;
    background: var(--color-calculator-bg);
    box-shadow: 22.4px 33.2px 40px 0 var(--color-shadow);
    border-radius: 5px;
    height: auto;
    transition: height 0.4s;
}

/* Phase 4: Form Elements */
.brand-buttons-row {
    margin-bottom: 20px;
}

.brand-buttons {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

.btn-brand {
    flex: 1;
    min-width: 150px;
    padding: 15px 30px;
    background: #fff !important;
    border: 2px solid var(--color-border) !important;
    color: var(--color-text) !important;
    font-size: 16px !important;
    font-weight: 500 !important;
    transition: all 0.3s;
    cursor: pointer;
}

.btn-brand:hover {
    background: var(--color-button) !important;
    border-color: var(--color-button) !important;
    color: var(--color-text) !important;
}

.btn-brand.active {
    background: var(--color-button) !important;
    border-color: var(--color-button) !important;
    color: var(--color-text) !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.form-items-row {
    display: flex;
    flex-wrap: wrap;
    margin: 0 -10px 0 0;
    height: auto;
}

.form-group {
    margin-bottom: 10px;
    padding-right: 10px;
}

.form-group.form-long {
    flex: 0 0 22%;
    max-width: 22%;
}

.form-group.form-middle {
    flex: 0 0 20%;
    max-width: 20%;
}

.form-group.form-shorter {
    flex: 0 0 18%;
    max-width: 18%;
}

.form-group.form-quart {
    flex: 0 0 25%;
    max-width: 25%;
}

.form-group.form-short {
    flex: 0 0 15%;
    max-width: 15%;
}

.form-group.form-small {
    flex: 0 0 10%;
    max-width: 10%;
}

.form-group.form-auto {
    flex: 0 0 auto;
    width: auto;
    max-width: none;
}

/* Fixed width for form-auto groups on desktop to prevent width changes */
@media (min-width: 768px) {
    .form-group.form-auto {
        flex: 0 0 200px;
        min-width: 200px;
        max-width: 200px;
    }
}

.form-group.form-btn {
    flex: 0 0 130px;
    display: flex;
    flex-direction: column;
}

.form-group.form-btn .btn {
    margin-bottom: 0;
    margin-top: auto;
}

.form-label {
    font-size: 14px;
    font-weight: 400;
    color: var(--color-text);
    margin-bottom: 8px;
    display: block;
}

/* Form Selects */
.form-select {
    height: 50px !important;
    border: 1px solid var(--color-border) !important;
    border-radius: 0 !important;
    padding-left: 20px !important;
    padding-right: 35px !important;
    font-size: 14px !important;
    color: var(--color-text) !important;
    background-color: #fff !important;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23202020' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M2 5l6 6 6-6'/%3e%3c/svg%3e") !important;
    background-repeat: no-repeat !important;
    background-position: right 15px center !important;
    background-size: 16px 12px !important;
    appearance: none !important;
    transition: all 0.2s;
    width: 100%;
    min-width: 0;
    z-index: 1;
    position: relative;
}

/* Fixed width for form selects on desktop */
@media (min-width: 768px) {
    .form-group.form-auto .form-select {
        min-width: 180px;
        width: 180px;
    }
}

.form-select:focus {
    border-color: var(--color-border) !important;
    box-shadow: 0 0 0 0.2rem rgba(119, 128, 133, 0.25) !important;
    outline: none !important;
}

.form-select:disabled {
    background-color: #e9ecef !important;
    cursor: not-allowed !important;
    opacity: 0.6;
}

.form-select option {
    padding: 10px;
    color: var(--color-text);
}

/* Buttons */
.btn {
    border-radius: 0 !important;
    margin: 0;
    background: var(--color-button) !important;
    font-size: 14px !important;
    font-weight: 500 !important;
    color: var(--color-text) !important;
    height: 50px !important;
    transition: all 0.4s !important;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    border: none !important;
    padding: 0 20px !important;
    cursor: pointer;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    vertical-align: middle !important;
    line-height: 1 !important;
}

.btn:hover,
.btn:active,
.btn:focus {
    color: var(--color-text) !important;
    background: var(--color-button-hover) !important;
    box-shadow: none !important;
}

.btn:disabled {
    background: rgb(235, 235, 228) !important;
    color: rgb(84, 84, 84) !important;
    opacity: 0.65;
    cursor: not-allowed;
}

.btn-primary {
    background: var(--color-button) !important;
    color: var(--color-text) !important;
}

.btn-primary:hover {
    background: var(--color-button-hover) !important;
    color: var(--color-text) !important;
}

.btn-secondary {
    background: #fff !important;
    color: var(--color-text) !important;
    border: 1px solid var(--color-border) !important;
}

.btn-secondary:hover {
    background: #f8f9fa !important;
    color: var(--color-text) !important;
}

.btn-sm {
    height: auto !important;
    min-height: 36px !important;
    padding: 6px 12px !important;
    font-size: 13px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    vertical-align: middle !important;
    line-height: 1 !important;
}

.btn-sm,
.btn-sm * {
    line-height: 1 !important;
    vertical-align: middle !important;
}

/* Phase 5: Results Section */
.results-section {
    margin-top: 2rem;
    padding: 20px 0;
}

.results-section h2 {
    font-size: 24px;
    font-weight: 500;
    color: var(--color-text);
    margin-bottom: 20px;
}

.pipe-card {
    border: 1px solid #dee2e6;
    border-radius: 0;
    padding: 20px;
    margin-bottom: 15px;
    background: #fff;
    transition: box-shadow 0.3s;
}

.pipe-card:hover {
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
}

.pipe-card h5 {
    font-size: 18px;
    font-weight: 500;
    margin-bottom: 15px;
    color: var(--color-text);
}

.pipe-card h5 a {
    color: var(--color-menu);
    text-decoration: none;
}

.pipe-card h5 a:hover {
    color: var(--color-text);
    text-decoration: underline;
}

.pipe-card p {
    font-size: 14px;
    margin-bottom: 8px;
    color: var(--color-text);
}

.pipe-card strong {
    font-weight: 500;
}

/* Phase 6: Footer */
footer {
    background: var(--color-footer-bg) !important;
    min-height: 100px !important;
    height: 100px !important;
    padding: 0 !important;
    margin-top: auto;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    z-index: 100;
    transition: all 0.4s;
}

footer .container {
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    height: 100%;
    width: 100%;
}

footer .copyright {
    font-size: 14px;
    color: #fff;
    margin: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    text-align: center;
    width: 100%;
}

footer .stores {
    display: none;
}

footer .stores a {
    margin: 0;
    transition: all 0.4s;
    display: inline-block;
}

footer .stores a img {
    opacity: 0.8;
    height: 58px;
    transition: all 0.2s;
}

footer .stores a img:hover {
    opacity: 1;
}

footer p {
    font-size: 14px;
    color: #fff;
    margin: 40px 0 40px 30px;
    text-align: left;
}

/* Page Title */
h1 {
    font-size: 28px;
    font-weight: 500;
    color: var(--color-text);
    margin-bottom: 30px;
}

/* Filter Section */
.filter-section {
    background: transparent;
    padding: 0;
    border-radius: 0;
    margin-bottom: 0;
}

/* Alerts */
.alert {
    border-radius: 0;
    border: 1px solid var(--color-border);
}

/* Phase 7: Responsive Design */
@media (max-width: 991.98px) {
    .form-group.form-long,
    .form-group.form-middle,
    .form-group.form-shorter,
    .form-group.form-quart,
    .form-group.form-short,
    .form-group.form-small,
    .form-group.form-auto,
    .form-group.form-btn {
        flex: 0 0 100%;
        max-width: 100%;
    }
    
    .form-items-row {
        margin: 0;
    }
    
    .form-group {
        padding-right: 0;
    }
    
    .form-group.form-btn {
        margin-bottom: 15px;
    }
    
    .form-group.form-btn .btn {
        width: 100%;
    }
    
    .calculator-box {
        padding: 20px;
    }
    
    .navbar-brand {
        margin-left: 15px;
    }
    
    footer .copyright {
        margin-left: 15px;
        text-align: center;
        width: 100%;
    }
    
    footer .container {
        justify-content: center;
    }
    
    footer .stores {
        justify-content: center;
        width: 100%;
    }
}

@media (max-width: 767.98px) {
    body {
        padding-bottom: 80px;
    }
    
    main {
        padding-bottom: 80px;
    }
    
    .calculator-wrapper {
        padding: 10px;
        min-height: auto;
    }
    
    .calculator-container {
        margin: 10px 0;
    }
    
    .calculator-box {
        padding: 15px;
    }
    
    .btn {
        width: 100%;
        margin-bottom: 15px;
    }
    
    .brand-buttons {
        flex-direction: column;
    }
    
    .btn-brand {
        width: 100%;
        min-width: auto;
    }
    
    .navbar {
        min-height: 70px !important;
        height: 70px !important;
    }
    
    .navbar-brand {
        font-size: 16px;
        margin-left: 10px;
    }
    
    .navbar-brand .logo-img {
        max-height: 40px;
    }
    
    .navbar-nav .nav-link {
        padding: 10px 15px;
    }
    
    .navbar-collapse {
        justify-content: flex-start;
    }
    
    .navbar-collapse.show {
        display: flex !important;
        flex-direction: column;
        width: 100%;
        margin-top: 10px;
        padding: 10px 0;
    }
    
    .navbar-nav.me-auto {
        margin: 0;
        justify-content: flex-start;
    }
    
    h1 {
        font-size: 24px;
    }
    
    .results-section h2 {
        font-size: 20px;
    }
    
    footer {
        min-height: 70px !important;
        height: 70px !important;
    }
    
    footer .copyright {
        margin-left: 15px;
        margin-top: 0;
        margin-bottom: 0;
        text-align: center;
        height: 100%;
        display: flex;
        align-items: center;
    }
    
    footer .container {
        height: 100%;
        justify-content: center;
    }
    
    footer .copyright {
        width: 100%;
        text-align: center;
    }
    
    footer .stores {
        margin: 10px 0;
        justify-content: center;
    }
}

@media (min-width: 992px) and (max-width: 1199.98px) {
    .form-group.form-long {
        flex: 0 0 30%;
        max-width: 30%;
    }
    
    .form-group.form-middle {
        flex: 0 0 28%;
        max-width: 28%;
    }
}

/* Cards */
.card {
    border-radius: 0;
    border: 1px solid #dee2e6;
    margin-bottom: 20px;
}

.card-header {
    background-color: var(--color-menu);
    color: #fff;
    padding: 15px 20px;
    border-bottom: 1px solid var(--color-menu);
}

.card-header h3 {
    font-size: 18px;
    font-weight: 500;
    margin: 0;
    color: #fff;
}

.card-body {
    padding: 20px;
}

.card-body dl {
    margin-bottom: 0;
}

.card-body dt {
    font-weight: 500;
    color: var(--color-text);
    margin-bottom: 5px;
}

.card-body dd {
    color: var(--color-text);
    margin-bottom: 15px;
}

/* Content styling */
.content {
    font-size: 14px;
    line-height: 1.6;
    color: var(--color-text);
}

.content p {
    margin-bottom: 15px;
}

/* Utility Classes */
.text-uppercase {
    text-transform: uppercase;
}

.aic {
    display: flex;
    align-items: center;
}

/* Override Bootstrap container padding for calculator */
.calculator-container .container-fluid {
    padding: 0;
}

/* Datasheet Styles */
.datasheet-header {
    border-bottom: 2px solid var(--color-border);
    padding-bottom: 15px;
    margin-bottom: 20px;
}

.datasheet-header h3 {
    font-size: 20px;
    font-weight: 500;
    color: var(--color-text);
    margin-bottom: 10px;
}

.datasheet-section {
    margin-bottom: 30px;
}

.section-title {
    font-size: 18px;
    font-weight: 500;
    color: var(--color-text);
    margin-bottom: 15px;
    padding-bottom: 8px;
    border-bottom: 1px solid #dee2e6;
}

.subsection {
    margin-bottom: 20px;
}

.subsection-title {
    font-size: 16px;
    font-weight: 500;
    color: var(--color-text);
    margin-bottom: 10px;
}

.datasheet-table {
    width: 100%;
    margin-bottom: 20px;
    border-collapse: collapse;
    border: 1px solid #dee2e6;
}

/* General Characteristics Table: 6-column grid, no header */
.datasheet-table-general {
    width: 100%;
}

.datasheet-table-general tbody td {
    padding: 8px 12px;
    font-size: 13px;
    border: 1px solid #dee2e6;
    color: var(--color-text);
}

.datasheet-table-general .datasheet-label {
    background-color: #f8f9fa;
    font-weight: 500;
    width: 16.66%;
}

.datasheet-table-general .datasheet-value {
    background-color: #fff;
    width: 16.66%;
}

/* 4-column tables (Pipe Body Data & Connection Data) */
.datasheet-table-4col {
    width: 100%;
}

.datasheet-table-4col thead th.datasheet-header-row {
    background-color: #454647;
    color: #fff;
    font-weight: bold;
    font-size: 14px;
    padding: 10px 15px;
    text-align: left;
    border: 1px solid #454647;
}

.datasheet-table-4col tbody td {
    padding: 8px 12px;
    font-size: 13px;
    border: 1px solid #dee2e6;
    color: var(--color-text);
}

.datasheet-table-4col .datasheet-label {
    background-color: #e9ecef;
    font-weight: 500;
    width: 25%;
}

.datasheet-table-4col .datasheet-value {
    background-color: #fff;
    width: 25%;
}

/* Torque Tables: 2-column grid */
.datasheet-table-torque {
    width: 100%;
}

.datasheet-table-torque thead th.datasheet-header-row {
    background-color: #454647;
    color: #fff;
    font-weight: bold;
    font-size: 13px;
    padding: 8px 12px;
    text-align: left;
    border: 1px solid #454647;
}

.datasheet-table-torque tbody td {
    padding: 6px 10px;
    font-size: 12px;
    border: 1px solid #dee2e6;
    color: var(--color-text);
}

.datasheet-table-torque .datasheet-label {
    background-color: #e9ecef;
    font-weight: 500;
    width: 50%;
}

.datasheet-table-torque .datasheet-value {
    background-color: #fff;
    width: 50%;
}

/* Torque tables container for 2x2 layout */
.torque-tables-container {
    width: 100%;
}

.torque-tables-row {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}

.torque-tables-col {
    flex: 1;
    min-width: 300px;
}

@media (max-width: 768px) {
    .torque-tables-row {
        flex-direction: column;
    }
    
    .torque-tables-col {
        min-width: 100%;
    }
}

.datasheet-disclaimer {
    border-top: 2px solid var(--color-border);
    margin-top: 30px;
    padding: 15px;
    font-size: 12px;
    color: #6c757d;
    line-height: 1.5;
}

.torque-table {
    margin-bottom: 20px;
}

.table-title {
    font-size: 15px;
    font-weight: 500;
    color: var(--color-text);
    margin-bottom: 10px;
}

.pipe-summary {
    background-color: #f8f9fa;
    padding: 15px;
    border-radius: 4px;
    margin-bottom: 20px;
}

.pipe-summary p {
    margin-bottom: 5px;
    font-size: 14px;
}

.pipe-datasheet {
    margin-top: 20px;
}

@media (max-width: 767.98px) {
    .datasheet-table {
        font-size: 12px;
    }
    
    .datasheet-table thead th,
    .datasheet-table tbody td {
        padding: 8px 10px;
    }
    
    .section-title {
        font-size: 16px;
    }
    
    .subsection-title {
        font-size: 14px;
    }
}
