* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
    color: #333;
}

.container {
    max-width: 900px;
    margin: 0 auto;
}

h1 {
    text-align: center;
    color: white;
    margin-bottom: 30px;
    font-size: 2.5em;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
}

.calculator-card {
    background: white;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    padding: 30px;
    margin-bottom: 20px;
}

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

.input-group {
    margin-bottom: 20px;
}

.input-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #555;
}

.input-group input[type="number"],
.input-group select {
    width: 100%;
    padding: 12px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 16px;
    transition: border-color 0.3s;
}

.input-group input[type="number"]:focus,
.input-group select:focus {
    outline: none;
    border-color: #667eea;
}

.input-group input[type="checkbox"] {
    margin-right: 8px;
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.calculate-btn {
    width: 100%;
    padding: 15px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 18px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.calculate-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.calculate-btn:active {
    transform: translateY(0);
}

.results-section {
    margin-top: 30px;
    border-top: 2px solid #e0e0e0;
    padding-top: 30px;
}

.results-section h2 {
    color: #667eea;
    margin-bottom: 20px;
    font-size: 1.8em;
}

.result-card {
    background: #f8f9fa;
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 20px;
    border-left: 4px solid #667eea;
}

.result-card.highlight {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-left: 4px solid #fff;
}

.result-card h3 {
    margin-bottom: 15px;
    color: #333;
    font-size: 1.3em;
}

.result-card.highlight h3 {
    color: white;
}

.result-row {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid #e0e0e0;
}

.result-card.highlight .result-row {
    border-bottom: 1px solid rgba(255, 255, 255, 0.3);
}

.result-row:last-child {
    border-bottom: none;
}

.result-row.total-row {
    font-weight: 700;
    font-size: 1.1em;
    padding-top: 15px;
    margin-top: 10px;
    border-top: 2px solid #667eea;
}

.result-card.highlight .result-row.total-row {
    border-top: 2px solid rgba(255, 255, 255, 0.5);
}

.result-row span:last-child {
    font-weight: 600;
    color: #667eea;
}

.result-card.highlight .result-row span:last-child {
    color: white;
}

/* Reference Table Styles */
.reference-table-container {
    overflow-x: auto;
    margin-top: 20px;
}

.reference-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: 8px;
    overflow: hidden;
}

.reference-table thead {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.reference-table th {
    padding: 15px;
    text-align: left;
    font-weight: 600;
    font-size: 1em;
}

.reference-table td {
    padding: 12px 15px;
    border-bottom: 1px solid #e0e0e0;
}

.reference-table tbody tr:hover {
    background-color: #f8f9fa;
}

.reference-table tbody tr:last-child td {
    border-bottom: none;
}

.reference-table .total-row-table {
    background-color: #f0f0f0;
    font-weight: 600;
}

.reference-table .total-row-table td {
    padding: 15px;
    border-top: 2px solid #667eea;
}

/* Advertisement Styles */
.ad-wrapper {
    display: flex;
    gap: 20px;
    margin: 20px 0;
    align-items: flex-start;
}

.ad-main-content {
    flex: 1;
    min-width: 0;
}

.ad-container {
    background: #f8f9fa;
    border: 2px dashed #ddd;
    border-radius: 10px;
    padding: 20px;
    margin: 20px 0;
    min-height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    color: #999;
}

.ad-sidebar {
    width: 200px;
    min-width: 200px;
    max-width: 200px;
    position: sticky;
    top: 20px;
    margin: 0;
}

.ad-container.has-ad {
    border: 2px solid #667eea;
    background: white;
}

.ad-container img {
    max-width: 100%;
    max-height: 200px;
    border-radius: 8px;
}

.ad-container a {
    display: block;
    text-decoration: none;
    color: inherit;
}

.ad-container .ad-content {
    width: 100%;
}

/* Admin Link */
.admin-link {
    display: inline-block;
    padding: 10px 20px;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    text-decoration: none;
    border-radius: 8px;
    font-size: 14px;
    transition: background 0.3s;
}

.admin-link:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Login Styles */
.login-container {
    max-width: 400px;
    margin: 100px auto;
}

.login-card {
    background: white;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    padding: 40px;
}

.login-card h2 {
    text-align: center;
    color: #667eea;
    margin-bottom: 30px;
}

.login-error {
    background: #fee;
    color: #c33;
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 20px;
    display: none;
}

.login-error.show {
    display: block;
}

@media (max-width: 768px) {
    h1 {
        font-size: 2em;
    }
    
    .calculator-card {
        padding: 20px;
    }
    
    .result-row {
        flex-direction: column;
        gap: 5px;
    }
    
    .result-row span:last-child {
        text-align: right;
    }
    
    .reference-table {
        font-size: 14px;
    }
    
    .reference-table th,
    .reference-table td {
        padding: 8px;
    }
    
    .ad-wrapper {
        flex-direction: column;
    }
    
    .ad-sidebar {
        width: 100%;
        min-width: 100%;
        max-width: 100%;
        position: static;
    }
}
