/* ============================================
   BioEthX - Bioethics Case Management System
   Main Stylesheet
   ============================================ */

/* ============================================
   Global Styles & Reset
   ============================================ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: Georgia, 'Times New Roman', Times, serif;
    background: linear-gradient(135deg, #2f5cbc 0%, #00553a 100%);
    padding: 20px;
    min-height: 100vh;
}

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

.login-screen.hidden {
    display: none;
}

.login-container {
    max-width: 450px;
    width: 100%;
    background: white;
    padding: 50px 40px;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.login-header {
    text-align: center;
    margin-bottom: 35px;
}

.login-logo {
    max-width: 240px;
    width: 100%;
    height: auto;
    margin: 0 auto 15px;
    display: block;
}

.login-header p {
    color: #718096;
    font-size: 15px;
}

.login-header h1 {
    color: #2d3748;
    font-size: 32px;
    margin-bottom: 10px;
    font-family: Georgia, 'Times New Roman', Times, serif;
}

/* Login Form */
.login-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.form-field {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-field label {
    color: #4a5568;
    font-weight: 600;
    font-size: 14px;
    font-family: Georgia, 'Times New Roman', Times, serif;
}

.form-field input {
    padding: 14px 16px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 15px;
    transition: all 0.3s;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

.form-field input:focus {
    outline: none;
    border-color: #2f5cbc;
    box-shadow: 0 0 0 4px rgba(47, 92, 188, 0.1);
}

.login-button {
    padding: 16px;
    background: linear-gradient(135deg, #2f5cbc 0%, #00553a 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s;
    margin-top: 10px;
    font-family: Georgia, 'Times New Roman', Times, serif;
}

.login-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(47, 92, 188, 0.4);
}

.login-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.error-message {
    color: #e53e3e;
    background: #fff5f5;
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 14px;
    border-left: 4px solid #e53e3e;
    margin-bottom: 20px;
    animation: shake 0.5s;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-10px); }
    75% { transform: translateX(10px); }
}

/* Demo Credentials Display */
.demo-credentials {
    margin-top: 30px;
    padding: 20px;
    background: #f7fafc;
    border-radius: 8px;
    border: 2px dashed #cbd5e0;
}

.demo-credentials h3 {
    color: #2d3748;
    font-size: 14px;
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-family: Georgia, 'Times New Roman', Times, serif;
}

.demo-credentials-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.demo-credential {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background: white;
    border-radius: 6px;
    font-size: 13px;
}

.demo-credential-label {
    color: #718096;
    font-weight: 500;
}

.demo-credential-value {
    color: #2d3748;
    font-weight: 700;
    font-family: 'Courier New', monospace;
}

/* ============================================
   Main Container
   ============================================ */
.main-container {
    max-width: 1400px;
    margin: 0 auto;
    display: none;
}

.main-container.active {
    display: block;
}

/* ============================================
   Navigation Tabs
   ============================================ */
.nav-tabs {
    background: white;
    border-radius: 12px 12px 0 0;
    padding: 0;
    display: flex;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    align-items: center;
}

.nav-tab {
    flex: 1;
    padding: 20px 30px;
    background: #f7fafc;
    border: none;
    font-size: 16px;
    font-weight: 600;
    color: #4a5568;
    cursor: pointer;
    transition: all 0.3s;
    border-bottom: 3px solid transparent;
    font-family: Georgia, 'Times New Roman', Times, serif;
}

.nav-tab:hover {
    background: #e2e8f0;
}

.nav-tab.active {
    background: white;
    color: #2f5cbc;
    border-bottom: 3px solid #2f5cbc;
}

.nav-user-section {
    padding: 0 25px;
    display: flex;
    align-items: center;
    gap: 15px;
    background: white;
    border-left: 1px solid #e2e8f0;
}

.nav-user-info {
    color: #4a5568;
    font-size: 14px;
    font-weight: 500;
    font-family: Georgia, 'Times New Roman', Times, serif;
}

.nav-logout-btn {
    padding: 8px 16px;
    background: #e53e3e;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    font-family: Georgia, 'Times New Roman', Times, serif;
}

.nav-logout-btn:hover {
    background: #c53030;
    transform: translateY(-1px);
}

/* ============================================
   Tab Content
   ============================================ */
.tab-content {
    display: none;
    background: white;
    padding: 40px;
    border-radius: 0 0 12px 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

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

/* ============================================
   Dashboard
   ============================================ */
.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid #e2e8f0;
}

.dashboard-header h2 {
    color: #2d3748;
    font-size: 24px;
    font-family: Georgia, 'Times New Roman', Times, serif;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 15px;
    color: #4a5568;
    font-weight: 500;
}

/* Stats Cards */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 25px;
}

.stat-card {
    background: linear-gradient(135deg, #f7fafc 0%, #e2e8f0 100%);
    padding: 20px;
    border-radius: 8px;
    border-left: 4px solid #2f5cbc;
}

.stat-card h3 {
    color: #718096;
    font-size: 12px;
    text-transform: uppercase;
    margin-bottom: 8px;
    font-weight: 600;
    font-family: Georgia, 'Times New Roman', Times, serif;
}

.stat-card .stat-value {
    font-size: 32px;
    font-weight: 700;
    color: #2d3748;
    font-family: Georgia, 'Times New Roman', Times, serif;
}

/* ============================================
   Controls & Search
   ============================================ */
.controls {
    background: #f7fafc;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.controls-row {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
}

.search-box {
    flex: 1;
    min-width: 250px;
}

.search-box input {
    width: 100%;
    padding: 10px 15px;
    border: 2px solid #e2e8f0;
    border-radius: 6px;
    font-size: 14px;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

.search-box input:focus {
    outline: none;
    border-color: #2f5cbc;
    box-shadow: 0 0 0 3px rgba(47, 92, 188, 0.1);
}

.filter-group {
    display: flex;
    gap: 8px;
    align-items: center;
}

.filter-group select {
    padding: 10px 12px;
    border: 2px solid #e2e8f0;
    border-radius: 6px;
    font-size: 13px;
    cursor: pointer;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

.filter-group select:focus {
    outline: none;
    border-color: #2f5cbc;
    box-shadow: 0 0 0 3px rgba(47, 92, 188, 0.1);
}

/* ============================================
   Common Form Styles
   ============================================ */
.container {
    max-width: 1000px;
    margin: 0 auto;
}

.demo-banner {
    background: #e6f2e6;
    border: 2px solid #00553a;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 25px;
}

.demo-banner h3 {
    color: #00553a;
    margin: 0 0 10px 0;
    font-size: 18px;
    font-family: Georgia, 'Times New Roman', Times, serif;
}

.demo-banner ul {
    color: #00553a;
    margin: 0;
    padding-left: 20px;
    font-size: 13px;
}

.demo-banner li {
    margin: 5px 0;
}

.header {
    text-align: center;
    margin-bottom: 35px;
    padding-bottom: 20px;
    border-bottom: 3px solid #2f5cbc;
}

h1 {
    color: #2d3748;
    font-size: 28px;
    margin-bottom: 8px;
    font-family: Georgia, 'Times New Roman', Times, serif;
}

.subtitle {
    color: #718096;
    font-size: 14px;
}

.section {
    margin-bottom: 30px;
}

.section-title {
    font-size: 18px;
    font-weight: 600;
    color: #2f5cbc;
    margin-bottom: 15px;
    padding-bottom: 8px;
    border-bottom: 2px solid #e2e8f0;
    font-family: Georgia, 'Times New Roman', Times, serif;
}

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

label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    color: #4a5568;
    font-size: 14px;
    font-family: Georgia, 'Times New Roman', Times, serif;
}

input[type="text"],
input[type="number"],
select,
textarea {
    width: 100%;
    padding: 10px 12px;
    border: 2px solid #e2e8f0;
    border-radius: 6px;
    font-size: 14px;
    transition: all 0.3s;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: #2f5cbc;
    box-shadow: 0 0 0 3px rgba(47, 92, 188, 0.1);
}

textarea {
    resize: vertical;
    min-height: 80px;
}

.radio-group {
    display: flex;
    gap: 20px;
    margin-top: 8px;
}

.radio-option {
    display: flex;
    align-items: center;
    gap: 6px;
}

input[type="radio"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: #2f5cbc;
}

.row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.conditional-section {
    display: none;
    padding: 15px;
    background: #f7fafc;
    border-left: 4px solid #2f5cbc;
    border-radius: 4px;
    margin-top: 10px;
}

/* ============================================
   Buttons
   ============================================ */
button {
    background: linear-gradient(135deg, #2f5cbc 0%, #00553a 100%);
    color: white;
    padding: 12px 24px;
    border: none;
    border-radius: 6px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    margin-right: 10px;
    margin-top: 5px;
    font-family: Georgia, 'Times New Roman', Times, serif;
}

button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(47, 92, 188, 0.4);
}

button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.btn-success {
    background: linear-gradient(135deg, #00553a 0%, #003d29 100%);
}

.btn-success:hover {
    box-shadow: 0 6px 20px rgba(0, 85, 58, 0.4);
}

.btn-info {
    background: linear-gradient(135deg, #2f5cbc 0%, #1e3a8a 100%);
}

.btn-info:hover {
    box-shadow: 0 6px 20px rgba(47, 92, 188, 0.4);
}

.btn-secondary {
    background: linear-gradient(135deg, #718096 0%, #4a5568 100%);
}

.btn-danger {
    background: linear-gradient(135deg, #f56565 0%, #e53e3e 100%);
}

.btn-small {
    padding: 6px 12px;
    font-size: 12px;
    margin: 0;
}

.button-group {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 15px;
}

/* ============================================
   Table Styles
   ============================================ */
.table-container {
    overflow-x: auto;
    margin-top: 15px;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
}

table {
    width: 100%;
    border-collapse: collapse;
    background: white;
}

thead {
    background: #f7fafc;
}

th {
    padding: 12px;
    text-align: left;
    font-weight: 600;
    color: #4a5568;
    font-size: 12px;
    text-transform: uppercase;
    border-bottom: 2px solid #e2e8f0;
    font-family: Georgia, 'Times New Roman', Times, serif;
}

td {
    padding: 12px;
    border-bottom: 1px solid #e2e8f0;
    color: #2d3748;
    font-size: 13px;
}

tr:hover {
    background: #f7fafc;
}

.priority-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

.priority-urgent {
    background: #fed7d7;
    color: #c53030;
}

.priority-not-urgent {
    background: #c6f6d5;
    color: #00553a;
}

.action-buttons {
    display: flex;
    gap: 5px;
    flex-wrap: wrap;
}

.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: #718096;
}

.empty-state-icon {
    font-size: 48px;
    margin-bottom: 15px;
}

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

.modal.active {
    display: block;
}

.modal-content {
    background-color: white;
    margin: 2% auto;
    padding: 0;
    border-radius: 12px;
    width: 90%;
    max-width: 900px;
    max-height: 90vh;
    box-shadow: 0 10px 40px rgba(0,0,0,0.3);
    display: flex;
    flex-direction: column;
}

.modal-header {
    padding: 20px 30px;
    background: linear-gradient(135deg, #2f5cbc 0%, #00553a 100%);
    color: white;
    border-radius: 12px 12px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    margin: 0;
    font-size: 24px;
    font-family: Georgia, 'Times New Roman', Times, serif;
}

.close {
    color: white;
    font-size: 32px;
    font-weight: bold;
    cursor: pointer;
    line-height: 1;
}

.close:hover {
    transform: scale(1.2);
}

.modal-body {
    padding: 30px;
    overflow-y: auto;
    flex: 1;
}

.modal-footer {
    padding: 20px 30px;
    border-top: 1px solid #e2e8f0;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

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

.detail-item {
    padding: 12px;
    background: #f7fafc;
    border-radius: 6px;
    border-left: 3px solid #2f5cbc;
}

.detail-label {
    font-size: 11px;
    font-weight: 600;
    color: #718096;
    text-transform: uppercase;
    margin-bottom: 5px;
    font-family: Georgia, 'Times New Roman', Times, serif;
}

.detail-value {
    font-size: 14px;
    color: #2d3748;
    line-height: 1.6;
}

/* ============================================
   Loading & Notifications
   ============================================ */
.loading {
    text-align: center;
    padding: 40px;
    color: #718096;
}

.spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid #2f5cbc;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

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

.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 15px 20px;
    border-radius: 8px;
    color: white;
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    z-index: 2000;
    animation: slideIn 0.3s;
    font-family: Georgia, 'Times New Roman', Times, serif;
}

.notification-success {
    background: #00553a;
}

.notification-error {
    background: #f56565;
}

@keyframes slideIn {
    from {
        transform: translateX(400px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.status-message {
    padding: 15px;
    border-radius: 6px;
    margin-top: 15px;
}

.status-success {
    background: #e6f2e6;
    border: 1px solid #00553a;
    color: #00553a;
}

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

.status-loading {
    background: #e3ecf7;
    border: 1px solid #2f5cbc;
    color: #1e3a8a;
}

/* ============================================
   Code Selection Styles (ACECS & ERD)
   ============================================ */
.code-suggestion-card {
    margin-bottom: 10px;
    padding: 12px;
    background: white;
    border-radius: 6px;
    border: 2px solid #e2e8f0;
    transition: all 0.3s;
    cursor: pointer;
}

.code-suggestion-card.selected {
    border-color: #00553a;
    background: rgba(0, 85, 58, 0.1);
}

.code-suggestion-card:hover {
    border-color: #2f5cbc;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(47, 92, 188, 0.2);
}

.code-suggestion-card.code-zero-probability {
    padding: 8px 12px;
    min-height: auto;
}

.code-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 6px;
}

.code-title {
    flex: 1;
    font-size: 14px;
    font-weight: 600;
    color: #2d3748;
    line-height: 1.3;
    font-family: Georgia, 'Times New Roman', Times, serif;
}

.probability-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 700;
    margin-left: 10px;
    white-space: nowrap;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

.probability-very-high {
    background: #b8e6c9;
    color: #00553a;
}

.probability-high {
    background: #d4f1dd;
    color: #00553a;
}

.probability-medium {
    background: #feebc8;
    color: #744210;
}

.probability-low {
    background: #fed7d7;
    color: #c53030;
}

.code-explanation {
    margin-top: 6px;
    color: #4a5568;
    font-size: 12px;
    line-height: 1.5;
}

.code-category {
    margin-top: 4px;
    color: #718096;
    font-size: 11px;
    font-weight: 600;
    font-family: Georgia, 'Times New Roman', Times, serif;
}

.filter-controls {
    margin-bottom: 15px;
    padding: 15px;
    background: #f7fafc;
    border-radius: 6px;
    border: 1px solid #e2e8f0;
}

.filter-controls label {
    display: inline-block;
    margin-right: 10px;
    font-size: 13px;
    font-family: Georgia, 'Times New Roman', Times, serif;
}

.filter-controls input[type="range"] {
    width: 200px;
    vertical-align: middle;
    accent-color: #2f5cbc;
}

.filter-controls .threshold-value {
    display: inline-block;
    min-width: 40px;
    font-weight: 700;
    color: #2f5cbc;
    font-family: Georgia, 'Times New Roman', Times, serif;
}

.selection-counter {
    display: inline-block;
    padding: 6px 12px;
    background: #2f5cbc;
    color: white;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 700;
    margin-left: 15px;
    font-family: Georgia, 'Times New Roman', Times, serif;
}

.codes-list-container {
    max-height: 500px;
    overflow-y: auto;
}

/* ============================================
   AI Section Styles
   ============================================ */
.ai-section {
    background: linear-gradient(135deg, #e3ecf7 0%, #d1e0f5 100%);
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 25px;
    border: 2px solid #2f5cbc;
}

.generate-section {
    background: linear-gradient(135deg, #e6f2e6 0%, #d4f1dd 100%);
    padding: 20px;
    border-radius: 8px;
    margin-top: 25px;
    border: 2px solid #00553a;
}

.generated-narrative-box {
    background: white;
    padding: 20px;
    border: 2px solid #00553a;
    border-radius: 8px;
    margin-top: 15px;
}

.generated-narrative-box h4 {
    color: #00553a;
    margin-bottom: 15px;
    font-family: Georgia, 'Times New Roman', Times, serif;
}

.narrative-content {
    line-height: 1.8;
    color: #2d3748;
    white-space: pre-wrap;
}

/* ============================================
   Responsive Design
   ============================================ */
@media (max-width: 768px) {
    .login-logo {
        max-width: 180px;
    }
    
    .nav-tab {
        padding: 15px 10px;
        font-size: 14px;
    }

    .tab-content {
        padding: 20px;
    }

    .row,
    .detail-grid {
        grid-template-columns: 1fr;
    }

    .controls-row {
        flex-direction: column;
    }

    .search-box {
        min-width: 100%;
    }

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

    .nav-user-section {
        flex-direction: column;
        padding: 15px;
    }
}

@media (max-width: 480px) {
    .login-logo {
        max-width: 150px;
    }
}
