/* Mobile-First Responsive Design for Nephro Calculators */

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

:root {
    --primary-color: #2c5aa0;
    --secondary-color: #4a90e2;
    --accent-color: #7bb3f0;
    --success-color: #28a745;
    --warning-color: #ffc107;
    --danger-color: #dc3545;
    --light-bg: #f8f9fa;
    --dark-text: #2c3e50;
    --light-text: #6c757d;
    --border-color: #dee2e6;
    --shadow: 0 2px 10px rgba(0,0,0,0.1);
    --border-radius: 12px;
    --transition: all 0.3s ease;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
    color: var(--dark-text);
    background-color: var(--light-bg);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.app-container {
    max-width: 100%;
    margin: 0 auto;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header */
.app-header {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    padding: 2rem 1rem;
    text-align: center;
    box-shadow: var(--shadow);
}

.app-header h1 {
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.subtitle {
    font-size: 1rem;
    opacity: 0.9;
    font-weight: 400;
}

.creator {
    font-size: 0.9rem;
    opacity: 0.9;
    font-weight: 500;
    margin-top: 0.5rem;
    font-style: italic;
    line-height: 1.4;
}

.social-link {
    color: #ffffff;
    text-decoration: none;
    font-weight: 600;
    border-bottom: 1px solid rgba(255,255,255,0.3);
    transition: all 0.3s ease;
}

.social-link:hover {
    color: #4a90e2;
    border-bottom-color: #4a90e2;
    text-decoration: none;
}

/* Main Content */
.main-content {
    flex: 1;
    padding: 1.5rem 1rem;
}

.calculator-categories h2 {
    font-size: 1.4rem;
    color: var(--primary-color);
    margin: 2rem 0 1rem 0;
    font-weight: 600;
    border-bottom: 2px solid var(--accent-color);
    padding-bottom: 0.5rem;
}

.calculator-categories h2:first-child {
    margin-top: 0;
}

/* Calculator Grid */
.calculator-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
    margin-bottom: 2rem;
}

.calculator-card {
    background: white;
    border-radius: var(--border-radius);
    padding: 1.5rem;
    box-shadow: var(--shadow);
    cursor: pointer;
    transition: var(--transition);
    border: 2px solid transparent;
    text-align: center;
}

.calculator-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    border-color: var(--accent-color);
}

.calculator-card:active {
    transform: translateY(0);
}

.card-icon {
    font-size: 2.5rem;
    margin-bottom: 1rem;
}

.calculator-card h3 {
    font-size: 1.2rem;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.calculator-card p {
    color: var(--dark-text);
    font-size: 0.9rem;
    line-height: 1.4;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    backdrop-filter: blur(5px);
}

.modal-content {
    background-color: white;
    margin: 2% auto;
    padding: 0;
    border-radius: var(--border-radius);
    width: 95%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-header {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    padding: 1.5rem;
    border-radius: var(--border-radius) var(--border-radius) 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    font-size: 1.4rem;
    font-weight: 600;
}

.close-btn {
    background: none;
    border: none;
    color: white;
    font-size: 2rem;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: var(--transition);
}

.close-btn:hover {
    background-color: rgba(255,255,255,0.2);
}

.modal-body {
    padding: 2rem;
}

/* Form Styles */
.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--dark-text);
    font-size: 0.95rem;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    transition: var(--transition);
    background-color: white;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(44, 90, 160, 0.1);
}

.form-group .input-group {
    display: flex;
    align-items: center;
}

.form-group .input-group input {
    border-radius: 8px 0 0 8px;
    border-right: none;
}

.form-group .input-group .unit {
    background-color: var(--light-bg);
    border: 2px solid var(--border-color);
    border-left: none;
    border-radius: 0 8px 8px 0;
    padding: 0.75rem;
    color: var(--dark-text);
    font-weight: 500;
    min-width: 60px;
    text-align: center;
}

/* Buttons */
.btn {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    width: 100%;
    margin-top: 1rem;
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(44, 90, 160, 0.3);
}

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

.btn-secondary {
    background: var(--light-text);
}

.btn-success {
    background: var(--success-color);
}

/* Results */
.result-container {
    background: linear-gradient(135deg, #ffffff, #f8f9fa);
    border: 2px solid var(--primary-color);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    margin-top: 1.5rem;
    text-align: center;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.result-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

.result-label {
    font-size: 1.1rem;
    color: #2c3e50 !important;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.result-description {
    font-size: 0.9rem;
    color: #2c3e50 !important;
    line-height: 1.4;
    font-weight: 500;
}

/* Ensure all result text is dark - AGGRESSIVE OVERRIDE */
.result-container .result-description,
.result-container .result-label,
.result-container .result-value,
.result-container p,
.result-container div,
.result-container span {
    color: #2c3e50 !important;
}

.result-container .result-value {
    color: var(--primary-color) !important;
}

/* Force ALL text in calculators to be dark */
.modal-body * {
    color: #2c3e50 !important;
}

.modal-body .result-value {
    color: var(--primary-color) !important;
}

.modal-body .btn {
    color: white !important;
}

/* Override any white text */
* {
    color: #2c3e50 !important;
}

.btn, .close-btn, .modal-header, .app-header {
    color: white !important;
}

.result-value {
    color: var(--primary-color) !important;
}

/* Force text in clearance-ranking boxes to be dark */
.clearance-ranking * {
    color: #2c3e50 !important;
}

.clearance-ranking h5 {
    color: #2c3e50 !important;
    font-weight: 700 !important;
}

.result-item {
    margin-bottom: 1rem;
    padding: 0.75rem;
    background: rgba(255,255,255,0.9);
    border-radius: 8px;
    border-left: 4px solid var(--primary-color);
    border: 1px solid #e0e0e0;
}

.result-item .result-label {
    color: var(--dark-text);
    font-weight: 700;
}

.result-item .result-value {
    color: var(--primary-color);
    font-weight: 600;
}

.result-good {
    border-color: var(--success-color);
    background: linear-gradient(135deg, #ffffff, #f8f9fa);
}

.result-warning {
    border-color: var(--warning-color);
    background: linear-gradient(135deg, #ffffff, #f8f9fa);
}

.result-danger {
    border-color: var(--danger-color);
    background: linear-gradient(135deg, #ffffff, #f8f9fa);
}

/* Timetable and Details Boxes */
.timetable-container {
    margin: 1rem 0;
    padding: 1rem;
    background: #f8f9fa;
    border: 1px solid var(--border-color);
    border-radius: 8px;
}

.timetable {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.timetable-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 6px;
}

.timetable-item .time {
    font-weight: 600;
    color: var(--primary-color);
    min-width: 80px;
}

.timetable-item .action {
    color: var(--dark-text);
    text-align: right;
    flex: 1;
}

.details-box {
    margin: 1rem 0;
    padding: 1rem;
    background: #ffffff;
    border: 2px solid #ffc107;
    border-radius: 8px;
    color: #2c3e50;
    font-size: 0.9rem;
    line-height: 1.4;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    font-weight: 500;
}

.details-box p,
.details-box div,
.details-box span {
    color: #2c3e50;
}

.details-box strong {
    color: #000000;
    font-weight: 700;
}

/* Protocol Reference Tables */
.protocol-table {
    margin: 1rem 0;
    background: white;
    border-radius: 8px;
    padding: 1rem;
    border: 1px solid var(--border-color);
}

.protocol-table h5 {
    color: var(--primary-color);
    margin-bottom: 0.5rem;
    font-size: 1rem;
}

.protocol-reference {
    width: 100%;
    border-collapse: collapse;
    margin: 0.5rem 0;
    font-size: 0.85rem;
}

.protocol-reference th {
    background: var(--primary-color);
    color: white;
    padding: 0.5rem;
    text-align: left;
    font-weight: 600;
    border: 1px solid var(--primary-color);
}

.protocol-reference td {
    padding: 0.5rem;
    border: 1px solid var(--border-color);
    background: white;
    color: var(--dark-text);
}

.protocol-reference tr:nth-child(even) td {
    background: #f8f9fa;
}

.protocol-reference tr:hover td {
    background: #e8f4fd;
}

/* Info Boxes */
.info-box {
    background: #e8f4fd;
    border-left: 4px solid var(--primary-color);
    padding: 1rem;
    margin: 1rem 0;
    border-radius: 0 8px 8px 0;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    color: var(--dark-text);
}

.info-box * {
    color: inherit;
}

.info-box h4 {
    color: var(--primary-color);
    margin-bottom: 0.5rem;
    font-size: 1rem;
}

.info-box p {
    color: var(--dark-text);
    font-size: 0.9rem;
    line-height: 1.4;
    font-weight: 500;
}

/* Clearance Ranking */
.clearance-ranking {
    background: #f8f9fa;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1rem;
    margin: 1rem 0;
    text-align: center;
    color: var(--dark-text);
}

.clearance-ranking * {
    color: inherit;
}

.clearance-ranking h5 {
    color: var(--primary-color);
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    font-weight: 600;
}

.clearance-ranking p {
    color: var(--dark-text);
    font-size: 0.85rem;
    margin: 0;
    font-weight: 500;
}

/* Recommendations */
.recommendations {
    background: #f8f9fa;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 0.9rem;
    color: var(--dark-text);
}

.recommendations * {
    color: inherit;
}

.recommendations h6 {
    margin-bottom: 0.5rem;
    color: var(--primary-color);
    font-size: 0.9rem;
    font-weight: 600;
}

.recommendations ul {
    margin: 0.5rem 0;
    padding-left: 1.5rem;
}

.recommendations li {
    margin-bottom: 0.3rem;
    line-height: 1.4;
    color: var(--dark-text);
}

.recommendations strong {
    color: var(--primary-color);
}

/* Responsive Design */
@media (min-width: 768px) {
    .calculator-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .app-header h1 {
        font-size: 2.2rem;
    }
    
    .subtitle {
        font-size: 1.1rem;
    }
}

@media (min-width: 1024px) {
    .calculator-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .modal-content {
        width: 80%;
        max-width: 600px;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    :root {
        --light-bg: #1a1a1a;
        --dark-text: #ffffff;
        --light-text: #b0b0b0;
        --border-color: #333333;
    }
    
    body {
        background-color: var(--light-bg);
    }
    
    .calculator-card {
        background: #2a2a2a;
        color: white;
    }
    
    .modal-content {
        background: #2a2a2a;
        color: white;
    }
    
    .form-group input,
    .form-group select {
        background: #333333;
        border-color: #444444;
        color: white;
    }
}
