* {
    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;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

header {
    background: linear-gradient(135deg, #1976d2 0%, #1565c0 100%);
    color: white;
    padding: 30px 20px;
    text-align: center;
}

header h1 {
    font-size: 32px;
    margin-bottom: 8px;
    font-weight: 700;
}

header .subtitle {
    font-size: 14px;
    opacity: 0.95;
    font-weight: 300;
}

.warning-box {
    background: #fff3e0;
    border-left: 4px solid #ff9800;
    padding: 15px 20px;
    margin: 20px;
    border-radius: 4px;
}

.warning-box p {
    color: #e65100;
    margin-bottom: 8px;
    font-size: 14px;
    line-height: 1.4;
}

.warning-box p:last-child {
    margin-bottom: 0;
}

.warning-box strong {
    color: #d84315;
}

.patient-info-section {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    padding: 20px;
    background: #f5f5f5;
    border-bottom: 1px solid #e0e0e0;
}

.form-group {
    display: flex;
    flex-direction: column;
}

.form-group label {
    font-weight: 600;
    margin-bottom: 6px;
    color: #333;
    font-size: 13px;
}

.form-group input,
.form-group select {
    padding: 10px 12px;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    font-size: 14px;
    transition: all 0.3s ease;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #1976d2;
    box-shadow: 0 0 0 3px rgba(25, 118, 210, 0.1);
}

.base-doses-section {
    padding: 20px;
    background: white;
}

.base-doses-section h2 {
    color: #1976d2;
    font-size: 18px;
    margin-bottom: 15px;
    border-bottom: 2px solid #e3f2fd;
    padding-bottom: 10px;
}

.doses-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
}

.isf-section {
    padding: 20px;
    background: #f3e5f5;
    border-radius: 8px;
    margin: 20px;
}

.isf-section h2 {
    color: #6a1b9a;
    font-size: 18px;
    margin-bottom: 15px;
}

.isf-display {
    background: white;
    padding: 15px;
    border-radius: 6px;
    margin-bottom: 15px;
    border-left: 4px solid #6a1b9a;
}

.isf-display p {
    margin-bottom: 8px;
    color: #333;
}

.isf-display p:last-child {
    margin-bottom: 0;
}

.isf-display strong {
    color: #6a1b9a;
}

.isf-display span {
    color: #1976d2;
    font-weight: 700;
}

.calculator-section {
    padding: 20px;
    background: white;
}

.calculator-section h2 {
    color: #388e3c;
    font-size: 18px;
    margin-bottom: 8px;
    border-bottom: 2px solid #e8f5e9;
    padding-bottom: 10px;
}

.section-description {
    color: #666;
    font-size: 13px;
    margin-bottom: 15px;
    font-style: italic;
}

.section-description-ar {
    color: #666;
    font-size: 13px;
    margin-bottom: 15px;
    font-style: italic;
    direction: rtl;
}

/* Unit Toggle */
.unit-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
    padding: 10px;
    background: #f5f5f5;
    border-radius: 6px;
}

.unit-toggle label {
    font-weight: 600;
    color: #333;
    margin: 0;
}

.unit-btn {
    padding: 6px 12px;
    border: 2px solid #ddd;
    background: white;
    color: #333;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    transition: all 0.3s ease;
}

.unit-btn:hover {
    border-color: #1976d2;
    color: #1976d2;
}

.unit-btn.active {
    background: #1976d2;
    color: white;
    border-color: #1976d2;
}

.meals-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.meal-card {
    background: #e8f5e9;
    border: 2px solid #c8e6c9;
    border-radius: 8px;
    padding: 15px;
    transition: all 0.3s ease;
}

.meal-card:hover {
    box-shadow: 0 4px 12px rgba(56, 142, 60, 0.15);
    border-color: #388e3c;
}

.meal-card h3 {
    color: #388e3c;
    font-size: 15px;
    margin-bottom: 12px;
    font-weight: 600;
}

.dose-result {
    background: white;
    padding: 12px;
    border-radius: 6px;
    color: #388e3c;
    font-weight: 600;
    text-align: center;
    margin-top: 10px;
    border-left: 3px solid #388e3c;
}

.correction-section {
    padding: 20px;
    background: #fff3e0;
    border-radius: 8px;
    margin: 20px;
}

.correction-section h2 {
    color: #e65100;
    font-size: 18px;
    margin-bottom: 8px;
    border-bottom: 2px solid #ffe0b2;
    padding-bottom: 10px;
}

.correction-section .form-group {
    margin-bottom: 15px;
}

.correction-section .dose-result {
    background: #ffccbc;
    color: #d84315;
    border-left-color: #d84315;
}

.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-primary {
    background: #1976d2;
    color: white;
}

.btn-primary:hover {
    background: #1565c0;
    box-shadow: 0 4px 12px rgba(25, 118, 210, 0.3);
}

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

.btn-secondary:hover {
    background: #616161;
}

.btn-large {
    width: 100%;
    padding: 12px;
    font-size: 16px;
    margin-top: 10px;
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-content {
    background: white;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    max-width: 400px;
    width: 90%;
}

.modal-content h3 {
    color: #333;
    margin-bottom: 15px;
    font-size: 18px;
}

.modal-content input {
    width: 100%;
    padding: 10px 12px;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    font-size: 14px;
    margin-bottom: 15px;
}

.modal-content input:focus {
    outline: none;
    border-color: #1976d2;
    box-shadow: 0 0 0 3px rgba(25, 118, 210, 0.1);
}

.modal-buttons {
    display: flex;
    gap: 10px;
}

.modal-buttons button {
    flex: 1;
}

footer {
    background: #f5f5f5;
    padding: 20px;
    text-align: center;
    border-top: 1px solid #e0e0e0;
}

footer p {
    color: #666;
    font-size: 13px;
    margin: 4px 0;
}

@media (max-width: 768px) {
    header h1 {
        font-size: 24px;
    }

    .patient-info-section {
        grid-template-columns: 1fr;
    }

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

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