/* LDM Calculator Styles */

.ldm-calculator-section {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    min-height: 100vh;
    padding: 100px 0 80px 0;
}

/* Header */
.ldm-header {
    margin-bottom: 4rem;
}

.ldm-title {
    font-size: 3rem;
    font-weight: 800;
    color: #005cb9;
    margin-bottom: 1rem;
    text-shadow: 0 2px 4px rgba(0, 92, 185, 0.1);
}

.ldm-subtitle {
    font-size: 1.2rem;
    color: #6c757d;
    font-weight: 400;
    max-width: 600px;
    margin: 0 auto;
}


/* Calculator Sections */
.calculator-section {
    background: #ffffff;
    border-radius: 20px;
    padding: 3rem;
    margin-bottom: 3rem;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.1);
    border: 2px solid transparent;
    transition: all 0.3s ease;
}

.calculator-section:hover {
    border-color: #005cb9;
    box-shadow: 0 25px 80px rgba(0, 92, 185, 0.15);
    transform: translateY(-2px);
}

/* LDM Visualization */
.ldm-visualization {
    background: #ffffff;
    border: 2px solid #e9ecef;
    border-radius: 14px;
    padding: 1.25rem 1.25rem 1rem 1.25rem;
}

.ldm-legend {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
    color: #005cb9;
    font-weight: 700;
}

.truck-visual {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border: 2px solid #e9ecef;
    border-radius: 14px;
    padding: 1rem;
}

.truck-svg {
    width: 100%;
    height: auto;
    max-width: 900px;
    display: block;
    margin: 0 auto;
}

#cargoFill {
    transition: width 600ms cubic-bezier(.2, .8, .2, 1), fill 300ms ease, opacity 300ms ease;
}

#cargoFill.near-limit {
    fill: #ffc107;
}

#cargoFill.over-limit {
    fill: #dc3545;
    opacity: 0.9;
}

.ldm-track {
    position: relative;
    height: 22px;
    border-radius: 999px;
    background: linear-gradient(90deg, #f1f3f5 0%, #e9ecef 100%);
    overflow: hidden;
    border: 1px solid #dee2e6;
}

.ldm-fill {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #28a745, #20c997);
    box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.05);
    transition: width 600ms cubic-bezier(.2, .8, .2, 1), background 300ms ease;
}

.ldm-scale {
    display: flex;
    justify-content: space-between;
    margin-top: 6px;
    font-size: 0.85rem;
    color: #6c757d;
}

.ldm-fill.near-limit {
    background: linear-gradient(90deg, #ffc107, #ffcd39);
}

.ldm-fill.over-limit {
    background: linear-gradient(90deg, #dc3545, #e55353);
}

.section-title {
    color: #005cb9;
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 2rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

.section-title i {
    font-size: 1.3rem;
}

/* Input Groups */
.input-group {
    margin-bottom: 1.5rem;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.input-group label {
    display: block;
    font-weight: 600;
    color: #495057;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    width: 100%;
    text-align: left;
}


.calculator-input,
.multi-length,
.multi-width,
.multi-height,
.multi-quantity,
.multi-result,
.form-select {
    border: 2px solid #e9ecef;
    border-radius: 10px;
    padding: 12px 15px;
    font-size: 1rem;
    transition: all 0.3s ease;
    background: #ffffff;
    width: 100%;
}

.calculator-input:focus,
.multi-length:focus,
.multi-width:focus,
.multi-height:focus,
.multi-quantity:focus,
.form-select:focus {
    border-color: #005cb9;
    box-shadow: 0 0 0 3px rgba(0, 92, 185, 0.1);
    outline: none;
}

.multi-result {
    background: #e9ecef !important;
    color: #005cb9;
    font-weight: 600;
}

/* Stackable dropdown specific styling */
#stackable {
    max-width: none !important;
    width: 100% !important;
}

.input-group>.form-control,
.input-group>.form-select {
    width: 100%;
}

/* Package Rows */
.package-row {
    background: white;
    border-radius: 10px;
    padding: 1.5rem;
    margin-bottom: 1rem;
    border: 1px solid #e9ecef;
    transition: all 0.3s ease;
}

.package-row:hover {
    border-color: #005cb9;
    box-shadow: 0 5px 15px rgba(0, 92, 185, 0.1);
}

/* Buttons */
.calculation-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-top: 2rem;
    flex-wrap: wrap;
}

.calculate-btn {
    background: linear-gradient(135deg, #005cb9 0%, #004494 100%);
    border: none;
    padding: 12px 30px;
    border-radius: 25px;
    font-weight: 600;
    font-size: 1rem;
    transition: all 0.3s ease;
    box-shadow: 0 5px 15px rgba(0, 92, 185, 0.3);
}

.calculate-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 92, 185, 0.4);
    background: linear-gradient(135deg, #004494 0%, #003366 100%);
}

.add-package-btn {
    background: linear-gradient(135deg, #28a745 0%, #20993a 100%);
    border: none;
    padding: 12px 25px;
    border-radius: 25px;
    font-weight: 600;
    color: white;
    transition: all 0.3s ease;
    box-shadow: 0 5px 15px rgba(40, 167, 69, 0.3);
}

.add-package-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(40, 167, 69, 0.4);
    background: linear-gradient(135deg, #20993a 0%, #1e7e34 100%);
}

.clear-btn {
    border: 2px solid #6c757d;
    color: #6c757d;
    padding: 10px 25px;
    border-radius: 25px;
    font-weight: 600;
    background: transparent;
    transition: all 0.3s ease;
}

.clear-btn:hover {
    background: #6c757d;
    color: white;
    transform: translateY(-2px);
}

.remove-package-btn {
    border: 2px solid #dc3545;
    color: #dc3545;
    padding: 10px 15px;
    border-radius: 8px;
    transition: all 0.3s ease;
    margin-top: 25px;
}

.remove-package-btn:hover {
    background: #dc3545;
    color: white;
    transform: scale(1.05);
}

/* Result Sections */
.result-section {
    margin-top: 2rem;
    animation: slideInUp 0.5s ease;
}

@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.result-card {
    background: linear-gradient(135deg, #005cb9 0%, #004494 100%);
    color: white;
    padding: 2rem;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 92, 185, 0.3);
}

.result-card h5 {
    font-size: 1.4rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
    text-align: center;
}

.result-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
}

.result-item {
    text-align: center;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    backdrop-filter: blur(10px);
}

.result-item label {
    display: block;
    font-size: 0.9rem;
    opacity: 0.9;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.result-item span {
    font-size: 1.5rem;
    font-weight: 700;
    display: block;
}

.ldm-result {
    color: #ffc107 !important;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

/* Information Section */
.ldm-info-section {
    margin-top: 4rem;
}

.info-card {
    background: white;
    padding: 2rem;
    border-radius: 15px;
    border: 2px solid transparent;
    transition: all 0.3s ease;
}

.info-card h4 {
    color: #005cb9;
    font-weight: 700;
    margin-bottom: 1rem;
    font-size: 1.3rem;
}

.info-card p {
    color: #6c757d;
    line-height: 1.7;
    margin-bottom: 0;
    white-space: pre-line;
}

/* Responsive Design */
@media (max-width: 768px) {
    .ldm-calculator-section {
        padding: 80px 0 60px 0;
    }

    .ldm-title {
        font-size: 2.2rem;
    }

    .ldm-subtitle {
        font-size: 1.1rem;
    }

    .ldm-calculator-card .card-body {
        padding: 2rem 1.5rem;
    }

    .calculator-section {
        padding: 1.5rem;
    }

    .calculation-buttons {
        flex-direction: column;
        align-items: center;
    }

    .calculation-buttons .btn {
        width: 100%;
        max-width: 250px;
    }

    .result-grid {
        grid-template-columns: 1fr;
    }

    .package-row {
        padding: 1rem;
    }

    .package-row .row>div {
        margin-bottom: 1rem;
    }
}

@media (max-width: 576px) {
    .ldm-title {
        font-size: 1.8rem;
    }

    .section-title {
        font-size: 1.3rem;
    }

    .ldm-calculator-card .card-header {
        padding: 1.5rem;
    }

    .ldm-calculator-card .card-body {
        padding: 1.5rem 1rem;
    }

    .calculator-section {
        padding: 1rem;
    }

    .info-card {
        padding: 1.5rem;
    }
}

/* Loading States */
.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn.loading {
    position: relative;
    pointer-events: none;
}

.btn.loading:after {
    content: "";
    position: absolute;
    width: 16px;
    height: 16px;
    top: 50%;
    left: 50%;
    margin-left: -8px;
    margin-top: -8px;
    border: 2px solid transparent;
    border-top-color: #ffffff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* Focus Improvements */
.btn:focus,
.form-control:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(0, 92, 185, 0.25);
}

/* Truck Visualization Styles */
.truck-visualization-section {
    margin-top: 4rem;
    animation: slideInUp 0.5s ease;
}

.truck-card {
    background: #ffffff;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
    overflow: hidden;
    border: 2px solid transparent;
    transition: all 0.3s ease;
}

.truck-card:hover {
    border-color: #005cb9;
    box-shadow: 0 25px 80px rgba(0, 92, 185, 0.2);
}

.truck-header {
    background: linear-gradient(135deg, #005cb9 0%, #004494 100%);
    color: white;
    padding: 2rem;
    text-align: center;
}

.truck-header h4 {
    font-size: 1.6rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.truck-header p {
    font-size: 1rem;
    opacity: 0.9;
    margin-bottom: 0;
}

.truck-container {
    padding: 2rem;
}

/* Truck SVG Styles */
.truck-svg-container {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 15px;
    padding: 1.5rem;
    margin-bottom: 2rem;
    border: 2px solid #e9ecef;
}

.truck-svg {
    width: 100%;
    height: auto;
    max-width: 800px;
    margin: 0 auto;
    display: block;
}

.loading-bar {
    transition: opacity 0.3s ease, fill 0.3s ease;
}

/* Truck Stats */
.truck-stats {
    margin-bottom: 2rem;
}

.truck-stat {
    background: #f8f9fa;
    padding: 1.5rem;
    border-radius: 12px;
    text-align: center;
    border: 2px solid #e9ecef;
    transition: all 0.3s ease;
    height: 100%;
}

.truck-stat:hover {
    border-color: #005cb9;
    background: #ffffff;
    transform: translateY(-3px);
    box-shadow: 0 10px 25px rgba(0, 92, 185, 0.15);
}

.truck-stat i {
    font-size: 2rem;
    color: #005cb9;
    margin-bottom: 0.5rem;
    display: block;
}

.truck-stat .stat-label {
    display: block;
    font-size: 0.9rem;
    color: #6c757d;
    font-weight: 500;
    margin-bottom: 0.5rem;
}

.truck-stat .stat-value {
    display: block;
    font-size: 1.3rem;
    font-weight: 700;
    color: #005cb9;
}

/* Capacity Alerts */
.capacity-warning,
.capacity-overflow {
    margin-top: 1.5rem;
    animation: bounceIn 0.5s ease;
}

.capacity-warning .alert {
    background: linear-gradient(135deg, #fff3cd 0%, #ffeaa7 100%);
    border: 2px solid #ffc107;
    color: #856404;
    border-radius: 12px;
    padding: 1rem 1.5rem;
}

.capacity-overflow .alert {
    background: linear-gradient(135deg, #f8d7da 0%, #f5c6cb 100%);
    border: 2px solid #dc3545;
    color: #721c24;
    border-radius: 12px;
    padding: 1rem 1.5rem;
}

.capacity-warning .alert i,
.capacity-overflow .alert i {
    margin-right: 0.5rem;
    font-size: 1.2rem;
}

@keyframes bounceIn {
    0% {
        opacity: 0;
        transform: scale(0.3);
    }

    50% {
        opacity: 1;
        transform: scale(1.05);
    }

    70% {
        transform: scale(0.9);
    }

    100% {
        opacity: 1;
        transform: scale(1);
    }
}

/* Truck Animation */
.truck-svg:hover {
    transform: scale(1.02);
    transition: transform 0.3s ease;
}

/* Loading Bar Animations */
@keyframes fillBar {
    from {
        opacity: 0;
        transform: scaleY(0);
    }

    to {
        opacity: 0.8;
        transform: scaleY(1);
    }
}

.loading-bar {
    transform-origin: bottom;
    animation: fillBar 0.3s ease forwards;
}

/* Responsive Truck Visualization */
@media (max-width: 768px) {
    .truck-container {
        padding: 1.5rem;
    }

    .truck-svg-container {
        padding: 1rem;
    }

    .truck-stat {
        margin-bottom: 1rem;
        padding: 1rem;
    }

    .truck-stat i {
        font-size: 1.5rem;
    }

    .truck-stat .stat-value {
        font-size: 1.1rem;
    }

    .truck-header {
        padding: 1.5rem;
    }

    .truck-header h4 {
        font-size: 1.4rem;
    }
}

@media (max-width: 576px) {
    .truck-stats .row>div {
        margin-bottom: 1rem;
    }

    .truck-svg {
        height: 200px;
    }
}

/* Enhanced Hover Effects */
.calculator-section {
    position: relative;
    overflow: hidden;
}

.calculator-section:before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(0, 92, 185, 0.05), transparent);
    transition: left 0.5s ease;
}

.calculator-section:hover:before {
    left: 100%;
}