@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Outfit:wght@500;600;700&display=swap');

:root {
    --primary: #008176;
    --primary-light: #e6f3f1;
    --primary-dark: #006b62;
    --accent: #00b8a9;
    --secondary: #64748b;
    --bg-body: #f5f7f9;
    --bg-card: #ffffff;
    --text-main: #1e293b;
    --text-secondary: #64748b;
    --border-color: #eef2f6;
    --error: #dc2626;
    --success: #10b981;
    --radius: 12px;
    --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.05), 0 1px 2px -1px rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.05), 0 2px 4px -2px rgb(0 0 0 / 0.05);
}

.mb-4 {
    margin-bottom: 1.5rem;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-body);
    color: var(--text-main);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3,
h4,
.page-title,
.card-title {
    font-family: 'Outfit', sans-serif;
    color: #1e293b;
}

/* --- Layout --- */
.app-container {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 260px;
    background-color: #ffffff;
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    z-index: 100;
}

.sidebar-logo {
    padding: 32px 24px;
}

.sidebar-nav {
    flex: 1;
    padding: 0 16px;
}

.nav-item {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    border-radius: 10px;
    color: #64748b;
    text-decoration: none;
    margin-bottom: 4px;
    font-weight: 500;
    font-size: 0.938rem;
    transition: all 0.2s;
}

.nav-item:hover {
    background-color: #f8fafc;
    color: var(--primary);
}

.nav-item.active {
    background-color: var(--primary);
    color: #ffffff;
}

.nav-item.active .nav-icon svg {
    fill: #ffffff !important;
}

.nav-item.active .nav-icon path {
    fill: #ffffff !important;
    stroke: none !important;
}

.nav-icon {
    width: 20px;
    height: 20px;
    margin-right: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.nav-icon svg {
    width: 18px;
    height: 18px;
    transition: all 0.2s;
}

.sidebar-footer {
    padding: 16px;
    border-top: 1px solid var(--border-color);
}

.user-info {
    background: #f8fafc;
    padding: 16px;
    border-radius: 12px;
    margin-bottom: 12px;
}

.user-avatar {
    width: 36px;
    height: 36px;
    background: var(--primary);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.875rem;
    margin-bottom: 12px;
}

.user-name {
    font-size: 0.875rem;
    font-weight: 600;
    color: #1e293b;
}

.user-role {
    font-size: 0.75rem;
    color: #64748b;
    margin-bottom: 8px;
}

.btn-logout {
    display: block;
    width: 100%;
    padding: 10px;
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: #64748b;
    text-align: center;
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
}

.main-content {
    flex: 1;
    margin-left: 260px;
    padding: 40px 60px;
    width: calc(100% - 260px);
}

/* --- Page Header --- */
.page-header {
    margin-bottom: 40px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: flex-start;
    gap: 4px;
}

.page-title {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 4px;
}

.page-subtitle {
    color: #64748b;
    font-size: 0.938rem;
}

/* --- Cards --- */
.card {
    background: #ffffff;
    border-radius: 16px;
    padding: 24px;
    box-shadow: var(--shadow);
    margin-bottom: 24px;
    border: 1px solid #f1f5f9;
}

.card-header {
    margin-bottom: 24px;
}

.card-title {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 4px;
}

.card-subtitle {
    font-size: 0.875rem;
    color: #64748b;
}

/* --- Stats --- */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 24px;
    margin-bottom: 32px;
}

.stat-card {
    background: white;
    padding: 32px;
    border-radius: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--shadow);
    border: 1px solid #f1f5f9;
}

.stat-label {
    font-size: 0.875rem;
    color: #64748b;
    margin-bottom: 8px;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: #1e293b;
}

.stat-description {
    font-size: 0.75rem;
    color: #94a3b8;
    margin-top: 4px;
}

.stat-icon {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.stat-icon svg {
    width: 40px;
    height: 40px;
}

/* Ações Rápidas Card */
.actions-card {
    background: linear-gradient(135deg, #008176 0%, #005a52 100%);
    color: white;
    padding: 32px;
    border-radius: 16px;
}

.actions-card .card-title {
    color: white;
    margin-bottom: 24px;
}

.action-btn {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 20px;
    background: rgba(0, 0, 0, 0.15);
    border-radius: 12px;
    color: white;
    text-decoration: none;
    font-weight: 500;
    margin-bottom: 12px;
    transition: background 0.2s;
}

.action-btn:hover {
    background: rgba(0, 0, 0, 0.25);
}

.action-btn .arrow {
    font-size: 0.875rem;
    opacity: 0.7;
}

/* --- Tables --- */
.table-container {
    background: white;
    border-radius: 16px;
    box-shadow: var(--shadow);
    overflow: hidden;
    border: 1px solid #f1f5f9;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th {
    background: #f8fafc;
    padding: 16px 24px;
    text-align: left;
    font-size: 0.75rem;
    font-weight: 600;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid #f1f5f9;
}

.data-table td {
    padding: 20px 24px;
    border-bottom: 1px solid #f1f5f9;
    vertical-align: middle;
}

.data-table tr:last-child td {
    border-bottom: none;
}

.data-table strong {
    display: block;
    color: #1e293b;
    font-weight: 600;
}

.text-secondary {
    color: #64748b;
    font-size: 0.813rem;
}

/* --- Buttons --- */
.btn {
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.875rem;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    border: none;
    cursor: pointer;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-dark);
}

.btn-full {
    width: 100%;
}

.btn-danger {
    background: #ef4444;
    color: white;
}

.btn-danger:hover {
    background: #dc2626;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.75rem;
}

/* --- Form Elements --- */
.form-group {
    margin-bottom: 24px;
}

.form-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    margin-bottom: 8px;
    color: #334155;
}

.form-input,
.form-select {
    width: 100%;
    padding: 12px 16px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    font-size: 0.938rem;
    color: #1e293b;
    transition: all 0.2s;
}

.form-input:focus,
.form-select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(0, 129, 118, 0.1);
}

.form-hint {
    font-size: 0.813rem;
    margin-top: 8px;
    color: #64748b;
}

/* File Input Wrapper */
.file-input-wrapper {
    position: relative;
}

.file-input-wrapper input[type="file"] {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

.file-input-text {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    background: #ffffff;
    border: 1px dashed #cbd5e1;
    border-radius: 10px;
    font-size: 0.875rem;
    color: #64748b;
}

.file-input-text .highlight {
    color: var(--primary);
    font-weight: 600;
    margin-right: 8px;
}

/* Login Page Specific */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f8fafc;
}

.login-card {
    width: 100%;
    max-width: 440px;
    background: white;
    padding: 48px;
    border-radius: 20px;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1);
}

/* --- Two Column Layout --- */
.two-column {
    display: grid;
    grid-template-columns: 1.2fr 0.8fr;
    gap: 32px;
}

/* --- History Items --- */
.history-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.history-item {
    display: flex;
    align-items: center;
    padding: 16px;
    background: white;
    border: 1px solid #f1f5f9;
    border-radius: 12px;
}

.history-icon {
    width: 40px;
    height: 40px;
    background: #f1f5f9;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 16px;
    font-size: 1.25rem;
}

.history-content {
    flex: 1;
}

.history-title {
    font-weight: 600;
    font-size: 0.938rem;
    color: #1e293b;
}

.history-subtitle {
    font-size: 0.813rem;
    color: #64748b;
}

.history-date {
    font-size: 0.813rem;
    color: #94a3b8;
}

/* --- Search Bar (Patients Page) --- */
.search-container {
    background: white;
    border-radius: 12px;
    padding: 24px;
    box-shadow: var(--shadow);
    margin-bottom: 24px;
    border: 1px solid #f1f5f9;
}

.search-input-group {
    position: relative;
    display: flex;
    align-items: center;
}

.search-icon {
    position: absolute;
    left: 16px;
    color: #94a3b8;
}

.search-input {
    width: 100%;
    padding: 12px 16px 12px 48px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    font-size: 0.938rem;
}

/* --- Alerts --- */
.alert {
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 24px;
    font-size: 0.875rem;
    font-weight: 500;
}

.alert-success {
    background-color: #d1fae5;
    color: #065f46;
    border: 1px solid #10b981;
}

.alert-error {
    background-color: #fef2f2;
    color: #991b1b;
    border: 1px solid #f87171;
}

/* --- Responsive --- */
@media (max-width: 1024px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .main-content {
        margin-left: 0;
        padding: 40px 24px;
        width: 100%;
    }

    .two-column {
        grid-template-columns: 1fr;
    }
}

/* --- Patient Area Styles --- */
.patient-main {
    max-width: 900px;
    margin: 0 auto;
    padding: 40px 20px;
}

.patient-header {
    background: linear-gradient(135deg, #008176 0%, #005a52 100%);
    padding: 32px;
    border-radius: 16px;
    color: white;
    margin-bottom: 32px;
    box-shadow: var(--shadow-md);
}

.patient-header-content {
    margin-bottom: 24px;
}

.patient-header-logo {
    max-width: 180px;
    margin-bottom: 16px;
    display: block;
}

.patient-header-title {
    font-family: 'Outfit', sans-serif;
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 8px;
    color: white;
}

.patient-header-welcome {
    font-size: 1rem;
    opacity: 0.95;
    margin-bottom: 0;
    line-height: 1.6;
}

.patient-header-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.patient-header-actions .btn {
    flex: 1;
    min-width: 140px;
    justify-content: center;
    font-weight: 600;
}

.btn-white {
    background: white;
    color: #008176;
}

.btn-white:hover {
    background: #f1f5f9;
    color: #006b62;
}

@media (max-width: 640px) {
    .patient-header {
        padding: 24px;
    }

    .patient-header-title {
        font-size: 1.5rem;
    }

    .patient-header-actions {
        flex-direction: column;
    }

    .patient-header-actions .btn {
        width: 100%;
    }
}