/* Modern Calculator Styles */
.calculator {
    width: 100%;
    max-width: 900px;
    margin: 2rem auto;
    font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
    color: #2D3748;
    line-height: 1.6;
    background-color: #F7FAFC;
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
}

.scene {
    display: none;
    padding: 2.5rem;
    background-color: #FFFFFF;
    border-radius: 12px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.05);
    margin-bottom: 2rem;
    text-align: center;
    animation: fadeIn 0.5s ease-out;
}

.scene.active {
    display: block;
}

.scene h2 {
    margin: 0 0 1.5rem;
    color: #FF6200;
    font-weight: 600;
    font-size: 2rem;
    position: relative;
}

.scene h2::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 4px;
    background-color: #FF6200;
    border-radius: 2px;
}

/* Animation keyframes */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes popIn {
    0% { transform: scale(0.9); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

/* Button styling */
button {
    padding: 0.75rem 1.5rem;
    background-color: #FF6200;
    color: #FFFFFF;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 600;
    font-size: 1rem;
    box-shadow: 0 3px 6px rgba(0, 0, 0, 0.1);
}

button:hover {
    background-color: #E65500;
    transform: translateY(-2px);
    box-shadow: 0 5px 10px rgba(0, 0, 0, 0.15);
}

button.secondary-btn {
    background-color: #E2E8F0;
    color: #4A5568;
}

button.secondary-btn:hover {
    background-color: #CBD5E0;
}

button.download-btn {
    background-color: #3182CE;
    margin-bottom: 1.5rem;
}

button.download-btn:hover {
    background-color: #2B6CB0;
}

.button-group {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-top: 2rem;
}

/* Input styling */
.input-group {
    position: relative;
    margin: 2rem auto;
    max-width: 400px;
}

input[type="text"] {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 2px solid #E2E8F0;
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.3s ease;
    background-color: #FFFFFF;
}

input[type="text"]:focus {
    outline: none;
    border-color: #FF6200;
    box-shadow: 0 0 0 3px rgba(255, 98, 0, 0.1);
}

.input-group small {
    display: block;
    margin-top: 0.5rem;
    color: #718096;
    font-size: 0.875rem;
}

/* Radio buttons and options */
.answer {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 1.5rem;
    margin: 2rem 0;
}

.option-card {
    border: 2px solid #E2E8F0;
    border-radius: 12px;
    padding: 1.5rem;
    width: 180px;
    transition: all 0.3s ease;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    background-color: #FFFFFF;
}

.option-card:hover {
    border-color: #FF6200;
    transform: translateY(-5px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.1);
}

.option-card input[type="radio"] {
    position: absolute;
    opacity: 0;
}

.option-card input[type="radio"]:checked + .img-container {
    transform: scale(1.05);
}

.option-card input[type="radio"]:checked ~ p {
    font-weight: 600;
    color: #FF6200;
}

.option-card input[type="radio"]:checked ~ .check-mark {
    opacity: 1;
}

.img-container {
    transition: all 0.3s ease;
    margin-bottom: 1rem;
}

.option-card .img {
    width: 80px;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto;
}

.option-card p {
    margin: 0;
    font-size: 1rem;
    text-align: center;
}

.check-mark {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background-color: #FF6200;
    color: #FFFFFF;
    border-radius: 50%;
    width: 1.5rem;
    height: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: all 0.3s ease;
    font-size: 0.875rem;
}

/* Quantity inputs */
.panel-quantity-container {
    max-width: 400px;
    margin: 2rem auto;
    background-color: #F7FAFC;
    border-radius: 12px;
    padding: 1.5rem;
}

.panel-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.panel-row label {
    font-weight: 600;
    color: #2D3748;
}

.quantity-input {
    display: flex;
    align-items: center;
}

.number-input {
    width: 60px;
    text-align: center;
    border: 2px solid #E2E8F0;
    border-left: none;
    border-right: none;
    border-radius: 0;
    height: 40px;
    font-size: 1rem;
}

.quantity-input button {
    padding: 0;
    width: 40px;
    height: 40px;
    font-size: 1.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #FF6200;
    color: #FFFFFF;
    border: none;
    box-shadow: none;
}

.quantity-input button:hover {
    background-color: #E65500;
    transform: none;
}

.quantity-input button.minus {
    border-radius: 8px 0 0 8px;
}

.quantity-input button.plus {
    border-radius: 0 8px 8px 0;
}

/* Grid visualization */
.grid-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin: 2rem auto;
    padding: 1.5rem;
    border: 1px solid #E2E8F0;
    border-radius: 12px;
    background-color: #FFFFFF;
    max-width: 500px;
}

.grid-row {
    display: flex;
    justify-content: center;
}

.grid-square {
    background-color: #FF6200;
    border: 1px solid rgba(255, 255, 255, 0.3);
    margin: 2px;
    transition: all 0.3s ease;
}

.empty-grid-message {
    color: #718096;
    font-style: italic;
}

/* Results table */
.result-container {
    position: relative;
}

#ProductsTable {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin: 1.5rem 0;
    background-color: #FFFFFF;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

#ProductsTable th,
#ProductsTable td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid #E2E8F0;
}

#ProductsTable th {
    background-color: #FF6200;
    color: #FFFFFF;
    font-weight: 600;
    font-size: 0.875rem;
    text-transform: uppercase;
}

#ProductsTable tr:last-child td {
    border-bottom: none;
}

#ProductsTable tr:nth-child(even) {
    background-color: #F7FAFC;
}

#ProductsTable tr:hover {
    background-color: rgba(255, 98, 0, 0.05);
}

#ProductsTable .add-to-cart-btn {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    background-color: #38A169;
    box-shadow: none;
}

#ProductsTable .add-to-cart-btn.checked {
    background-color: #2F855A; /* Darker green for success */
    position: relative;
    transition: background-color 0.3s ease;
}

#ProductsTable .add-to-cart-btn .checkmark {
    color: #FFFFFF;
    font-size: 1rem;
    margin-left: 0.5rem;
    animation: fadeIn 0.3s ease;
}

#ProductsTable .add-to-cart-btn:hover {
    background-color: #2F855A;
}

#productsBox {
    max-height: 400px;
    overflow-y: auto;
    border-radius: 12px;
}

/* Calculation summary */
.calculation-summary {
    margin-top: 2rem;
    padding: 1.5rem;
    background-color: #F7FAFC;
    border-radius: 12px;
    text-align: left;
}

.summary-item {
    margin-bottom: 0.75rem;
    font-size: 1rem;
    color: #2D3748;
}

.summary-item strong {
    color: #FF6200;
}

/* Progress indicator */
.progress-container {
    display: flex;
    justify-content: center;
    margin: 2rem 0;
    position: sticky;
    top: 20px;
    z-index: 10;
}

.progress-step {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background-color: #E2E8F0;
    margin: 0 10px;
    transition: all 0.3s ease;
    position: relative;
}

.progress-step::before {
    left: -14px; /* Adjust to align with previous step */
    width: 14px; /* Match the gap between steps */
    height: 2px;
    top: 6px;
    background-color: #E2E8F0;
    transition: all 0.3s ease;
}

.progress-step:first-child::before {
    display: none;
}

.progress-step.active {
    background-color: #FF6200;
    transform: scale(1.2);
}

.progress-step.active::before {
    background-color: #FF6200;
}

.button-loading {
    position: relative;
    pointer-events: none; /* Prevent clicks while loading */
    color: transparent !important; /* Hide text */
}

.button-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    border: 2px solid #FFFFFF;
    border-top-color: #FF6200;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    transform: translate(-50%, -50%);
}

@keyframes spin {
    to {
        transform: translate(-50%, -50%) rotate(360deg);
    }
}

/* Info message styling */
.info-message {
    margin-top: 1rem;
    background-color: #F7FAFC;
    border-left: 4px solid #FF6200;
    padding: 1rem;
    border-radius: 0 8px 8px 0;
    display: flex;
    align-items: flex-start;
}

.info-icon {
    margin-right: 0.75rem;
    font-size: 1.2rem;
    color: #FF6200;
}

.info-content p {
    margin: 0.5rem 0;
    color: #4A5568;
}

/* Alert styling */
.alert {
    padding: 1rem;
    border-radius: 8px;
    margin: 1rem 0;
    font-weight: 500;
    display: flex;
    align-items: center;
    opacity: 0;
    transform: translateY(-10px);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.alert.show {
    opacity: 1;
    transform: translateY(0);
}

.alert-error {
    background-color: #FFF5F5;
    border-left: 4px solid #F56565;
    color: #C53030;
}

.alert-warning {
    background-color: #FFFAF0;
    border-left: 4px solid #F6E05E;
    color: #975A16;
}

.alert-success {
    background-color: #F0FFF4;
    border-left: 4px solid #68D391;
    color: #2B6CB0;
}

.alert-icon {
    margin-right: 0.75rem;
    font-size: 1.2rem;
}

/* Reset button */
#resetBtn {
    background-color: #718096;
}

#resetBtn:hover {
    background-color: #4A5568;
}

/* Responsive design */
@media (max-width: 768px) {
    .calculator {
        padding: 1rem;
        margin: 1rem;
    }

    .scene {
        padding: 1.5rem;
    }

    .option-card {
        width: 140px;
        padding: 1rem;
    }

    .button-group {
        flex-direction: column;
        gap: 0.5rem;
    }

    #ProductsTable th,
    #ProductsTable td {
        padding: 0.75rem;
        font-size: 0.875rem;
    }

    .grid-square {
        margin: 1px;
    }
}

/* Accessibility focus styles */
button:focus,
input:focus,
.option-card:focus-within {
    outline: 3px solid #FF6200;
    outline-offset: 2px;
}