/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* Green Branding */
    --primary-color: #10b981;
    --primary-dark: #059669;
    --primary-light: #d1fae5;
    --primary-lighter: #f0fdf4;
    --secondary-color: #64748b;
    --accent-color: #10b981;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --text-light: #94a3b8;
    --bg-primary: #ffffff;
    --bg-secondary: #f8fafc;
    --bg-accent: #f1f5f9;
    --border-color: #e2e8f0;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
    --border-radius: 8px;
    --border-radius-lg: 12px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.6;
    color: var(--text-primary);
    background: var(--bg-secondary);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

/* Header */
.header {
    position: sticky;
    top: 0;
    left: 0;
    right: 0;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border-color);
    z-index: 1000;
    box-shadow: var(--shadow-sm);
}

.nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.5rem;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.logo {
    width: 40px;
    height: 40px;
}

.brand-name {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
}

.portal-label {
    font-size: 0.875rem;
    color: var(--text-secondary);
    padding: 0.25rem 0.75rem;
    background: var(--bg-accent);
    border-radius: 20px;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    font-weight: 500;
    text-decoration: none;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: white;
    box-shadow: var(--shadow-md);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn-secondary {
    background: transparent;
    color: var(--primary-color);
    border: 2px solid var(--primary-color);
}

.btn-secondary:hover {
    background: var(--primary-color);
    color: white;
}

/* Main Content */
.main-content {
    flex: 1;
    padding: 2rem 0;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: calc(100vh - 200px);
}

/* Access Section - Doctor Portal */
.access-section {
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 2rem 0;
}

.access-card {
    background: white;
    padding: 3rem 2.5rem;
    border-radius: 20px;
    box-shadow: var(--shadow-xl);
    text-align: center;
    max-width: 500px;
    width: 100%;
}

.access-icon {
    width: 80px;
    height: 80px;
    background: var(--primary-color);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 2rem;
}

.access-icon i {
    font-size: 2rem;
    color: white;
}

.access-title {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 1rem;
}

.access-description {
    font-size: 1rem;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 2.5rem;
}

.access-form {
    margin-top: 2rem;
}

.access-label {
    display: block;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 1rem;
    text-align: left;
}

.code-inputs {
    display: flex;
    gap: 0.75rem;
    justify-content: center;
    margin-bottom: 2rem;
}

.code-input {
    width: 60px;
    height: 60px;
    font-size: 1.5rem;
    font-weight: 600;
    text-align: center;
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    transition: var(--transition);
    background: var(--bg-secondary);
}

.code-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
    background: white;
}

.code-input.filled {
    border-color: var(--primary-color);
    background: var(--primary-lighter);
}

.code-input.error {
    border-color: #dc2626;
    background: #fef2f2;
}

.btn-verify {
    width: 100%;
    padding: 1rem 2rem;
    font-size: 1rem;
    font-weight: 600;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: var(--border-radius-lg);
    cursor: pointer;
    transition: var(--transition);
    margin-bottom: 1.5rem;
}

.btn-verify:hover:not(:disabled) {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn-verify:disabled {
    background: var(--text-light);
    cursor: not-allowed;
    opacity: 0.6;
}

.btn-verify.verifying {
    background: var(--primary-color);
    cursor: wait;
}

.verify-text,
.verify-spinner {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.access-notice {
    font-size: 0.875rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.access-notice i {
    color: var(--primary-color);
}

/* Results Section */
.results-section {
    margin-bottom: 2rem;
}

.section-title {
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
    color: var(--text-primary);
}

.results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 1.5rem;
}

.patient-card {
    background: white;
    padding: 1.5rem;
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-md);
    cursor: pointer;
    transition: var(--transition);
    border-left: 4px solid var(--primary-color);
}

.patient-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.patient-card-header {
    display: flex;
    justify-content: space-between;
    align-items: start;
    margin-bottom: 1rem;
}

.patient-name {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.patient-id {
    font-size: 0.875rem;
    color: var(--text-secondary);
    font-family: monospace;
}

.status-badge {
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.status-active {
    background: #d1fae5;
    color: #065f46;
}

.status-pending {
    background: #fef3c7;
    color: #92400e;
}

.status-inactive {
    background: #f3f4f6;
    color: #374151;
}

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

.info-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.info-row i {
    width: 16px;
    color: var(--primary-color);
}

/* Patient Details */
.patient-details-section {
    padding: 2rem 0;
}

.details-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--border-color);
}

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

.detail-section {
    background: var(--bg-secondary);
    padding: 1.5rem;
    border-radius: var(--border-radius);
}

.detail-section-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.detail-section-title i {
    color: var(--primary-color);
}

.detail-item {
    margin-bottom: 0.75rem;
}

.detail-label {
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 0.875rem;
    margin-bottom: 0.25rem;
}

.detail-value {
    color: var(--text-primary);
    font-size: 1rem;
}

.detail-list {
    list-style: none;
    padding: 0;
}

.detail-list li {
    padding: 0.5rem;
    margin-bottom: 0.5rem;
    background: white;
    border-radius: var(--border-radius);
    border-left: 3px solid var(--primary-color);
}

.table-responsive {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
}

table th,
table td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

table th {
    background: var(--bg-accent);
    font-weight: 600;
    color: var(--text-primary);
}

table tr:hover {
    background: var(--bg-secondary);
}

/* Welcome Section */
.welcome-section {
    padding: 4rem 0;
}

.welcome-card {
    background: white;
    padding: 3rem;
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-lg);
    text-align: center;
}

.welcome-icon {
    font-size: 4rem;
    color: var(--primary-color);
    margin-bottom: 1rem;
}

.welcome-card h2 {
    font-size: 2rem;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.welcome-card p {
    color: var(--text-secondary);
    font-size: 1.125rem;
}

/* Footer */
.footer {
    background: var(--text-primary);
    color: var(--text-light);
    padding: 2rem 0;
    margin-top: auto;
}

.footer-content {
    text-align: center;
}

.footer-content p {
    margin: 0.5rem 0;
}

.footer-notice {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: #fbbf24;
}

/* Alert Messages */
.alert {
    padding: 1rem 1.5rem;
    border-radius: var(--border-radius);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.alert-info {
    background: #dbeafe;
    color: #1e40af;
}

.alert-warning {
    background: #fef3c7;
    color: #92400e;
}

/* Visit Tracker Styles */
.visit-card {
    background: white;
    border-radius: var(--border-radius);
    padding: 1.5rem;
    margin-bottom: 1rem;
    border-left: 4px solid var(--primary-color);
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
}

.visit-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateX(5px);
}

.visit-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.visit-date {
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.visit-date i {
    color: var(--primary-color);
}

.visit-facility {
    color: var(--text-secondary);
    font-size: 0.875rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.visit-facility i {
    color: var(--primary-color);
}

.visit-details {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.visit-detail-item {
    color: var(--text-primary);
    line-height: 1.6;
}

.visit-detail-item strong {
    color: var(--text-secondary);
}

/* Surgery Styles */
.surgery-card {
    background: white;
    border-radius: var(--border-radius);
    padding: 1.5rem;
    margin-bottom: 1rem;
    border-left: 4px solid #dc2626;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
}

.surgery-card:hover {
    box-shadow: var(--shadow-md);
}

.surgery-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.surgery-date {
    font-weight: 600;
    color: #dc2626;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.surgery-date i {
    color: #dc2626;
}

.surgery-hospital {
    color: var(--text-secondary);
    font-size: 0.875rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.surgery-hospital i {
    color: #dc2626;
}

.surgery-details {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.surgery-procedure,
.surgery-surgeon,
.surgery-notes {
    color: var(--text-primary);
    line-height: 1.6;
}

.surgery-procedure strong,
.surgery-surgeon strong,
.surgery-notes strong {
    color: var(--text-secondary);
}

/* Pregnancy Journal Styles */
.journal-entry {
    background: white;
    border-radius: var(--border-radius);
    padding: 1.5rem;
    margin-bottom: 1rem;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
}

.journal-entry:hover {
    box-shadow: var(--shadow-md);
}

.journal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.journal-date {
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.journal-date i {
    color: var(--primary-color);
}

.journal-type {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.875rem;
    font-weight: 500;
}

.type-appointment {
    background: #dbeafe;
    color: #1e40af;
}

.type-mood {
    background: #fce7f3;
    color: #be185d;
}

.journal-content {
    color: var(--text-primary);
    line-height: 1.8;
    padding: 1rem;
    background: var(--bg-secondary);
    border-radius: var(--border-radius);
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 0 1rem;
    }

    .access-card {
        padding: 2rem 1.5rem;
    }

    .access-title {
        font-size: 1.75rem;
    }

    .code-inputs {
        gap: 0.5rem;
    }

    .code-input {
        width: 45px;
        height: 45px;
        font-size: 1.25rem;
    }

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

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

    .details-header {
        flex-direction: column;
        gap: 1rem;
        align-items: stretch;
    }

    .nav-brand {
        flex-wrap: wrap;
    }

    .portal-label {
        width: 100%;
        text-align: center;
    }

    .visit-header,
    .surgery-header,
    .journal-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .journal-type {
        align-self: flex-start;
    }
}

/* Print Styles */
@media print {
    .header,
    .footer,
    .details-header,
    .search-section {
        display: none;
    }

    .patient-details-section {
        box-shadow: none;
    }
}

/* Access Granted Header - New Design */
.access-granted-header {
    text-align: center;
    margin-bottom: 2rem;
    padding: 2rem 0;
}

.access-granted-title {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 1rem;
}

.verified-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1.5rem;
    background: #d1fae5;
    color: #059669;
    border-radius: 25px;
    font-weight: 600;
    font-size: 0.95rem;
    margin-bottom: 1.5rem;
}

.verified-badge i {
    color: #059669;
}

.access-timer {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.access-timer i {
    color: var(--text-secondary);
}

/* Patient Information Card - New Design */
.patient-info-card {
    background: white;
    border-radius: var(--border-radius-lg);
    padding: 2rem;
    box-shadow: var(--shadow-md);
    max-width: 600px;
    margin: 0 auto;
}

.card-section-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 1.5rem;
}

/* Info Row - Two Column Layout */
.patient-info-card .info-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border-color);
}

.patient-info-card .info-row:last-child {
    border-bottom: none;
}

.info-label {
    color: var(--text-secondary);
    font-size: 0.95rem;
    font-weight: 500;
}

.info-value {
    color: var(--text-primary);
    font-size: 1rem;
    font-weight: 600;
    text-align: right;
}

/* Badge Container */
.badge-container {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

/* Info Badge - Mint Green Pills */
.info-badge {
    background: #d1fae5;
    color: #065f46;
    padding: 0.75rem 1rem;
    border-radius: var(--border-radius);
    font-size: 0.95rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: var(--transition);
}

.info-badge:hover {
    background: #a7f3d0;
    transform: translateX(5px);
}

/* Allergy Badge - With Warning Icon */
.allergy-badge {
    background: #fef3c7;
    color: #92400e;
    border-left: 3px solid #f59e0b;
}

.allergy-badge i {
    color: #f59e0b;
}

.allergy-badge:hover {
    background: #fde68a;
}

/* Emergency Contact Card */
.emergency-contact-card {
    background: #d1fae5;
    padding: 1.25rem;
    border-radius: var(--border-radius);
    margin-top: 0.5rem;
    transition: var(--transition);
}

.emergency-contact-card:hover {
    background: #a7f3d0;
    transform: translateX(5px);
}

.contact-name {
    font-weight: 600;
    color: #065f46;
    margin-bottom: 0.5rem;
    font-size: 1rem;
}

.contact-phone {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #047857;
    font-size: 0.95rem;
}

.contact-phone i {
    color: #059669;
}

/* Action Buttons */
.action-buttons {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-top: 2rem;
    flex-wrap: wrap;
}

.btn-print,
.btn-end-session {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.875rem 1.75rem;
    font-size: 1rem;
    font-weight: 600;
    border-radius: var(--border-radius-lg);
    cursor: pointer;
    transition: var(--transition);
    border: none;
}

.btn-print {
    background: white;
    color: var(--text-primary);
    border: 2px solid var(--border-color);
}

.btn-print:hover {
    background: var(--bg-secondary);
    border-color: var(--text-secondary);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.btn-end-session {
    background: #dc2626;
    color: white;
    box-shadow: var(--shadow-md);
}

.btn-end-session:hover {
    background: #b91c1c;
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn-end-session i {
    font-size: 1rem;
}

.btn-print i {
    font-size: 1rem;
}

/* Responsive Design for New Layout */
@media (max-width: 768px) {
    .access-granted-title {
        font-size: 1.5rem;
    }

    .patient-info-card {
        padding: 1.5rem;
    }

    .card-section-title {
        font-size: 1.1rem;
    }

    .patient-info-card .info-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.25rem;
    }

    .info-value {
        text-align: left;
        font-size: 1.1rem;
    }

    .action-buttons {
        flex-direction: column;
    }

    .btn-print,
    .btn-end-session {
        width: 100%;
        justify-content: center;
    }
}

/* Print Styles for New Layout */
@media print {
    .access-granted-header,
    .action-buttons,
    .header,
    .footer {
        display: none;
    }

    .patient-info-card {
        box-shadow: none;
        max-width: 100%;
    }

    .access-timer {
        display: none;
    }
}
