/* styles.css */
:root {
    --primary: #059669;
    --primary-hover: #047857;
    --bg: #f8fafc;
    --text: #0f172a;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --white: #ffffff;
    --danger: #ef4444;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg);
    color: var(--text);
    line-height: 1.5;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}

.header {
    background-color: var(--white);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 50;
}

.header-content {
    height: 4rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.logo-icon {
    background-color: var(--primary);
    color: var(--white);
    width: 2.5rem;
    height: 2.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.75rem;
    font-size: 1.25rem;
}

.logo-text h1 {
    font-size: 1.25rem;
    font-weight: 700;
}

.logo-text p {
    font-size: 0.625rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--primary);
    font-weight: 700;
}

.main-content {
    padding: 2rem 0;
    min-height: calc(100vh - 8rem);
}

.view-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
}

.view-header h2 {
    font-size: 1.5rem;
    font-weight: 700;
}

.view-header p {
    color: var(--text-muted);
    font-size: 0.875rem;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    font-weight: 500;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
    font-size: 0.875rem;
    gap: 0.5rem;
}

.btn-primary {
    background-color: var(--primary);
    color: var(--white);
}

.btn-primary:hover {
    background-color: var(--primary-hover);
}

.btn-ghost {
    background-color: transparent;
    color: var(--text-muted);
}

.btn-ghost:hover {
    background-color: #f1f5f9;
}

.btn-outline {
    border: 1px solid var(--border);
    background-color: transparent;
}

.btn-sm {
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
}

.w-full { width: 100%; }
.mt-4 { margin-top: 1rem; }
.text-danger { color: var(--danger); }

.search-bar {
    position: relative;
    margin-bottom: 1.5rem;
}

.search-bar i {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}

.search-bar input {
    width: 100%;
    padding: 0.75rem 1rem 0.75rem 2.5rem;
    border: 1px solid var(--border);
    border-radius: 0.75rem;
    font-size: 0.875rem;
}

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1rem;
}

.card {
    background-color: var(--white);
    border: 1px solid var(--border);
    border-radius: 0.75rem;
    overflow: hidden;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

.patient-card {
    padding: 1.25rem;
    cursor: pointer;
    transition: all 0.2s;
}

.patient-card:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: 0 4px 6px rgba(0,0,0,0.05);
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: justify-between;
    padding: 1rem;
    border-bottom: 1px solid var(--border);
}

.card-body {
    padding: 1rem;
}

.card-footer {
    padding: 1rem;
    border-top: 1px solid var(--border);
}

.detail-grid {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 2rem;
}

@media (max-width: 768px) {
    .detail-grid { grid-template-columns: 1fr; }
}

textarea {
    width: 100%;
    min-height: 150px;
    padding: 1rem;
    border: 1px solid var(--border);
    border-radius: 0.75rem;
    margin-bottom: 1rem;
    font-family: inherit;
    resize: vertical;
}

.modal {
    display: none;
    position: fixed;
    inset: 0;
    background-color: rgba(0,0,0,0.5);
    z-index: 100;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.modal-content {
    background-color: var(--white);
    border-radius: 1rem;
    width: 100%;
    max-width: 500px;
    padding: 2rem;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
}

.btn-close {
    font-size: 1.5rem;
    background: none;
    border: none;
    cursor: pointer;
}

.form-group { margin-bottom: 1rem; }
.form-group label { display: block; font-size: 0.875rem; font-weight: 500; margin-bottom: 0.25rem; }
.form-group input, .form-group select {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: 0.5rem;
}

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }

.attached-files-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.drop-zone {
    border: 2px dashed var(--border);
    border-radius: 1rem;
    padding: 2rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    background-color: #f8fafc;
}

.drop-zone:hover, .drop-zone.drag-over {
    border-color: var(--primary);
    background-color: #f0fdf4;
}

.drop-zone-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    color: var(--text-muted);
}

.drop-zone-content i {
    color: var(--primary);
    opacity: 0.7;
}

.drop-zone-content p {
    font-size: 0.875rem;
    font-weight: 500;
}

.drop-zone-content span {
    font-size: 0.75rem;
    opacity: 0.6;
}

.attached-file-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    background-color: var(--white);
    border: 1px solid var(--border);
    border-radius: 0.75rem;
    font-size: 0.875rem;
    transition: all 0.2s;
}

.attached-file-item:hover {
    border-color: var(--primary);
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.attached-file-info {
    display: flex;
    align-items: center;
    gap: 1rem;
    overflow: hidden;
}

.file-icon-wrapper {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.file-icon-wrapper.pdf {
    background-color: #fef2f2;
    color: #ef4444;
}

.file-icon-wrapper.image {
    background-color: #f0fdf4;
    color: #22c55e;
}

.file-details {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.file-name {
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 200px;
}

.file-size {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.btn-remove-file {
    color: var(--text-muted);
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    padding: 0.5rem;
    border-radius: 0.375rem;
    transition: all 0.2s;
}

.btn-remove-file:hover {
    background-color: #fee2e2;
    color: var(--danger);
}

.is-recording {
    color: var(--danger) !important;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.2); opacity: 0.7; }
    100% { transform: scale(1); opacity: 1; }
}

.line-clamp-1 {
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.animate-in {
    animation-duration: 0.2s;
    animation-fill-mode: forwards;
}

.fade-in {
    animation-name: fadeIn;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.slide-in-from-top-2 {
    animation-name: slideInFromTop;
}

@keyframes slideInFromTop {
    from { transform: translateY(-0.5rem); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.footer {
    background-color: var(--white);
    border-top: 1px solid var(--border);
    padding: 2rem 0;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.875rem;
}

/* Validação de Formulários */
.form-group input.invalid,
.form-group select.invalid,
.form-group textarea.invalid {
    border-color: #ef4444 !important;
    background-color: #fef2f2;
}

.error-message {
    color: #ef4444;
    font-size: 0.75rem;
    margin-top: 0.25rem;
    display: none;
}

.form-group input.invalid + .error-message,
.form-group select.invalid + .error-message,
.form-group textarea.invalid + .error-message {
    display: block;
}

/* AI Diagnosis Rendering Styles */
.ai-diagnosis-card {
    margin-bottom: 1.5rem;
    padding: 1.25rem;
    background: #f0fdf4;
    border-radius: 0.75rem;
    border: 1px solid #bbf7d0;
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
}

.ai-diagnosis-title {
    font-weight: 800;
    color: #166534;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
    font-size: 1rem;
}

.treatment-section {
    padding-top: 0.75rem;
    border-top: 1px solid #dcfce7;
}

.treatment-label {
    font-size: 0.75rem;
    font-weight: 800;
    text-transform: uppercase;
    color: #15803d;
    letter-spacing: 0.05em;
    margin-bottom: 0.25rem;
}

.treatment-content {
    font-size: 0.875rem;
    color: #166534;
    line-height: 1.625;
    white-space: pre-wrap;
}

.medication-calc-item {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 0.75rem;
    padding: 1rem;
    margin-bottom: 0.75rem;
    transition: all 0.2s;
}

.medication-calc-item:hover {
    border-color: var(--primary);
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.sources-container {
    padding: 1rem;
    background: #f8fafc;
    border-radius: 0.75rem;
    border: 1px solid #e2e8f0;
    margin-top: 1.5rem;
}

.sources-title {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    color: #64748b;
    margin-bottom: 0.5rem;
}

.sources-list {
    margin: 0;
    padding-left: 1.25rem;
    font-size: 0.75rem;
    color: #64748b;
    line-height: 1.5;
}
