body, div, input, li, p, span, td, textarea {
    font-family: Arial, Helvetica, sans-serif;
    font-size: 16px;
}

.calculator-container {
    background: linear-gradient(to right, #f8f9fa, #e0eafc);
    width: 100%;
    max-width: 650px;
    margin: 20px auto;
    padding: 25px;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    border: 1px solid #333;
}

.calculator-title {
    text-align: center;
    color: #053b7d;
    margin-bottom: 5px;
    font-size: 28px;
}

.calculator-subtitle {
    text-align: center;
    color: #666;
    margin-bottom: 20px;
    font-size: 14px;
}

.input-section {
    background: #fff;
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 15px;
}

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

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

.input-group input,
.input-group select {
    width: 100%;
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 5px;
    font-size: 16px;
    box-sizing: border-box;
}

.input-group input:focus,
.input-group select:focus {
    outline: none;
    border-color: #053b7d;
    box-shadow: 0 0 5px rgba(5, 59, 125, 0.3);
}

.inline-inputs {
    display: flex;
    gap: 10px;
}

.inline-inputs input {
    flex: 2;
}

.inline-inputs select {
    flex: 1;
}

.button-group {
    display: flex;
    gap: 10px;
    margin: 20px 0;
}

.btn-primary,
.btn-secondary {
    flex: 1;
    padding: 12px 20px;
    border: none;
    border-radius: 5px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.3s;
}

.btn-primary {
    background-color: #6f4e37;
    color: white;
}

.btn-primary:hover {
    background-color: #5a3d2b;
}

.btn-secondary {
    background-color: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background-color: #545b62;
}

.error-message {
    background-color: #f8d7da;
    color: #721c24;
    padding: 10px;
    border-radius: 5px;
    margin-bottom: 15px;
    text-align: center;
}

.sleep-warning {
    padding: 15px;
    border-radius: 10px;
    margin-bottom: 20px;
    text-align: center;
    font-weight: 600;
}

.sleep-warning.good {
    background: linear-gradient(135deg, #28a745, #20c997);
    color: white;
}

.sleep-warning.caution {
    background: linear-gradient(135deg, #ffc107, #fd7e14);
    color: #333;
}

.sleep-warning.bad {
    background: linear-gradient(135deg, #dc3545, #c82333);
    color: white;
}

.sleep-warning-icon {
    font-size: 24px;
    margin-bottom: 5px;
}

.caffeine-summary {
    background: #fff;
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 20px;
}

.caffeine-summary h3 {
    color: #053b7d;
    margin: 0 0 15px 0;
    text-align: center;
}

.summary-cards {
    display: flex;
    gap: 10px;
}

.summary-card {
    flex: 1;
    background: linear-gradient(135deg, #6f4e37, #8b6914);
    color: white;
    padding: 15px;
    border-radius: 10px;
    text-align: center;
}

.summary-label {
    font-size: 12px;
    opacity: 0.9;
    margin-bottom: 5px;
}

.summary-value {
    font-size: 24px;
    font-weight: 700;
}

.summary-note {
    font-size: 10px;
    opacity: 0.8;
    margin-top: 5px;
}

.timeline-section {
    background: #fff;
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 20px;
}

.timeline-section h3 {
    color: #053b7d;
    margin: 0 0 15px 0;
    text-align: center;
}

.timeline-graph {
    display: flex;
    align-items: flex-end;
    height: 200px;
    gap: 2px;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 5px;
    overflow-x: auto;
}

.graph-bar {
    flex: 1;
    min-width: 30px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
}

.bar-fill {
    width: 100%;
    border-radius: 3px 3px 0 0;
    transition: height 0.3s;
    position: relative;
}

.bar-fill.high {
    background: linear-gradient(to top, #dc3545, #ff6b6b);
}

.bar-fill.caution {
    background: linear-gradient(to top, #ffc107, #ffda6a);
}

.bar-fill.safe {
    background: linear-gradient(to top, #28a745, #5cb85c);
}

.bar-label {
    font-size: 10px;
    color: #666;
    margin-top: 5px;
    text-align: center;
}

.bar-value {
    font-size: 9px;
    color: #333;
    font-weight: 600;
}

.timeline-legend {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 15px;
    flex-wrap: wrap;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    color: #666;
}

.legend-color {
    width: 12px;
    height: 12px;
    border-radius: 2px;
}

.legend-color.safe {
    background: #28a745;
}

.legend-color.caution {
    background: #ffc107;
}

.legend-color.high {
    background: #dc3545;
}

.levels-table-section {
    background: #fff;
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 20px;
}

.levels-table-section h3 {
    color: #053b7d;
    margin: 0 0 15px 0;
    text-align: center;
}

.levels-table {
    max-height: 250px;
    overflow-y: auto;
}

.level-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 15px;
    border-bottom: 1px solid #eee;
}

.level-row:nth-child(even) {
    background: #f8f9fa;
}

.level-row.header {
    font-weight: 600;
    background: #e8f0fe;
    position: sticky;
    top: 0;
}

.tips-section {
    background: #fff;
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 20px;
}

.tips-section h3 {
    color: #053b7d;
    margin: 0 0 15px 0;
}

.tips-list {
    margin: 0;
    padding-left: 20px;
}

.tips-list li {
    margin-bottom: 8px;
    color: #555;
}

.caffeine-reference {
    background: #fff;
    padding: 20px;
    border-radius: 10px;
    margin-top: 20px;
}

.caffeine-reference h3 {
    color: #053b7d;
    margin: 0 0 15px 0;
    text-align: center;
}

.reference-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

.reference-item {
    display: flex;
    justify-content: space-between;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 5px;
    border-left: 3px solid #6f4e37;
}

.item-name {
    color: #333;
    font-size: 14px;
}

.item-amount {
    font-weight: 700;
    color: #6f4e37;
}

.disclaimer {
    background: #fff3cd;
    padding: 15px;
    border-radius: 5px;
    margin-top: 20px;
    font-size: 13px;
    color: #856404;
    border: 1px solid #ffc107;
}

.disclaimer-text {
    text-align: center;
    color: #666;
    font-size: 14px;
}

.share-buttons {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
}

.smaller-button {
    padding: 8px 15px;
    background: #6f4e37;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
}

.smaller-button:hover {
    background: #5a3d2b;
}

@media (max-width: 500px) {
    .calculator-container {
        padding: 15px;
    }

    .summary-cards {
        flex-direction: column;
    }

    .reference-grid {
        grid-template-columns: 1fr;
    }

    .timeline-legend {
        flex-direction: column;
        align-items: center;
    }
}
