/* General Styles */
:root {
    --primary-color: #0F2F4A;
    --secondary-color: #6c757d;
    --action-color: #D60E1B;
    --light-gray: #f8f9fa;
    --gray: #dee2e6;
    --dark-gray: #343a40;
    --font-family: 'Outfit', sans-serif;
}

body {
    font-family: var(--font-family);
    background-color: #f0f2f5;
    color: var(--dark-gray);
    margin: 0;
    padding: 20px;
}

.container {
    max-width: 900px;
    margin: 0 auto;
    background-color: #fff;
    padding: 2rem;
    border-radius: 8px;
    position: relative;
    overflow: visible;
    /* Fix for missing buttons if they get pushed out */
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.container-wide {
    max-width: 98%;
    margin: 0 auto;
    background-color: #fff;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

/* Header */
.main-header {
    text-align: center;
    margin-bottom: 2rem;
    border-bottom: 1px solid var(--gray);
    padding-bottom: 1rem;
}

.main-header h1 {
    color: var(--primary-color);
    margin: 0;
}

.main-header .subtitle {
    color: var(--secondary-color);
    font-size: 1.1rem;
    margin-top: 0.5rem;
}

.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    flex-wrap: wrap;
}

.dashboard-header h1 {
    color: var(--primary-color);
    margin: 0;
}

.back-link {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 600;
}

/* Form Styles */
.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}

input[type="text"],
input[type="number"],
input[type="date"],
input[type="email"],
input[type="password"],
select,
textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--gray);
    border-radius: 4px;
    font-size: 1rem;
    box-sizing: border-box;
    transition: border-color 0.2s, box-shadow 0.2s;
    /* text-transform: uppercase; REMOVED per user request */
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(15, 47, 74, 0.2);
}

input[readonly] {
    background-color: var(--light-gray);
    cursor: not-allowed;
}

textarea {
    resize: vertical;
}

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

/* Checkbox Group */
.checkbox-group {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
}

.checkbox-item {
    display: flex;
    align-items: center;
    background-color: var(--light-gray);
    padding: 0.5rem 1rem;
    border-radius: 4px;
    cursor: pointer;
}

.checkbox-item input {
    margin-right: 0.5rem;
}

/* Stepper */
.stepper {
    display: flex;
    justify-content: space-between;
    margin-bottom: 2rem;
    position: relative;
}

.stepper::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 2px;
    background-color: var(--gray);
    transform: translateY(-50%);
    z-index: 1;
}

.step-item {
    position: relative;
    z-index: 2;
}

.step-circle {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background-color: var(--gray);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    transition: background-color 0.3s;
    cursor: pointer;
}

.step-item.active .step-circle {
    background-color: var(--primary-color);
}

.step-item.completed .step-circle {
    background-color: var(--secondary-color);
}

/* Form Steps */
.form-step {
    display: none;
}

.form-step.active {
    display: block;
}

/* Buttons */
.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 4px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
    text-align: center;
    transition: opacity 0.3s;
}

.btn:hover {
    opacity: 0.85;
}

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

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

#submitBtn {
    background-color: var(--action-color);
    color: white;
}

.btn-hidden {
    visibility: hidden;
}

.btn-sm {
    padding: 0.25rem 0.75rem;
    font-size: 0.8rem;
}

/* Navigation Buttons - Always Visible at Bottom */
.nav-buttons {
    display: flex;
    justify-content: space-between;
    padding: 1rem 0;
    margin-top: 2rem;
    border-top: 1px solid var(--gray);
    background: #fff;
}


/* Saving Indicator */
.saving-indicator {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background-color: var(--primary-color);
    color: white;
    padding: 10px 20px;
    border-radius: 5px;
    display: none;
    z-index: 100;
}

/* Dashboard & Admin Panel */
.actions {
    margin-bottom: 2rem;
}

.table-container {
    overflow-x: auto;
    border-radius: 8px;
    border: 1px solid var(--gray);
}

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

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

th {
    background-color: var(--light-gray);
    font-weight: 600;
    position: sticky;
    top: 0;
    z-index: 10;
    text-transform: uppercase;
    font-size: 0.8rem;
    letter-spacing: 0.5px;
    color: var(--secondary-color);
}

tbody tr:hover {
    background-color: #f1f3f5;
}

td .btn {
    margin-right: 5px;
}

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

.stat-card {
    background-color: var(--light-gray);
    padding: 1.5rem;
    border-radius: 8px;
    text-align: left;
    position: relative;
    overflow: hidden;
    transition: transform 0.2s;
}

.stat-card:hover {
    transform: translateY(-2px);
}

.stat-card.blue {
    border-left: 5px solid var(--primary-color);
}

.stat-card.green {
    border-left: 5px solid #28a745;
}

.stat-card.orange {
    border-left: 5px solid #fd7e14;
}

.stat-card.purple {
    border-left: 5px solid #6f42c1;
}

.stat-card h3 {
    margin-top: 0;
    color: var(--secondary-color);
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.5rem;
}

.stat-card p {
    font-size: 2rem;
    font-weight: 800;
    margin-bottom: 0;
    color: var(--dark-gray);
}

.card {
    background-color: #fff;
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.card ul {
    list-style: none;
    padding: 0;
}

.card li {
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--light-gray);
}

.card li:last-child {
    border-bottom: none;
}

/* Progress Bars & Lists */
.list-item-stat {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.8rem;
    font-size: 0.95rem;
}

.progress-bg {
    background-color: #e9ecef;
    height: 6px;
    border-radius: 3px;
    width: 100%;
    margin-top: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background-color: var(--primary-color);
}

.badge {
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 700;
}

/* Tabs */
.tabs {
    display: flex;
    gap: 10px;
    border-bottom: 1px solid var(--gray);
    margin-bottom: 20px;
    overflow-x: auto;
    padding: 0 10px;
    background: #fff;
}

.tab {
    padding: 12px 24px;
    cursor: pointer;
    font-weight: 600;
    color: var(--secondary-color);
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
    text-decoration: none;
    white-space: nowrap;
    transition: all 0.2s;
}

.tab.active,
.tab:hover {
    color: var(--primary-color);
    border-bottom-color: var(--action-color);
    background-color: transparent;
}

/* Sticky Action Bar for Tags */
.sticky-actions {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(5px);
    padding: 15px 30px;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    justify-content: space-between;
    z-index: 1000;
    border-top: 1px solid var(--gray);
}

.sticky-actions .selected-count {
    font-weight: bold;
    color: var(--primary-color);
}

.sticky-actions .merge-form {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

/* Search Bar Style */
.search-container {
    margin-bottom: 1.5rem;
    position: relative;
    max-width: 400px;
}

.search-container input {
    padding-left: 2.5rem;
    border-radius: 20px;
    background-color: #fff;
    border: 1px solid var(--gray);
}

.search-container::before {
    content: '🔍';
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    opacity: 0.4;
    font-size: 0.9rem;
}

/* Highlight for description inputs */
.input-highlight,
input[name="foto_labels[]"],
input[name="carta_label"] {
    border: 2px solid var(--primary-color) !important;
    background-color: #f0f7ff !important;
    font-weight: bold !important;
    color: var(--primary-color) !important;
    font-size: 1.1rem !important;
    /* Larger text */
    padding: 12px !important;
    /* Bigger hit area */
    width: 100% !important;
}

.photo-row-static {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
    align-items: center;
    background: #f8f9fa;
    padding: 10px;
    border-radius: 4px;
}

/* Image Preview Modal */
.image-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s;
}

.image-modal-overlay.open {
    opacity: 1;
    visibility: visible;
}

.image-modal-content {
    max-width: 90%;
    max-height: 90vh;
    position: relative;
}

.image-modal-content img {
    max-width: 100%;
    max-height: 90vh;
    border-radius: 4px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.5);
}

.close-image-modal {
    position: absolute;
    top: -40px;
    right: 0;
    color: white;
    font-size: 2rem;
    cursor: pointer;
    font-weight: bold;
}

/* Confirm Buttons in Modal */
.modal-btn-group {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-top: 1.5rem;
}

.modal-btn.cancel {
    background: var(--secondary-color);
}

/* Visit Progress Bar */
.visit-progress-bar {
    background-color: #e0e0e0;
    border-radius: 4px;
    height: 10px;
    width: 100%;
    margin-top: 5px;
    overflow: hidden;
}

.visit-progress-fill {
    height: 100%;
    background-color: var(--success-color);
    /* Or a specific green/blue */
    transition: width 0.3s ease;
}