/* Global Styles */
* {
    box-sizing: border-box;
    font-family: Arial, sans-serif;
}

body {
    background-color: #f4f4f4;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    color: #333;
}

/* Header */
.header {
    width: 100%;
    background-color: #2ecc71;
    color: white;
    text-align: center;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: sticky;
    top: 0;
    z-index: 1000;
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.logo {
    height: 60px;
    object-fit: contain;
    margin-right: 20px;
}

.header-title {
    font-size: 1.5rem;
    font-weight: bold;
    text-transform: uppercase;
    flex-grow: 1;
}

/* Main Content */
.cost-structure-container {
    max-width: 1200px;
    width: 100%;
    padding: 2rem;
    margin: 2rem auto;
}

.section-card {
    background: white;
    padding: 2rem;
    margin-bottom: 20px;
    border-radius: 8px;
    box-shadow: 0 0 10px rgba(0,0,0,0.1);
}

h2 {
    color: #2ecc71;
    border-bottom: 2px solid #2ecc71;
    padding-bottom: 10px;
    margin-bottom: 20px;
    text-align: center;
}
h3 {
    text-align: center;
    margin-top: 0;
    font-size: 1.2rem;
}

/* Setup Controls */
.setup-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    margin-bottom: 20px;
}
.form-group {
    display: flex;
    align-items: center;
    gap: 10px;
}
.form-label {
    font-weight: bold;
}
.form-control {
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 1rem;
    min-width: 250px;
}
.button-group {
    display: flex;
    gap: 10px;
}

/* Cost Categories Input Form */
.cost-category {
    background-color: #f9f9f9;
    padding: 15px;
    margin-bottom: 10px;
    border-radius: 6px;
    border: 1px solid #ddd;
    transition: all 0.2s;
}
.cost-category-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    font-weight: bold;
}
.category-title {
    font-size: 1.2rem;
    display: flex;
    align-items: center;
}
.category-title .total-amount {
    margin-left: 10px;
    font-weight: normal;
    font-size: 1rem;
    color: #666;
}
.cost-category-header .fas {
    margin-right: 10px;
    transition: transform 0.2s;
}
.cost-category.expanded .fas {
    transform: rotate(90deg);
}
.cost-category-details {
    padding-top: 15px;
    display: none;
}
.cost-category.expanded .cost-category-details {
    display: block;
}
.cost-item {
    display: grid;
    grid-template-columns: 1fr 150px 150px 50px;
    gap: 10px;
    align-items: center;
    margin-bottom: 10px;
}
.cost-item.cost-item-header {
    font-weight: bold;
}
.cost-item input, .cost-item select {
    padding: 8px;
    border: 1px solid #ccc;
    border-radius: 4px;
}
.cost-item .item-total {
    font-weight: bold;
    text-align: right;
    padding-right: 10px;
}
.cost-item .delete-btn {
    background: none;
    border: none;
    color: #e74c3c;
    cursor: pointer;
    font-size: 1.2rem;
}
.add-item-btn {
    background-color: #3498db;
    color: white;
    padding: 8px 15px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    margin-top: 10px;
}

/* Summary & Analysis */
.analysis-summary {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-bottom: 20px;
}
.total-cost-box {
    background-color: #2ecc71;
    color: white;
    padding: 20px;
    border-radius: 8px;
    text-align: center;
    flex-grow: 1;
    max-width: 400px;
}
.total-cost-box p {
    margin: 0 0 10px;
    font-size: 1.1rem;
}
#total-cost-display {
    font-size: 2.5rem;
    font-weight: bold;
}
.analysis-feedback {
    background-color: #f0f0f0;
    padding: 20px;
    border-radius: 8px;
    flex-grow: 1;
    max-width: 600px;
}
.analysis-feedback h3 {
    margin-top: 0;
    color: #007bff;
    text-align: center;
}
.analysis-feedback p {
    margin: 0;
    line-height: 1.5;
}

/* Detailed Report Table */
#cost-detail-table-container {
    margin-top: 30px;
}
#cost-detail-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
}
#cost-detail-table th, #cost-detail-table td {
    border: 1px solid #ddd;
    padding: 12px;
    text-align: left;
}
#cost-detail-table th {
    background-color: #f2f2f2;
    font-weight: bold;
}
#cost-detail-table .category-row {
    background-color: #eaf6ff;
    font-weight: bold;
}
#cost-detail-table .total-row {
    background-color: #2ecc71;
    color: white;
    font-weight: bold;
}
#cost-detail-table .total-row td:last-child {
    text-align: right;
}

.chart-area {
    display: flex;
    gap: 20px;
    justify-content: center;
    margin-top: 30px;
}
.chart-box {
    width: 500px;
    height: 400px;
    padding: 20px;
    border: 1px solid #ddd;
    border-radius: 8px;
    background-color: #fff;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

/* Buttons */
.btn-success {
    background-color: #2ecc71;
    color: white;
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1rem;
    transition: background-color 0.3s;
}
.btn-success:hover {
    background-color: #27ae60;
}

/* Responsive */
@media (max-width: 768px) {
    .cost-structure-container {
        padding: 1rem;
    }
    .header-title {
        font-size: 1rem;
    }
    .setup-controls {
        flex-direction: column;
        align-items: flex-start;
    }
    .form-group {
        width: 100%;
    }
    .form-control {
        min-width: unset;
        width: 100%;
    }
    .cost-item {
        grid-template-columns: 1fr;
    }
    .analysis-summary, .chart-area {
        flex-direction: column;
    }
    .chart-box {
        width: 100%;
    }
    #cost-detail-table {
        font-size: 0.8rem;
    }
    #cost-detail-table th, #cost-detail-table td {
        padding: 8px;
    }
}