/* Aljanine EHR System - Modern CSS Styling */

* {
    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;
    color: #333;
}

/* Login Page Styles */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
}

.login-box {
    background: white;
    border-radius: 15px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    padding: 40px;
    width: 100%;
    max-width: 400px;
    text-align: center;
}

.login-header h1 {
    color: #667eea;
    margin-bottom: 10px;
    font-size: 2rem;
}

.login-header p {
    color: #666;
    margin-bottom: 30px;
}

.login-form .form-group {
    margin-bottom: 20px;
    text-align: left;
}

.login-form label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    color: #555;
}

.login-form input {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e1e5e9;
    border-radius: 8px;
    font-size: 16px;
    transition: border-color 0.3s ease;
}

.login-form input:focus {
    outline: none;
    border-color: #667eea;
}

.login-footer {
    margin-top: 30px;
    color: #999;
    font-size: 0.9rem;
}

/* Dashboard Styles */
.dashboard-container {
    background: #f8f9fa;
    min-height: 100vh;
}

.dashboard-header {
    background: white;
    padding: 20px 30px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-left h1 {
    color: #667eea;
    margin-bottom: 5px;
}

.user-info {
    color: #666;
    font-size: 0.9rem;
}

.dashboard-content {
    padding: 30px;
    max-width: 1200px;
    margin: 0 auto;
}

.patient-actions {
    margin-bottom: 30px;
}

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

.search-form {
    display: flex;
    gap: 10px;
    max-width: 500px;
}

.search-group {
    display: flex;
    flex: 1;
    gap: 10px;
}

.search-group input {
    flex: 1;
    padding: 12px 15px;
    border: 2px solid #e1e5e9;
    border-radius: 8px;
    font-size: 16px;
}

.search-group input:focus {
    outline: none;
    border-color: #667eea;
}

/* Patient Cards */
.patients-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.patient-card {
    background: white;
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.patient-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
}

.patient-info h3 {
    color: #667eea;
    margin-bottom: 10px;
}

.patient-info p {
    margin-bottom: 5px;
    color: #666;
}

.patient-actions {
    margin-top: 15px;
}

/* Form Styles */
.form-container {
    background: white;
    border-radius: 10px;
    padding: 30px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    max-width: 800px;
    margin: 0 auto;
}

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

.form-section h3 {
    color: #667eea;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid #e1e5e9;
}

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

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

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

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e1e5e9;
    border-radius: 8px;
    font-size: 16px;
    transition: border-color 0.3s ease;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: #667eea;
}

.form-group small {
    color: #666;
    font-size: 0.8rem;
    margin-top: 5px;
    display: block;
}

.form-actions {
    display: flex;
    gap: 15px;
    margin-top: 30px;
}

/* Patient Record Styles */
.patient-record {
    background: white;
    border-radius: 10px;
    padding: 30px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.record-section {
    margin-bottom: 40px;
    padding-bottom: 30px;
    border-bottom: 1px solid #e1e5e9;
}

.record-section:last-child {
    border-bottom: none;
}

.record-section h2 {
    color: #667eea;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

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

.info-item {
    display: flex;
    flex-direction: column;
}

.info-item label {
    font-weight: 600;
    color: #555;
    margin-bottom: 5px;
}

.info-item span {
    color: #333;
    font-size: 1.1rem;
}

/* Obstetric Form */
.obstetric-form {
    margin-top: 20px;
}

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

/* Compact Form Styles */
.form-grid-compact {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
    margin-bottom: 15px;
}

.form-row-compact {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr auto;
    gap: 10px;
    align-items: end;
    margin-bottom: 15px;
}

.form-row-compact .form-group {
    margin-bottom: 0;
}

.form-row-compact .form-group input {
    padding: 8px 10px;
    font-size: 14px;
}

.form-row-compact .form-group label {
    font-size: 12px;
    margin-bottom: 3px;
}

.form-grid-compact .form-group input {
    padding: 8px 10px;
    font-size: 14px;
}

.form-grid-compact .form-group label {
    font-size: 12px;
    margin-bottom: 3px;
}

/* Risk Assessment Tabs */
.risk-tabs {
    display: flex;
    margin-bottom: 20px;
    border-bottom: 2px solid #e1e5e9;
}

.tab-button {
    background: none;
    border: none;
    padding: 15px 25px;
    cursor: pointer;
    font-size: 16px;
    color: #666;
    border-bottom: 3px solid transparent;
    transition: all 0.3s ease;
}

.tab-button.active {
    color: #667eea;
    border-bottom-color: #667eea;
}

.tab-button:hover {
    color: #667eea;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

.risk-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
}

.risk-table th,
.risk-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #e1e5e9;
}

.risk-table th {
    background: #f8f9fa;
    font-weight: 600;
    color: #555;
}

/* Risk Entry Forms */
.risk-entry-form {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    border: 1px solid #e1e5e9;
}

.risk-entry-form .form-row-compact {
    margin-bottom: 0;
}

/* Visit Styles */
.visits-section {
    flex: 1;
    min-height: 400px;
}

.visits-section .section-header {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 25px;
    border: 2px solid #dee2e6;
}

.visits-section .section-header h2 {
    margin: 0;
}

.visits-section .section-header .btn-primary {
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
    transform: scale(1);
    transition: all 0.3s ease;
}

.visits-section .section-header .btn-primary:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 16px rgba(102, 126, 234, 0.4);
}

.visit-actions {
    margin-bottom: 20px;
}

.visits-list {
    display: flex;
    flex-direction: column;
    gap: 20px;
    max-height: 600px;
    overflow-y: auto;
    padding: 5px;
}

.visit-item {
    background: white;
    border-radius: 10px;
    padding: 25px;
    border: 2px solid #e9ecef;
    border-left: 5px solid #667eea;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
}

.visit-item:hover {
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.15);
    border-left-color: #5568d3;
}

.visit-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 12px 20px;
    border-radius: 8px;
    margin: -25px -25px 20px -25px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.visit-header h4 {
    color: white;
    margin: 0;
    font-size: 1.1em;
    font-weight: 600;
}

.visit-form {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.visit-form .form-group {
    margin-bottom: 0;
}

.visit-form .form-group label {
    display: block;
    font-weight: 600;
    color: #495057;
    margin-bottom: 8px;
    font-size: 0.95em;
}

.visit-form textarea {
    min-height: 120px;
    resize: vertical;
    width: 100%;
    padding: 12px;
    border: 2px solid #e1e5e9;
    border-radius: 8px;
    font-family: inherit;
    font-size: 14px;
    transition: border-color 0.3s ease;
    background-color: #f8f9fa;
}

.visit-form textarea:focus {
    outline: none;
    border-color: #667eea;
    background-color: white;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* Button Styles */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.3s ease;
    text-align: center;
}

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

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

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

.btn-secondary:hover {
    background: #5a6268;
    transform: translateY(-2px);
}

/* Message Styles */
.success-message,
.error-message,
.info-message {
    padding: 15px 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.success-message {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.error-message {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.info-message {
    background: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

.no-patients {
    text-align: center;
    color: #666;
    font-style: italic;
    padding: 40px;
}

/* Responsive Design */
@media (max-width: 768px) {
    .dashboard-header {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }
    
    .dashboard-content {
        padding: 20px;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .form-grid {
        grid-template-columns: 1fr;
    }
    
    .visit-form {
        grid-template-columns: 1fr;
    }
    
    .visit-item {
        padding: 20px 15px;
    }
    
    .visit-header {
        margin: -20px -15px 15px -15px;
        padding: 10px 15px;
    }
    
    .visit-actions {
        flex-direction: column;
    }
    
    .visit-actions .btn {
        width: 100%;
    }
    
    .patients-grid {
        grid-template-columns: 1fr;
    }
    
    .search-form {
        flex-direction: column;
    }
    
    .search-group {
        flex-direction: column;
    }
    
    .form-actions {
        flex-direction: column;
    }
    
    .risk-tabs {
        flex-direction: column;
    }
    
    .tab-button {
        text-align: left;
    }
}

@media (max-width: 480px) {
    .login-box {
        padding: 20px;
        margin: 10px;
    }
    
    .form-container,
    .patient-record {
        padding: 15px;
    }
    
    /* Mobile obstetric form - single column for very small screens */
    .obstetric-unified-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .obstetric-unified-grid .form-group:nth-child(1) { grid-column: 1 !important; grid-row: 1 !important; }
    .obstetric-unified-grid .form-group:nth-child(2) { grid-column: 1 !important; grid-row: 2 !important; }
    .obstetric-unified-grid .form-group:nth-child(3) { grid-column: 1 !important; grid-row: 3 !important; }
    .obstetric-unified-grid .form-group:nth-child(4) { grid-column: 1 !important; grid-row: 4 !important; }
    .obstetric-unified-grid .form-group:nth-child(5) { grid-column: 1 !important; grid-row: 5 !important; }
    .obstetric-unified-grid .form-group:nth-child(6) { grid-column: 1 !important; grid-row: 6 !important; }
    .obstetric-unified-grid .form-group:nth-child(7) { grid-column: 1 !important; grid-row: 7 !important; }
    .obstetric-unified-grid .form-group:nth-child(8) { grid-column: 1 !important; grid-row: 8 !important; }
    .obstetric-unified-grid .form-group:nth-child(9) { grid-column: 1 !important; grid-row: 9 !important; }
    
    /* Make buttons full width on mobile */
    .btn {
        width: 100%;
        margin-bottom: 10px;
    }
    
    /* Adjust section headers for mobile */
    .section-header {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }
    
    .section-header h2 {
        font-size: 1.2em;
        margin-bottom: 10px;
    }
    
    .dashboard-content {
        padding: 15px;
    }
    
    /* Improve touch targets for mobile */
    input, select, textarea, button {
        min-height: 44px;
        font-size: 16px; /* Prevents zoom on iOS */
    }
    
    /* Better spacing for mobile forms */
    .form-group {
        margin-bottom: 15px;
    }
    
    /* Make tables responsive */
    .table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    /* Adjust risk assessment grids for mobile */
    .risk-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    
    /* Better mobile navigation */
    .nav-tabs {
        flex-direction: column;
        gap: 5px;
    }
    
    .nav-tabs .tab-button {
        width: 100%;
        text-align: center;
        padding: 12px;
    }
}

/* Delete Button Styles */
.btn-danger {
    background: #dc3545;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.3s;
}

.btn-danger:hover {
    background: #c82333;
}

.btn-sm {
    padding: 4px 8px;
    font-size: 12px;
}

/* Alert Message Styles */
.alert {
    padding: 12px 16px;
    margin: 15px 0;
    border-radius: 4px;
    border: 1px solid transparent;
}

.alert-success {
    background-color: #d4edda;
    border-color: #c3e6cb;
    color: #155724;
}

.alert-danger {
    background-color: #f8d7da;
    border-color: #f5c6cb;
    color: #721c24;
}

/* Visit Actions */
.visit-actions {
    display: flex;
    gap: 10px;
    margin-top: 20px;
    padding-top: 15px;
    border-top: 2px solid #e9ecef;
}

.visit-actions .btn {
    flex: 1;
    justify-content: center;
    font-weight: 600;
    min-height: 42px;
}

/* Risk Table Actions */
.risk-table th:last-child,
.risk-table td:last-child {
    width: 80px;
    text-align: center;
}

/* Section Headers */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 1px solid #e9ecef;
}

.section-header h2 {
    margin: 0;
    flex: 1;
}

.section-header form {
    margin: 0;
}

/* Risk Assessment Tabs */
.risk-tabs {
    display: flex;
    margin-bottom: 20px;
    border-bottom: 2px solid #e9ecef;
}

.tab-button {
    background: none;
    border: none;
    padding: 12px 20px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    color: #6c757d;
    border-bottom: 3px solid transparent;
    transition: all 0.3s ease;
}

.tab-button:hover {
    color: #495057;
    background: #f8f9fa;
}

.tab-button.active {
    color: #007cba;
    border-bottom-color: #007cba;
    background: #f8f9fa;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

.risk-entry-form {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    border: 1px solid #e9ecef;
}

/* Unified Risk Table */
.unified-risk-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
}

.unified-risk-table th {
    background: #f8f9fa;
    font-weight: 600;
    padding: 12px 8px;
    text-align: left;
    border-bottom: 2px solid #dee2e6;
}

.unified-risk-table td {
    padding: 10px 8px;
    border-bottom: 1px solid #dee2e6;
    vertical-align: top;
}

.risk-type {
    font-weight: 600;
    text-align: center;
    min-width: 100px;
}

.antenatal-type {
    color: #28a745;
    background: rgba(40, 167, 69, 0.1);
}

.intrapartum-type {
    color: #ffc107;
    background: rgba(255, 193, 7, 0.1);
}

.postpartum-type {
    color: #dc3545;
    background: rgba(220, 53, 69, 0.1);
}

.antenatal-risk {
    border-left: 4px solid #28a745;
}

.intrapartum-risk {
    border-left: 4px solid #ffc107;
}

.postpartum-risk {
    border-left: 4px solid #dc3545;
}

/* Compact Demographics Section */
.demographics-compact {
    margin-bottom: 20px;
}

.demographics-compact h2 {
    font-size: 1.2em;
    margin-bottom: 10px;
}

.demographics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e9ecef;
}

.demographic-item {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.demographic-item label {
    font-weight: 600;
    color: #495057;
    font-size: 0.9em;
}

.demographic-item span {
    font-size: 0.95em;
    color: #212529;
    padding: 5px 8px;
    background: white;
    border-radius: 4px;
    border: 1px solid #dee2e6;
}

/* Demographics Form */
.demographics-form {
    margin-bottom: 20px;
}

.demographics-form h3 {
    font-size: 1.1em;
    margin-bottom: 15px;
    color: #495057;
}

.demographics-form-grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    gap: 20px;
    align-items: end;
}

/* New Patient Form Grid - Better organized layout */
.new-patient-form-grid {
    display: grid;
    grid-template-columns: 2fr 1.5fr 1fr;
    gap: 25px;
    align-items: start;
    max-width: 800px;
    margin: 0 auto;
}

.new-patient-form-grid .form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.new-patient-form-grid label {
    font-weight: 600;
    color: #333;
    font-size: 14px;
}

.new-patient-form-grid small {
    color: #666;
    font-size: 12px;
    margin-top: 4px;
}

.input-name {
    width: 100%;
    max-width: 300px;
    padding: 12px;
    border: 2px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.3s ease;
}

.input-name:focus {
    border-color: #007cba;
    outline: none;
    box-shadow: 0 0 0 3px rgba(0, 124, 186, 0.1);
}

.input-date-large {
    width: 100%;
    max-width: 200px;
    padding: 12px;
    border: 2px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.3s ease;
}

.input-date-large:focus {
    border-color: #007cba;
    outline: none;
    box-shadow: 0 0 0 3px rgba(0, 124, 186, 0.1);
}

.input-date {
    width: 100%;
    max-width: 220px;
    padding-right: 40px;
}

.input-unit {
    width: 100%;
    max-width: 120px;
    padding: 12px;
    border: 2px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.3s ease;
}

.input-unit:focus {
    border-color: #007cba;
    outline: none;
    box-shadow: 0 0 0 3px rgba(0, 124, 186, 0.1);
}

/* Field error styling */
.field-error {
    border-color: #dc3545 !important;
    box-shadow: 0 0 0 3px rgba(220, 53, 69, 0.1) !important;
}

.field-error:focus {
    border-color: #dc3545 !important;
    box-shadow: 0 0 0 3px rgba(220, 53, 69, 0.2) !important;
}

/* Obstetric Form Styling */
.obstetric-unified-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 15px;
    margin-bottom: 20px;
}

.obstetric-unified-grid .form-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

/* Desktop layout - First row: Gravida, Para, Miscarriages, Ectopic, LMP, Conception */
@media (min-width: 769px) {
    .obstetric-unified-grid .form-group:nth-child(1) { grid-column: 1; grid-row: 1; }
    .obstetric-unified-grid .form-group:nth-child(2) { grid-column: 2; grid-row: 1; }
    .obstetric-unified-grid .form-group:nth-child(3) { grid-column: 3; grid-row: 1; }
    .obstetric-unified-grid .form-group:nth-child(4) { grid-column: 4; grid-row: 1; }
    .obstetric-unified-grid .form-group:nth-child(5) { grid-column: 5; grid-row: 1; }
    .obstetric-unified-grid .form-group:nth-child(6) { grid-column: 6; grid-row: 1; }

    /* Second row: EDD, GA Weeks, GA Days */
    .obstetric-unified-grid .form-group:nth-child(7) { grid-column: 1; grid-row: 2; }
    .obstetric-unified-grid .form-group:nth-child(8) { grid-column: 2; grid-row: 2; }
    .obstetric-unified-grid .form-group:nth-child(9) { grid-column: 3; grid-row: 2; }
}

.obstetric-unified-grid label {
    font-weight: 500;
    color: #495057;
    font-size: 0.9em;
}

.input-number {
    width: 100%;
    max-width: 120px;
    text-align: center;
}

.input-date {
    width: 100%;
    max-width: 220px;
    padding-right: 40px;
}

/* Responsive adjustments for demographics */
@media (max-width: 768px) {
    .demographics-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    
    .demographics-form-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .new-patient-form-grid {
        grid-template-columns: 1fr;
        gap: 20px;
        max-width: 100%;
    }
    
    .input-name,
    .input-date,
    .input-date-large,
    .input-unit {
        max-width: 100%;
    }
    
    .obstetric-unified-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }
    
    /* Mobile obstetric form - reset all positioning for 2-column layout */
    .obstetric-unified-grid .form-group:nth-child(1) { grid-column: 1 !important; grid-row: 1 !important; }
    .obstetric-unified-grid .form-group:nth-child(2) { grid-column: 2 !important; grid-row: 1 !important; }
    .obstetric-unified-grid .form-group:nth-child(3) { grid-column: 1 !important; grid-row: 2 !important; }
    .obstetric-unified-grid .form-group:nth-child(4) { grid-column: 2 !important; grid-row: 2 !important; }
    .obstetric-unified-grid .form-group:nth-child(5) { grid-column: 1 !important; grid-row: 3 !important; }
    .obstetric-unified-grid .form-group:nth-child(6) { grid-column: 2 !important; grid-row: 3 !important; }
    .obstetric-unified-grid .form-group:nth-child(7) { grid-column: 1 !important; grid-row: 4 !important; }
    .obstetric-unified-grid .form-group:nth-child(8) { grid-column: 2 !important; grid-row: 4 !important; }
    .obstetric-unified-grid .form-group:nth-child(9) { grid-column: 1 !important; grid-row: 5 !important; }
    
    .input-number,
    .input-date {
        max-width: 100%;
    }
    
    .section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .section-header form {
        width: 100%;
    }
    
    .section-header button {
        width: 100%;
    }
    
    .risk-tabs {
        flex-direction: column;
    }
    
    .tab-button {
        width: 100%;
        text-align: left;
        border-bottom: 1px solid #e9ecef;
        border-right: none;
    }
    
    .tab-button.active {
        border-bottom-color: #007cba;
        border-right: 3px solid #007cba;
    }
    
    .unified-risk-table {
        font-size: 0.9em;
    }
    
    .unified-risk-table th,
    .unified-risk-table td {
        padding: 8px 4px;
    }
    
    .risk-type {
        min-width: 80px;
        font-size: 0.8em;
    }
}

/* Admin Interface Styles */
.admin-section {
    background: white;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.admin-form-section {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 30px;
    border: 1px solid #e9ecef;
}

.admin-form-section h3 {
    margin: 0 0 20px 0;
    color: #495057;
    font-size: 1.2em;
}

.admin-form .form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    align-items: end;
}

.checkbox-label {
    font-weight: normal !important;
    margin-left: 5px;
    cursor: pointer;
}

.users-list-section h3 {
    margin: 0 0 20px 0;
    color: #495057;
    font-size: 1.2em;
}

.users-table-container {
    overflow-x: auto;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.admin-table th {
    background: #f8f9fa;
    font-weight: 600;
    padding: 15px 12px;
    text-align: left;
    border-bottom: 2px solid #dee2e6;
    color: #495057;
}

.admin-table td {
    padding: 12px;
    border-bottom: 1px solid #dee2e6;
    vertical-align: middle;
}

.admin-table tr:hover {
    background: #f8f9fa;
}

.role-admin {
    background: #dc3545;
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.8em;
    font-weight: 600;
}

.role-user {
    background: #6c757d;
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.8em;
    font-weight: 600;
}

.actions-cell {
    white-space: nowrap;
}

.actions-cell .btn {
    margin-right: 5px;
}

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

.modal-content {
    background-color: white;
    margin: 5% auto;
    padding: 0;
    border-radius: 8px;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid #dee2e6;
    background: #f8f9fa;
    border-radius: 8px 8px 0 0;
}

.modal-header h3 {
    margin: 0;
    color: #495057;
}

.close {
    color: #aaa;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    line-height: 1;
}

.close:hover {
    color: #000;
}

.modal-body {
    padding: 20px;
}

.modal-footer {
    padding: 20px;
    border-top: 1px solid #dee2e6;
    background: #f8f9fa;
    border-radius: 0 0 8px 8px;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* Warning Button */
.btn-warning {
    background: #ffc107;
    color: #212529;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.3s;
}

.btn-warning:hover {
    background: #e0a800;
}

/* Enhanced Admin Features */
.bulk-actions {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 6px;
    margin-bottom: 20px;
    border: 1px solid #dee2e6;
}

.bulk-controls {
    display: flex;
    gap: 15px;
    align-items: center;
    flex-wrap: wrap;
}

.bulk-controls select {
    padding: 8px 12px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    background: white;
    min-width: 200px;
}

.bulk-controls button {
    white-space: nowrap;
}

.admin-table th:first-child {
    width: 40px;
    text-align: center;
}

.admin-table td:first-child {
    text-align: center;
}

.user-checkbox {
    transform: scale(1.2);
}

.btn-info {
    background: #17a2b8;
    color: white;
    border: 1px solid #17a2b8;
}

.btn-info:hover {
    background: #138496;
    border-color: #117a8b;
}

.modal-body .form-group {
    margin-bottom: 15px;
}

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

.modal-body input,
.modal-body select {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 14px;
}

/* User Settings Styles */
.user-settings-section {
    background: white;
    border-radius: 8px;
    padding: 25px;
    margin-bottom: 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.user-info-card {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 25px;
    border: 1px solid #dee2e6;
}

.user-info-card h3 {
    margin: 0 0 15px 0;
    color: #495057;
    font-size: 1.2em;
}

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

.info-item {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.info-item label {
    font-weight: 600;
    color: #666;
    font-size: 0.9em;
}

.info-item span {
    color: #333;
    font-size: 1em;
}

.password-change-section {
    background: #fff3cd;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 25px;
    border: 1px solid #ffc107;
}

.password-change-section h3 {
    margin: 0 0 20px 0;
    color: #856404;
    font-size: 1.2em;
}

.password-form {
    max-width: 500px;
}

.password-form .form-group {
    margin-bottom: 20px;
}

.password-form label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #333;
}

.password-form input {
    width: 100%;
    padding: 12px;
    border: 2px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.3s ease;
}

.password-form input:focus {
    border-color: #007cba;
    outline: none;
    box-shadow: 0 0 0 3px rgba(0, 124, 186, 0.1);
}

.password-form small {
    display: block;
    margin-top: 5px;
    color: #666;
    font-size: 0.85em;
}

.form-actions {
    display: flex;
    gap: 15px;
    margin-top: 25px;
}

.security-tips {
    background: #d1ecf1;
    padding: 20px;
    border-radius: 8px;
    border: 1px solid #17a2b8;
}

.security-tips h3 {
    margin: 0 0 15px 0;
    color: #0c5460;
    font-size: 1.2em;
}

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

.security-tips li {
    margin: 8px 0;
    color: #0c5460;
}

/* Warning Box in Modals */
.warning-box {
    background: #fff3cd;
    border: 1px solid #ffc107;
    border-left: 4px solid #ffc107;
    border-radius: 6px;
    padding: 15px;
    margin-top: 15px;
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.warning-box i {
    color: #ffc107;
    font-size: 1.2em;
    margin-top: 2px;
}

.warning-box p {
    margin: 0;
    color: #856404;
    font-size: 0.9em;
    line-height: 1.5;
}

.info-text {
    color: #666;
    font-size: 0.95em;
    margin: 10px 0;
}

.info-text .specialty-badge {
    display: inline-block;
    vertical-align: middle;
    margin-left: 8px;
}

/* Button Success Variant */
.btn-success {
    background: #28a745;
    color: white;
    border: none;
}

.btn-success:hover {
    background: #218838;
}

.btn-success.btn-sm {
    padding: 6px 12px;
    font-size: 0.9em;
}

/* Responsive Admin Styles */
@media (max-width: 768px) {
    .admin-form .form-row {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .bulk-controls {
        flex-direction: column;
        align-items: stretch;
    }
    
    .bulk-controls select {
        min-width: auto;
    }
    
    .admin-table {
        font-size: 0.9em;
    }
    
    .admin-table th,
    .admin-table td {
        padding: 8px 6px;
    }
    
    .actions-cell {
        white-space: normal;
    }
    
    .actions-cell .btn {
        display: block;
        margin: 5px 0;
        width: 100%;
    }
    
    .modal-content {
        width: 95%;
        margin: 10% auto;
    }
    
    .info-grid {
        grid-template-columns: 1fr;
    }
    
    .form-actions {
        flex-direction: column;
    }
    
    .form-actions .btn {
        width: 100%;
    }
}

/* ========================================
   MULTI-SPECIALTY STYLES
   ======================================== */

/* Specialty Badges */
.specialty-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.85em;
    font-weight: 600;
    text-transform: capitalize;
    letter-spacing: 0.3px;
}

.specialty-obstetrics,
.specialty-obs-gyn,
.specialty-obs_gyn {
    background: #e3f2fd;
    color: #1976d2;
    border: 1px solid #90caf9;
}

.specialty-gynecology {
    background: #fce4ec;
    color: #c2185b;
    border: 1px solid #f48fb1;
}

.specialty-general_surgery,
.specialty-general-surgery {
    background: #fff3e0;
    color: #e65100;
    border: 1px solid #ffb74d;
}

.specialty-internal_medicine,
.specialty-internal-medicine {
    background: #e8f5e9;
    color: #2e7d32;
    border: 1px solid #81c784;
}

.specialty-pediatrics {
    background: #fff3e0;
    color: #f57c00;
    border: 1px solid #ffb74d;
}

/* Specialty Select Dropdown */
.input-specialty {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e1e5e9;
    border-radius: 8px;
    font-size: 16px;
    background-color: white;
    transition: border-color 0.3s ease;
    cursor: pointer;
}

.input-specialty:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.specialty-group {
    grid-column: 1 / -1;
}

/* Specialty-Specific Sections */
.specialty-section {
    margin-top: 20px;
}

.specialty-section-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 15px;
}

.specialty-section-header h3 {
    margin: 0;
    color: #333;
}

.specialty-icon {
    font-size: 1.5em;
}

/* Specialty Data Forms */
.specialty-data-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.specialty-textarea {
    width: 100%;
    min-height: 100px;
    padding: 12px;
    border: 2px solid #e1e5e9;
    border-radius: 8px;
    font-family: inherit;
    font-size: 14px;
    resize: vertical;
    transition: border-color 0.3s ease;
}

.specialty-textarea:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* Clinical Notes Section */
.clinical-notes-section {
    margin-top: 30px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 10px;
}

.note-item {
    background: white;
    padding: 15px;
    margin-bottom: 15px;
    border-radius: 8px;
    border-left: 4px solid #667eea;
}

.note-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    padding-bottom: 10px;
    border-bottom: 1px solid #e1e5e9;
}

.note-title {
    font-weight: 600;
    color: #333;
}

.note-meta {
    font-size: 0.85em;
    color: #666;
}

.note-content {
    color: #555;
    line-height: 1.6;
}

/* ASA Classification (for Surgery) */
.asa-classification-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 10px;
    margin-top: 10px;
}

.asa-option {
    text-align: center;
}

.asa-option input[type="radio"] {
    display: none;
}

.asa-option label {
    display: block;
    padding: 10px;
    border: 2px solid #e1e5e9;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.asa-option input[type="radio"]:checked + label {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

.asa-option label:hover {
    border-color: #667eea;
    background: #f0f3ff;
}

/* Responsive Specialty Styles */
@media (max-width: 768px) {
    .specialty-data-grid {
        grid-template-columns: 1fr;
    }
    
    .asa-classification-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .specialty-badge {
        font-size: 0.75em;
        padding: 3px 10px;
    }
}
