/* Maternity Care System - Main Stylesheet */
/* Following Jakob's Law for familiar UI patterns */

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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f5f7fa;
    direction: ltr;
}

body.rtl {
    direction: rtl;
    font-family: 'Tahoma', 'Arial', sans-serif;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.container-fluid {
    width: 100%;
    padding: 0 15px;
}

/* Header */
.header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 1rem 0;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
}

.logo {
    font-size: 1.5rem;
    font-weight: bold;
    margin-bottom: 0;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 15px;
}

.language-toggle {
    background: rgba(255,255,255,0.2);
    border: 1px solid rgba(255,255,255,0.3);
    color: white;
    padding: 5px 10px;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.3s;
}

.language-toggle:hover {
    background: rgba(255,255,255,0.3);
}

/* Navigation */
.nav {
    background: white;
    border-bottom: 1px solid #e0e0e0;
    padding: 0.5rem 0;
}

.nav-list {
    display: flex;
    list-style: none;
    gap: 2rem;
    flex-wrap: wrap;
}

.nav-link {
    color: #666;
    text-decoration: none;
    padding: 8px 12px;
    border-radius: 4px;
    transition: all 0.3s;
}

.nav-link:hover,
.nav-link.active {
    background: #667eea;
    color: white;
}

/* Login Form */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.login-card {
    background: white;
    padding: 2rem;
    border-radius: 10px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    width: 100%;
    max-width: 400px;
}

.login-header {
    text-align: center;
    margin-bottom: 2rem;
}

.login-header h1 {
    color: #333;
    margin-bottom: 0.5rem;
}

.login-header p {
    color: #666;
    font-size: 0.9rem;
}

/* Language Selector for Login Page */
.language-selector {
    text-align: right;
    margin-bottom: 1.5rem;
}

.rtl .language-selector {
    text-align: left;
}

.language-toggle-group {
    display: inline-flex;
    background: #f8f9fa;
    border-radius: 8px;
    padding: 4px;
    border: 1px solid #e9ecef;
}

.login-card .language-toggle {
    background: transparent;
    border: none;
    color: #495057;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    margin: 0 2px;
}

.login-card .language-toggle:hover {
    background: #e9ecef;
    color: #495057;
}

.login-card .language-toggle.active {
    background: #667eea;
    color: white;
    box-shadow: 0 2px 4px rgba(102, 126, 234, 0.3);
}

.login-card .language-toggle.active:hover {
    background: #5a6fd8;
    color: white;
}

/* Dashboard Analysis Summary Styles */
.analysis-summary {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 1.5rem;
    border-left: 4px solid #667eea;
}

.analysis-summary h6 {
    color: #495057;
    font-weight: 600;
    margin-bottom: 1rem;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.summary-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
    padding: 0.5rem 0;
    border-bottom: 1px solid #e9ecef;
}

.summary-item:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.summary-label {
    font-size: 0.85rem;
    color: #6c757d;
    font-weight: 500;
}

.summary-value {
    font-size: 0.9rem;
    font-weight: 600;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.7);
}

/* Chart container improvements */
.card-body canvas {
    max-height: 300px;
}

/* Responsive adjustments for charts */
@media (max-width: 768px) {
    .analysis-summary {
        margin-top: 1rem;
    }
    
    .summary-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.25rem;
    }
    
    .summary-value {
        align-self: flex-end;
    }
}

/* Forms */
.form-group {
    margin-bottom: 1rem;
}

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    color: #333;
    font-weight: 500;
}

.form-control {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 1rem;
    transition: border-color 0.3s, box-shadow 0.3s;
}

.form-control:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.2);
}

.form-control.is-invalid {
    border-color: #dc3545;
}

.form-control.is-valid {
    border-color: #28a745;
}

.invalid-feedback {
    color: #dc3545;
    font-size: 0.875rem;
    margin-top: 0.25rem;
    display: block;
}

.valid-feedback {
    color: #28a745;
    font-size: 0.875rem;
    margin-top: 0.25rem;
    display: block;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    text-decoration: none;
    text-align: center;
    font-size: 1rem;
    transition: all 0.3s;
    min-width: 100px;
}

.btn-primary {
    background: #667eea;
    color: white;
}

.btn-primary:hover {
    background: #5a67d8;
    transform: translateY(-1px);
}

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

.btn-secondary:hover {
    background: #5a6268;
}

.btn-success {
    background: #28a745;
    color: white;
}

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

.btn-danger {
    background: #dc3545;
    color: white;
}

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

.btn-block {
    width: 100%;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.875rem;
}

.btn-lg {
    padding: 14px 28px;
    font-size: 1.125rem;
}

/* Cards */
.card {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    margin-bottom: 1.5rem;
}

.card-header {
    background: #f8f9fa;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid #e0e0e0;
    border-radius: 8px 8px 0 0;
}

.card-body {
    padding: 1.5rem;
}

.card-footer {
    background: #f8f9fa;
    padding: 1rem 1.5rem;
    border-top: 1px solid #e0e0e0;
    border-radius: 0 0 8px 8px;
}

.card-title {
    margin: 0 0 1rem 0;
    color: #333;
}

/* Alerts */
.alert {
    padding: 12px 16px;
    border-radius: 5px;
    margin-bottom: 1rem;
    border: 1px solid transparent;
}

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

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

.alert-warning {
    background: #fff3cd;
    color: #856404;
    border-color: #ffeaa7;
}

.alert-info {
    background: #d1ecf1;
    color: #0c5460;
    border-color: #bee5eb;
}

/* Tables */
.table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1rem;
    background: white;
}

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

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

.table-striped tbody tr:nth-child(odd) {
    background: #f8f9fa;
}

.table-hover tbody tr:hover {
    background: #f5f5f5;
}

/* Grid System */
.row {
    display: flex;
    flex-wrap: wrap;
    margin: -15px;
}

.col {
    flex: 1;
    padding: 15px;
}

.col-6 {
    flex: 0 0 50%;
    max-width: 50%;
    padding: 15px;
}

.col-4 {
    flex: 0 0 33.333333%;
    max-width: 33.333333%;
    padding: 15px;
}

.col-3 {
    flex: 0 0 25%;
    max-width: 25%;
    padding: 15px;
}

/* Statistics Cards */
.stat-card {
    background: white;
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    text-align: center;
    transition: transform 0.3s;
}

.stat-card:hover {
    transform: translateY(-2px);
}

.stat-number {
    font-size: 2rem;
    font-weight: bold;
    color: #667eea;
    margin-bottom: 0.5rem;
}

.stat-label {
    color: #666;
    font-size: 0.9rem;
}

/* Robson Groups */
.robson-group {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: bold;
    color: white;
    min-width: 30px;
    text-align: center;
}

.robson-group-1, .robson-group-3 { background: #28a745; }
.robson-group-2, .robson-group-4 { background: #ffc107; color: #212529; }
.robson-group-5 { background: #fd7e14; }
.robson-group-6, .robson-group-7 { background: #dc3545; }
.robson-group-8 { background: #6f42c1; }
.robson-group-9 { background: #e83e8c; }
.robson-group-10 { background: #17a2b8; }

/* Delivery Method Indicators */
.delivery-normal {
    color: #28a745;
    font-weight: bold;
}

.delivery-cesarean {
    color: #dc3545;
    font-weight: bold;
}

.delivery-match {
    color: #28a745;
}

.delivery-mismatch {
    color: #dc3545;
}

/* Utilities */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }
.text-muted { color: #6c757d; }
.text-primary { color: #667eea; }
.text-success { color: #28a745; }
.text-danger { color: #dc3545; }
.text-warning { color: #ffc107; }

.d-none { display: none; }
.d-block { display: block; }
.d-flex { display: flex; }
.d-inline-block { display: inline-block; }

.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mb-4 { margin-bottom: 2rem; }

.mt-0 { margin-top: 0; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }

.p-2 { padding: 1rem; }
.p-3 { padding: 1.5rem; }

/* Loading Spinner */
.spinner {
    border: 3px solid #f3f3f3;
    border-top: 3px solid #667eea;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    animation: spin 1s linear infinite;
    margin: 20px auto;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 0 10px;
    }
    
    .header-content {
        flex-direction: column;
        gap: 1rem;
    }
    
    .nav-list {
        flex-direction: column;
        gap: 0;
    }
    
    .nav-link {
        display: block;
        padding: 10px;
        border-bottom: 1px solid #e0e0e0;
    }
    
    .row {
        flex-direction: column;
    }
    
    .col-6, .col-4, .col-3 {
        flex: none;
        max-width: 100%;
    }
    
    .login-card {
        margin: 20px;
        padding: 1.5rem;
    }
    
    .btn-block-mobile {
        width: 100%;
        margin-bottom: 0.5rem;
    }
}

/* RTL Specific Styles */
.rtl .nav-list {
    flex-direction: row-reverse;
}

.rtl .header-content {
    text-align: right;
}

.rtl .form-label {
    text-align: right;
}

.rtl .table th,
.rtl .table td {
    text-align: right;
}

/* Overview Statistics Cards */
.stats-overview {
    margin-bottom: 2rem;
}

.stats-card {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    text-align: center;
    transition: all 0.3s ease;
    border: 1px solid #f0f0f0;
    position: relative;
    overflow: hidden;
}

.stats-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #667eea, #764ba2);
}

.stats-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.12);
}

.stats-card .stat-number {
    font-size: 2.5rem;
    font-weight: 700;
    color: #2d3748;
    margin-bottom: 0.5rem;
    line-height: 1;
}

.stats-card .stat-label {
    color: #718096;
    font-size: 0.9rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin: 0;
}

.stats-card.primary .stat-number {
    color: #667eea;
}

.stats-card.success .stat-number {
    color: #48bb78;
}

.stats-card.warning .stat-number {
    color: #ed8936;
}

.stats-card.info .stat-number {
    color: #4299e1;
}

/* Chart Cards */
.chart-card {
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    border: 1px solid #f0f0f0;
    overflow: hidden;
    margin-bottom: 1.5rem;
}

.chart-card .card-header {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-bottom: 1px solid #e2e8f0;
    padding: 1.25rem 1.5rem;
    border-radius: 12px 12px 0 0;
}

.chart-card .card-header h5 {
    margin: 0;
    color: #2d3748;
    font-weight: 600;
    font-size: 1.1rem;
}

.chart-card .card-header i {
    color: #667eea;
    margin-right: 0.5rem;
}

.rtl .chart-card .card-header i {
    margin-right: 0;
    margin-left: 0.5rem;
}

.chart-card .card-body {
    padding: 1.5rem;
}

.chart-container {
    position: relative;
    height: 300px;
    margin-bottom: 1rem;
}

.chart-container canvas {
    max-height: 100%;
    width: 100% !important;
    height: auto !important;
}

/* Charts Grid Layout */
.charts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

/* Chart Legend Improvements */
.chart-legend {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 1rem;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid #e2e8f0;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    color: #4a5568;
}

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

/* Overview Section */
.overview-section {
    background: linear-gradient(135deg, #f7fafc 0%, #edf2f7 100%);
    border-radius: 16px;
    padding: 2rem;
    margin-bottom: 2rem;
    border: 1px solid #e2e8f0;
}

.overview-section h4 {
    color: #2d3748;
    font-weight: 600;
    margin-bottom: 1.5rem;
    text-align: center;
    font-size: 1.3rem;
}

.overview-section h4 i {
    color: #667eea;
    margin-right: 0.5rem;
}

.rtl .overview-section h4 i {
    margin-right: 0;
    margin-left: 0.5rem;
}

/* Responsive Design for Charts */
@media (max-width: 768px) {
    .charts-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .stats-card {
        padding: 1rem;
    }
    
    .stats-card .stat-number {
        font-size: 2rem;
    }
    
    .chart-container {
        height: 250px;
    }
    
    .overview-section {
        padding: 1.5rem;
    }
    
    .chart-card .card-body {
        padding: 1rem;
    }
}

@media (max-width: 480px) {
    .overview-section {
        padding: 1rem;
        margin-bottom: 1rem;
    }
    
    .stats-card .stat-number {
        font-size: 1.75rem;
    }
    
    .chart-container {
        height: 200px;
    }
    
    .chart-legend {
        gap: 0.5rem;
    }
    
    .legend-item {
        font-size: 0.8rem;
    }
}

/* Print Styles */
@media print {
    .header, .nav, .btn, .language-toggle {
        display: none !important;
    }
    
    .container {
        max-width: none;
        padding: 0;
    }
    
    .card {
        box-shadow: none;
        border: 1px solid #ddd;
    }
    
    .overview-section {
        background: white;
        border: 1px solid #ddd;
        page-break-inside: avoid;
    }
    
    .chart-card {
        box-shadow: none;
        border: 1px solid #ddd;
        page-break-inside: avoid;
    }
    
    .stats-card {
        box-shadow: none;
        border: 1px solid #ddd;
    }
}