:root {
    --primary-color: #008e42;
    --primary-light: #2ab86f;
    --background: #f4f6f8;
    --card-bg: #ffffff;
    --text-main: #333333;
    --text-muted: #666666;
    --border-color: #e0e0e0;
    --danger: #d32f2f;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: 'Roboto', sans-serif;
    background-color: var(--background);
    color: var(--text-main);
}

.view {
    display: none;
    min-height: 100vh;
    flex-direction: column;
}

.view.active {
    display: flex;
}

/* =========================================
   LOGIN VIEW 
========================================= */
#login-view {
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.login-container {
    background: var(--card-bg);
    width: 100%;
    max-width: 400px;
    padding: 30px 20px;
    border-radius: 20px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
    text-align: center;
}

.logo-box {
    width: 60px;
    height: 60px;
    background-color: var(--primary-color);
    color: white;
    font-size: 32px;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    margin: 0 auto 20px auto;
}

.login-container h2 {
    color: var(--primary-color);
    margin-bottom: 5px;
}

.login-container p {
    color: var(--text-muted);
    font-size: 14px;
    margin-bottom: 25px;
}

.input-group {
    position: relative;
    margin-bottom: 10px;
}

.input-group i {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}

.input-group input {
    width: 100%;
    padding: 15px 15px 15px 45px;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    font-size: 16px;
    outline: none;
    transition: border-color 0.3s;
}

.input-group input:focus {
    border-color: var(--primary-color);
}

.btn-primary {
    width: 100%;
    padding: 15px;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.3s;
}

.btn-primary:active {
    background-color: #006e33;
}

.error-msg {
    color: var(--danger);
    font-size: 13px;
    margin-bottom: 15px;
    min-height: 18px;
}

/* Cargando spinner */
.loader-container {
    margin-top: 20px;
}
.spinner {
    width: 30px;
    height: 30px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 10px auto;
}
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* =========================================
   DISTRIBUCION VIEW
========================================= */
.top-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 15px 20px;
    background: var(--card-bg);
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    position: sticky;
    top: 0;
    z-index: 10;
}

.icon-btn {
    background: none;
    border: none;
    font-size: 20px;
    color: var(--text-main);
    cursor: pointer;
}

.header-title {
    font-size: 18px;
    color: var(--primary-color);
    font-weight: bold;
    flex: 1;
    text-align: center;
}

.logo-box-small {
    width: 35px;
    height: 35px;
    background-color: var(--primary-color);
    color: white;
    font-size: 18px;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
}

/* TABS CONTAINER */
.tabs-container {
    display: flex;
    border-bottom: 1px solid var(--border-color);
}
.tab-btn {
    flex: 1;
    background: transparent;
    border: none;
    padding: 12px;
    font-size: 14px;
    font-weight: bold;
    color: var(--text-muted);
    border-bottom: 3px solid transparent;
    cursor: pointer;
    transition: all 0.2s;
}
.tab-btn.active {
    color: var(--primary-color);
    border-bottom: 3px solid var(--primary-color);
}

.cards-container {
    flex: 1;
    padding: 15px;
    padding-bottom: 100px; /* Space for the bottom nav */
    overflow-y: auto;
}

/* CARDS */
.card {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 15px 15px 15px 20px;
    margin-bottom: 15px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    position: relative;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.1s;
}

.card:active {
    transform: scale(0.98);
}

.card::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 8px;
    background-color: var(--primary-light);
    border-radius: 12px 0 0 12px;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.guia-text {
    color: var(--primary-color);
    font-weight: bold;
    font-size: 15px;
}

.piezas-text {
    font-size: 13px;
    color: var(--text-main);
    font-weight: 500;
}

.card-body {
    font-size: 14px;
    line-height: 1.5;
}

.card-field {
    margin-bottom: 4px;
}
.card-field strong {
    color: var(--text-main);
}
.card-field span {
    color: var(--text-muted);
}

.recaudo-capsule {
    display: inline-flex;
    align-items: center;
    background-color: var(--primary-color);
    color: white;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: bold;
    margin-top: 10px;
}
.recaudo-capsule i {
    margin-right: 6px;
    font-size: 15px;
}

/* =========================================
   BOTTOM NAV 
========================================= */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--background); 
    display: flex;
    justify-content: space-around;
    align-items: center;
    padding: 15px 0;
}
/* Simulate the curved cut out */
.bottom-nav::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--card-bg);
    border-top-left-radius: 25px;
    border-top-right-radius: 25px;
    z-index: -1;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.05);
}

.nav-btn {
    background: none;
    border: none;
    font-size: 24px;
    color: var(--text-muted);
    padding: 10px;
    cursor: pointer;
}

.nav-center {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    top: -25px;
}

.fab-btn {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background-color: var(--primary-color);
    color: white;
    border: none;
    font-size: 24px;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 4px 10px rgba(0, 142, 66, 0.3);
    cursor: pointer;
}

.version-text {
    font-size: 10px;
    color: var(--text-main);
    margin-top: 5px;
    font-weight: bold;
}

/* =========================================
   GESTION VIEW
========================================= */
.gestion-actions {
    display: flex;
    gap: 10px;
}

.circle-btn {
    width: 35px;
    height: 35px;
    background-color: var(--primary-color);
    color: white;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    text-decoration: none;
    font-size: 16px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.gestion-container {
    flex: 1;
    overflow-y: auto;
    background: #e8f4ec; /* Light green tint matching screenshot */
    padding-bottom: 20px;
}

.card-detail-box {
    padding: 20px;
    border-bottom: 1px solid #d5e8dc;
}

.gestion-status-row {
    margin-top: 10px;
    display: flex;
    align-items: center;
}

.estado-gestion-group {
    margin-top: 20px;
}
.estado-gestion-group label {
    display: block;
    font-weight: bold;
    color: var(--text-muted);
    margin-bottom: 8px;
    font-size: 14px;
}
.form-select {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid #ccc;
    border-radius: 20px;
    font-size: 15px;
    background-color: white;
    outline: none;
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 15px center;
    background-size: 16px;
}

.gestion-form {
    background: white;
    padding: 25px 20px;
    border-top-left-radius: 20px;
    border-top-right-radius: 20px;
    min-height: 400px;
}

.evidencia-buttons {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.btn-evidencia {
    flex: 1;
    background-color: #55c776;
    color: white;
    border: none;
    padding: 12px;
    border-radius: 25px;
    font-weight: bold;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    cursor: pointer;
}

.form-group {
    margin-bottom: 15px;
}

.form-input {
    width: 100%;
    padding: 15px;
    border: 1px solid #ccc;
    border-radius: 20px;
    font-size: 15px;
    outline: none;
    font-family: inherit;
}
.form-input:focus {
    border-color: var(--primary-color);
}

textarea.form-input {
    border-radius: 15px;
    resize: none;
}

.floating-save {
    position: fixed;
    bottom: 85px; /* So it rests right above the bottom nav */
    left: 0;
    right: 0;
    display: flex;
    justify-content: center;
    z-index: 20;
}

.btn-grabar {
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 12px 40px;
    border-radius: 25px;
    font-size: 16px;
    font-weight: bold;
    box-shadow: 0 4px 10px rgba(0, 142, 66, 0.4);
    cursor: pointer;
}

.preview-container {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 15px;
}
.img-preview {
    position: relative;
    width: 60px;
    height: 60px;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid #ddd;
}
.img-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.img-remove {
    position: absolute;
    top: 2px;
    right: 2px;
    background: rgba(255,0,0,0.8);
    color: white;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 10px;
    cursor: pointer;
    font-weight: bold;
}

/* =========================================
   MODALS / LOADERS
========================================= */
.modal {
    display: none;
    position: fixed;
    z-index: 200;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    justify-content: center;
    align-items: center;
    padding: 20px;
}
.modal.show { 
    display: flex; 
}
.modal-content {
    background-color: #fff;
    padding: 25px;
    border-radius: 12px;
    width: 100%;
    max-width: 320px;
    position: relative;
    box-shadow: 0 4px 15px rgba(0,0,0,0.15);
}
