/**
 * Estilos para componentes reutilizáveis
 * Sistema IBAPE - Laudos de Patologias
 */

/* ==========================================================================
   DynamicList Component
   ========================================================================== */

.dynamic-list-container {
    margin: 15px 0;
}

.dynamic-list-add-btn-container {
    margin-bottom: 15px;
}

.dynamic-list-items {
    margin-top: 10px;
}

.dynamic-list-item {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 15px;
    margin: 10px 0;
    position: relative;
    transition: box-shadow 0.2s;
}

.dynamic-list-item:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.dynamic-list-empty {
    padding: 20px;
    text-align: center;
    color: #999;
    font-style: italic;
    border: 2px dashed #ddd;
    border-radius: 8px;
}

.dynamic-list-fields {
    margin-top: 10px;
}

/* ==========================================================================
   PhotoUploader Component
   ========================================================================== */

.photo-uploader-empty {
    padding: 40px;
    text-align: center;
    color: #999;
    border: 2px dashed #ddd;
    border-radius: 8px;
}

.photo-uploader-empty i {
    font-size: 48px;
    margin-bottom: 10px;
    display: block;
    color: #ccc;
}

.photo-uploader-card {
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 10px;
    background: white;
    transition: transform 0.2s, box-shadow 0.2s;
}

.photo-uploader-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.photo-caption {
    width: 100%;
    padding: 6px;
    font-size: 12px;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    margin-bottom: 8px;
}

.photo-caption:focus {
    outline: none;
    border-color: var(--primary-color);
}

/* ==========================================================================
   LocationPicker Component
   ========================================================================== */

.location-picker-container {
    margin: 15px 0;
}

.location-picker-input {
    width: 100%;
    padding: 8px;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    font-size: 14px;
    transition: border-color 0.2s;
}

.location-picker-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(var(--primary-color-rgb), 0.1);
}

.location-picker-input[required] {
    border-left: 3px solid var(--primary-color);
}

/* ==========================================================================
   GUTCalculator Component
   ========================================================================== */

.gut-calculator-container {
    margin: 20px 0;
}

.gut-calculator-header {
    background: #fff3e0;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.gut-calculator-header h4 {
    margin: 0 0 10px 0;
    color: #f57c00;
    display: flex;
    align-items: center;
    gap: 8px;
}

.gut-calculator-fields {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.gut-calculator-select {
    width: 100%;
    padding: 10px;
    border: 2px solid #dee2e6;
    border-radius: 4px;
    font-size: 14px;
    transition: border-color 0.3s;
    background: white;
}

.gut-calculator-select:focus {
    outline: none;
    border-color: var(--primary-color);
}

.gut-calculator-select:valid {
    border-color: #28a745;
}

.gut-calculator-result {
    text-align: center;
    padding: 25px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 2px solid #dee2e6;
}

/* ==========================================================================
   BibliotecaSelector Component
   ========================================================================== */

.biblioteca-selector-container {
    margin: 15px 0;
}

.biblioteca-selector-list {
    margin-top: 10px;
}

.biblioteca-selector-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    padding: 10px 15px;
    margin-bottom: 8px;
    transition: background 0.2s;
}

.biblioteca-selector-item:hover {
    background: #e9ecef;
}

.biblioteca-available-item {
    border: 1px solid #dee2e6;
    border-radius: 4px;
    padding: 12px;
    margin-bottom: 10px;
    cursor: pointer;
    transition: all 0.2s;
}

.biblioteca-available-item:hover {
    background: #f8f9fa;
    border-color: var(--primary-color);
    transform: translateX(5px);
}

/* ==========================================================================
   Modal Overrides
   ========================================================================== */

.modal {
    display: none;
    position: fixed;
    z-index: 10000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0,0,0,0.5);
    align-items: center;
    justify-content: center;
}

.modal.show {
    display: flex !important;
}

.modal-content {
    background-color: #fefefe;
    padding: 0;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.modal-header {
    padding: 20px;
    border-bottom: 1px solid #dee2e6;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    margin: 0;
    color: var(--primary-color);
}

.modal-body {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
}

.modal-footer {
    padding: 15px 20px;
    border-top: 1px solid #dee2e6;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.close {
    background: none;
    border: none;
    font-size: 28px;
    font-weight: bold;
    color: #999;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.close:hover {
    color: #333;
}

/* ==========================================================================
   Form Elements
   ========================================================================== */

.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    color: #333;
}

.form-group input[type="text"],
.form-group input[type="number"],
.form-group input[type="date"],
.form-group input[type="email"],
.form-group input[type="tel"],
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    font-size: 14px;
    font-family: inherit;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(var(--primary-color-rgb), 0.1);
}

.form-group textarea {
    resize: vertical;
    min-height: 80px;
}

.required {
    color: #d32f2f;
    font-weight: bold;
}

/* ==========================================================================
   Buttons
   ========================================================================== */

.btn {
    display: inline-block;
    padding: 8px 16px;
    font-size: 14px;
    font-weight: 500;
    text-align: center;
    text-decoration: none;
    border: 1px solid transparent;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 13px;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.btn-primary:hover {
    background: var(--primary-color-dark);
    border-color: var(--primary-color-dark);
}

.btn-secondary {
    background: #6c757d;
    color: white;
    border-color: #6c757d;
}

.btn-secondary:hover {
    background: #5a6268;
    border-color: #545b62;
}

.btn-outline-primary {
    background: transparent;
    color: var(--primary-color);
    border-color: var(--primary-color);
}

.btn-outline-primary:hover {
    background: var(--primary-color);
    color: white;
}

.btn-outline-danger {
    background: transparent;
    color: #d32f2f;
    border-color: #d32f2f;
}

.btn-outline-danger:hover {
    background: #d32f2f;
    color: white;
}

.btn-outline-secondary {
    background: transparent;
    color: #6c757d;
    border-color: #6c757d;
}

.btn-outline-secondary:hover {
    background: #6c757d;
    color: white;
}

/* ==========================================================================
   Badges
   ========================================================================== */

.badge {
    display: inline-block;
    padding: 4px 8px;
    font-size: 12px;
    font-weight: 600;
    border-radius: 4px;
}

.badge-critico {
    background: #d32f2f;
    color: white;
}

.badge-medio {
    background: #f57c00;
    color: white;
}

.badge-minimo {
    background: #388e3c;
    color: white;
}

/* ==========================================================================
   Alerts
   ========================================================================== */

.alert {
    padding: 12px 16px;
    border-radius: 4px;
    margin-bottom: 15px;
}

.alert-info {
    background: #e3f2fd;
    border: 1px solid #90caf9;
    color: #1976d2;
}

.alert-warning {
    background: #fff3e0;
    border: 1px solid #ffb74d;
    color: #f57c00;
}

.alert-danger {
    background: #ffebee;
    border: 1px solid #e57373;
    color: #d32f2f;
}

.alert-success {
    background: #e8f5e9;
    border: 1px solid #81c784;
    color: #388e3c;
}

/* ==========================================================================
   Grid System
   ========================================================================== */

.row {
    display: flex;
    flex-wrap: wrap;
    margin: 0 -10px;
}

.col-md-4 {
    flex: 0 0 33.333333%;
    max-width: 33.333333%;
    padding: 0 10px;
}

.col-md-6 {
    flex: 0 0 50%;
    max-width: 50%;
    padding: 0 10px;
}

.col-md-12 {
    flex: 0 0 100%;
    max-width: 100%;
    padding: 0 10px;
}

@media (max-width: 768px) {
    .col-md-4,
    .col-md-6 {
        flex: 0 0 100%;
        max-width: 100%;
    }
}

/* ==========================================================================
   Utilities
   ========================================================================== */

.text-center {
    text-align: center;
}

.text-right {
    text-align: right;
}

.mb-0 { margin-bottom: 0 !important; }
.mb-1 { margin-bottom: 8px !important; }
.mb-2 { margin-bottom: 16px !important; }
.mb-3 { margin-bottom: 24px !important; }

.mt-0 { margin-top: 0 !important; }
.mt-1 { margin-top: 8px !important; }
.mt-2 { margin-top: 16px !important; }
.mt-3 { margin-top: 24px !important; }

.d-none {
    display: none !important;
}

.d-block {
    display: block !important;
}

.d-flex {
    display: flex !important;
}

/* ==========================================================================
   Radio Group
   ========================================================================== */

.radio-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.radio-group label {
    display: flex;
    align-items: center;
    padding: 8px 12px;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
}

.radio-group label:hover {
    background: #f8f9fa;
    border-color: var(--primary-color);
}

.radio-group input[type="radio"] {
    margin-right: 8px;
}

/* ==========================================================================
   Table
   ========================================================================== */

.table {
    width: 100%;
    border-collapse: collapse;
    margin: 15px 0;
}

.table th,
.table td {
    padding: 10px;
    text-align: left;
    border-bottom: 1px solid #dee2e6;
}

.table th {
    background: #f8f9fa;
    font-weight: 600;
    color: #333;
}

.table tbody tr:hover {
    background: #f8f9fa;
}

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 768px) {
    .gut-calculator-fields {
        grid-template-columns: 1fr;
    }

    .modal-content {
        width: 95%;
    }
}
