/* ==========================================
   Margin Calculator Specific Styles
   ========================================== */

.page-header {
    text-align: center;
    padding: 40px 20px;
    margin-bottom: 30px;
}

.page-header h1 {
    font-size: 2.5rem;
    color: var(--text-primary);
    margin-bottom: 15px;
    font-weight: 700;
    line-height: 1.3;
}

.page-header .lead-description {
    font-size: 1.1rem;
    color: var(--text-secondary);
    line-height: 1.8;
    max-width: 900px;
    margin: 0 auto;
}

/* ==========================================
   Calculator Container
   ========================================== */

.calculator-section {
    padding: 40px 0;
}

.calculator-container {
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.08);
    overflow: hidden;
}

/* ==========================================
   Result Summary (Top)
   ========================================== */

.result-summary-top {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    padding: 30px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.summary-card {
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    border-radius: 12px;
    padding: 25px;
    text-align: center;
    border: 1px solid rgba(255, 255, 255, 0.2);
    transition: all 0.3s ease;
}

.summary-card.highlight {
    background: rgba(255, 255, 255, 0.25);
    border: 2px solid rgba(255, 255, 255, 0.4);
}

.summary-label {
    font-size: 0.95rem;
    color: rgba(255, 255, 255, 0.9);
    margin-bottom: 12px;
    font-weight: 500;
}

.summary-value {
    font-size: 2rem;
    font-weight: 700;
    color: white;
}

/* ==========================================
   Input Container
   ========================================== */

.input-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 30px;
    padding: 30px;
}

.input-column {
    display: flex;
    flex-direction: column;
    gap: 25px;
}

/* ==========================================
   Form Sections
   ========================================== */

.form-section {
    background: #f8f9fa;
    padding: 25px;
    border-radius: 10px;
    border: 1px solid #e9ecef;
}

.form-section h3 {
    font-size: 1.3rem;
    color: var(--text-primary);
    margin-bottom: 20px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group:last-child {
    margin-bottom: 0;
}

.form-group label {
    display: block;
    font-size: 0.95rem;
    color: var(--text-primary);
    margin-bottom: 8px;
    font-weight: 500;
}

.input-with-unit {
    display: flex;
    align-items: center;
    background: white;
    border: 2px solid #dee2e6;
    border-radius: 8px;
    overflow: hidden;
    transition: all 0.3s ease;
}

.input-with-unit:focus-within {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.1);
}

.input-with-unit input {
    flex: 1;
    padding: 12px 15px;
    border: none;
    font-size: 1rem;
    font-weight: 500;
    color: var(--text-primary);
}

.input-with-unit input:focus {
    outline: none;
}

.input-with-unit .unit {
    padding: 12px 15px;
    background: #f8f9fa;
    color: var(--text-secondary);
    font-size: 0.95rem;
    font-weight: 600;
    border-left: 2px solid #dee2e6;
}

.money-input {
    text-align: right;
}

.select-input {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #dee2e6;
    border-radius: 8px;
    font-size: 1rem;
    color: var(--text-primary);
    background: white;
    cursor: pointer;
    transition: all 0.3s ease;
}

.select-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.1);
}

.help-text {
    display: block;
    margin-top: 6px;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* ==========================================
   Buttons
   ========================================== */

.button-group {
    display: flex;
    gap: 15px;
    margin-top: 10px;
}

#btn-calculate {
    flex: 2;
}

.btn-secondary {
    flex: 1;
    padding: 14px 20px;
    background: #6c757d;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-secondary:hover {
    background: #5a6268;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(108, 117, 125, 0.3);
}

/* ==========================================
   Detailed Result
   ========================================== */

.detailed-result {
    margin-top: 30px;
    padding: 30px;
    background: #f8f9fa;
    border-top: 3px solid var(--primary-color);
}

.detailed-result h3 {
    font-size: 1.5rem;
    color: var(--text-primary);
    margin-bottom: 25px;
    font-weight: 700;
}

.result-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 25px;
}

.result-section {
    background: white;
    padding: 20px;
    border-radius: 10px;
    border: 1px solid #dee2e6;
}

.result-section h4 {
    font-size: 1.1rem;
    color: var(--primary-color);
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid #e9ecef;
    font-weight: 700;
}

.result-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid #f1f3f5;
}

.result-item:last-child {
    border-bottom: none;
}

.result-item span:first-child {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.result-item span:last-child {
    color: var(--text-primary);
    font-weight: 600;
    font-size: 1rem;
}

.result-item.total {
    margin-top: 10px;
    padding-top: 15px;
    border-top: 2px solid var(--primary-color);
    font-weight: 700;
}

.result-item.total span {
    font-size: 1.1rem;
    color: var(--primary-color);
}

.result-item.highlight {
    background: linear-gradient(135deg, rgba(74, 144, 226, 0.1), rgba(80, 200, 120, 0.1));
    padding: 15px;
    margin: 10px -5px;
    border-radius: 8px;
    border: 1px solid var(--primary-color);
}

.result-item.highlight span {
    color: var(--primary-color);
    font-weight: 700;
}

/* ==========================================
   Guide Section
   ========================================== */

.guide-section {
    margin-top: 50px;
    padding: 40px 20px;
}

.guide-section h2 {
    font-size: 2rem;
    color: var(--text-primary);
    margin-bottom: 30px;
    text-align: center;
    font-weight: 700;
}

.formula-box {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}

.formula-item {
    background: white;
    padding: 25px;
    border-radius: 10px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
    border-left: 4px solid var(--primary-color);
}

.formula-item h3 {
    font-size: 1.2rem;
    color: var(--primary-color);
    margin-bottom: 15px;
    font-weight: 700;
}

.formula {
    font-size: 0.95rem;
    color: var(--text-primary);
    line-height: 1.8;
    background: #f8f9fa;
    padding: 15px;
    border-radius: 6px;
    font-family: 'Consolas', monospace;
    margin: 0;
}

.tips-box {
    background: linear-gradient(135deg, rgba(74, 144, 226, 0.05), rgba(80, 200, 120, 0.05));
    padding: 30px;
    border-radius: 12px;
    border: 2px solid var(--primary-color);
}

.tips-box h3 {
    font-size: 1.4rem;
    color: var(--primary-color);
    margin-bottom: 20px;
    font-weight: 700;
}

.tips-box ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.tips-box ul li {
    font-size: 1rem;
    color: var(--text-primary);
    line-height: 1.8;
    margin-bottom: 15px;
    padding-left: 25px;
    position: relative;
}

.tips-box ul li:before {
    content: "✓";
    position: absolute;
    left: 0;
    color: var(--accent-color);
    font-weight: 700;
    font-size: 1.1rem;
}

.tips-box ul li:last-child {
    margin-bottom: 0;
}

/* ==========================================
   Responsive Design
   ========================================== */

@media (max-width: 768px) {
    .page-header h1 {
        font-size: 2rem;
    }

    .page-header p {
        font-size: 1rem;
    }

    .result-summary-top {
        grid-template-columns: 1fr;
        padding: 20px;
    }

    .summary-value {
        font-size: 1.6rem;
    }

    .input-container {
        grid-template-columns: 1fr;
        padding: 20px;
    }

    .button-group {
        flex-direction: column;
    }

    .result-grid {
        grid-template-columns: 1fr;
    }

    .formula-box {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .page-header {
        padding: 30px 15px;
    }

    .page-header h1 {
        font-size: 1.6rem;
    }

    .form-section {
        padding: 20px;
    }

    .summary-value {
        font-size: 1.4rem;
    }

    .guide-section h2 {
        font-size: 1.6rem;
    }

    .tips-box {
        padding: 20px;
    }
}