/* ============================================
   Bnei Yerushalaim - Estilos
   Glassmorphism + Dark Gradients
   ============================================ */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --accent: #00ff87;
    --accent2: #60efff;
    --bg-start: #0f0c29;
    --bg-mid: #302b63;
    --bg-end: #24243e;
    --glass: rgba(255, 255, 255, 0.05);
    --glass-border: rgba(255, 255, 255, 0.1);
    --text-primary: #ffffff;
    --text-secondary: rgba(255, 255, 255, 0.7);
    --text-muted: rgba(255, 255, 255, 0.5);
    --danger: #ff4757;
    --warning: #ffaa00;
    --success: #00ff87;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, var(--bg-start), var(--bg-mid), var(--bg-end));
    min-height: 100vh;
    color: var(--text-primary);
    line-height: 1.6;
}

/* ============================================
   Header
   ============================================ */
.header {
    background: var(--glass);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--glass-border);
    padding: 1.5rem 0;
    position: sticky;
    top: 0;
    z-index: 1000;
}

.header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 2rem;
}

.header-content {
    flex: 1;
}

.logo {
    font-size: 1.75rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--accent), var(--accent2));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 0.25rem;
}

.tagline {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* Budget Widget */
.budget-widget {
    background: var(--glass);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 1rem;
    min-width: 250px;
}

.budget-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.5rem;
}

.budget-amount {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.budget-bar {
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    overflow: hidden;
}

.budget-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent), var(--accent2));
    transition: width 0.3s ease;
}

.budget-fill.warning {
    background: linear-gradient(90deg, var(--warning), #ff6b6b);
}

.budget-fill.danger {
    background: linear-gradient(90deg, var(--danger), #c0392b);
}

/* ============================================
   Container
   ============================================ */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

.main-container {
    display: grid;
    grid-template-columns: 250px 1fr;
    gap: 2rem;
    padding: 2rem 1.5rem;
}

/* ============================================
   Sidebar
   ============================================ */
.sidebar {
    background: var(--glass);
    backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 1.5rem;
    height: fit-content;
    position: sticky;
    top: 100px;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 2rem;
}

.nav-item {
    padding: 0.75rem 1rem;
    border-radius: 8px;
    color: var(--text-secondary);
    text-decoration: none;
    transition: all 0.3s ease;
    cursor: pointer;
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
}

.nav-item.active {
    background: rgba(0, 255, 135, 0.1);
    color: var(--accent);
    border: 1px solid rgba(0, 255, 135, 0.3);
}

/* ============================================
   Content Area
   ============================================ */
.content-area {
    min-height: 600px;
}

.view {
    display: none;
    animation: fadeIn 0.3s ease;
}

.view.active {
    display: block;
}

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

.view-header h2 {
    font-size: 2rem;
    background: linear-gradient(135deg, var(--accent), var(--accent2));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* ============================================
   Projects Grid
   ============================================ */
.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
}

.project-card {
    background: var(--glass);
    backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 1.5rem;
    transition: all 0.3s ease;
    cursor: pointer;
}

.project-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 32px rgba(0, 255, 135, 0.2);
    border-color: var(--accent);
}

.project-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1rem;
}

.project-name {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
}

.project-path {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.project-stats {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    margin-top: 1rem;
}

.stat-item {
    text-align: center;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--accent);
}

.stat-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
}

/* ============================================
   Forms
   ============================================ */
.request-form {
    background: var(--glass);
    backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 2rem;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--text-primary);
}

.required {
    color: var(--danger);
}

.form-control {
    width: 100%;
    padding: 0.75rem 1rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 1rem;
    font-family: inherit;
    transition: all 0.3s ease;
}

.form-control:focus {
    outline: none;
    border-color: var(--accent);
    background: rgba(255, 255, 255, 0.08);
    box-shadow: 0 0 0 3px rgba(0, 255, 135, 0.1);
}

.form-control::placeholder {
    color: var(--text-muted);
}

textarea.form-control {
    resize: vertical;
}

.hint {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

.form-actions {
    display: flex;
    gap: 1rem;
    margin-top: 2rem;
}

/* ============================================
   Buttons
   ============================================ */
.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: inherit;
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent), var(--accent2));
    color: var(--bg-start);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 255, 135, 0.4);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    border: 1px solid var(--glass-border);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: translateY(-2px);
}

.btn-danger {
    background: rgba(255, 71, 87, 0.2);
    color: var(--danger);
    border: 1px solid var(--danger);
}

.btn-danger:hover {
    background: rgba(255, 71, 87, 0.3);
}

.btn-block {
    width: 100%;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

/* ============================================
   Modal
   ============================================ */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    z-index: 2000;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--bg-mid);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
}

.modal-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--glass-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    font-size: 1.5rem;
    color: var(--text-primary);
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 2rem;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.modal-close:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: rotate(90deg);
}

.modal-body {
    padding: 1.5rem;
}

/* ============================================
   Toast Notifications
   ============================================ */
.toast {
    position: fixed;
    top: 20px;
    right: 20px;
    background: var(--glass);
    backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 1rem 1.5rem;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    z-index: 3000;
    display: none;
    animation: slideIn 0.3s ease;
}

.toast.show {
    display: flex;
}

.toast.success {
    border-left: 4px solid var(--success);
}

.toast.error {
    border-left: 4px solid var(--danger);
}

.toast.warning {
    border-left: 4px solid var(--warning);
}

.toast-content {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.toast-icon {
    font-size: 1.5rem;
}

.toast-message {
    color: var(--text-primary);
}

/* ============================================
   Loading States
   ============================================ */
.loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem;
    color: var(--text-secondary);
}

.spinner {
    width: 48px;
    height: 48px;
    border: 4px solid rgba(255, 255, 255, 0.1);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-bottom: 1rem;
}

/* ============================================
   Animations
   ============================================ */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes slideIn {
    from {
        transform: translateX(400px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ============================================
   Responsive
   ============================================ */
@media (max-width: 768px) {
    .main-container {
        grid-template-columns: 1fr;
    }

    .sidebar {
        position: static;
    }

    .projects-grid {
        grid-template-columns: 1fr;
    }

    .form-actions {
        flex-direction: column;
    }

    .btn {
        width: 100%;
    }
}

/* ============================================
   Batches (Lotes Inteligentes)
   ============================================ */
.batches-container {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-top: 1rem;
}

.batch-card {
    background: var(--glass);
    backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 1.5rem;
    transition: all 0.3s ease;
}

.batch-card:hover {
    border-color: var(--accent);
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.2);
}

.batch-card.batch-completed {
    border-color: var(--success);
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.1), rgba(5, 150, 105, 0.05));
}

.batch-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--glass-border);
}

.batch-header h5 {
    margin: 0;
    font-size: 1.1rem;
    color: var(--text-primary);
}

.batch-count {
    background: var(--accent);
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: 600;
}

.batch-files ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.batch-files li {
    padding: 0.75rem;
    margin-bottom: 0.5rem;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 8px;
    border-left: 3px solid var(--accent);
}

.batch-files li strong {
    color: var(--accent);
    font-family: 'Courier New', monospace;
}

.file-action {
    color: var(--text-muted);
    font-size: 0.85rem;
    text-transform: uppercase;
}

.batch-files li small {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.batch-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--glass-border);
}

.batch-status {
    flex: 1;
    font-size: 0.9rem;
}

.status-loading {
    color: var(--warning);
}

.status-success {
    color: var(--success);
    font-weight: 600;
}

.status-error {
    color: var(--danger);
    font-weight: 600;
}

.info-text {
    color: var(--text-muted);
    font-size: 0.95rem;
    margin: 0.5rem 0;
}

/* Batch button states */
.btn.btn-success {
    background: linear-gradient(135deg, var(--success), #059669);
    cursor: default;
}

.btn.btn-success:hover {
    background: linear-gradient(135deg, var(--success), #059669);
}

/* ============================================
   Image Upload & Preview
   ============================================ */

.badge {
    background: rgba(255, 193, 7, 0.2);
    color: #ffc107;
    padding: 2px 10px;
    border-radius: 6px;
    font-size: 0.7rem;
    font-weight: 600;
    margin-left: 8px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.form-control-file {
    display: block;
    width: 100%;
    padding: 1.5rem;
    border: 2px dashed var(--glass-border);
    border-radius: 12px;
    background: var(--glass);
    cursor: pointer;
    transition: all 0.3s ease;
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.form-control-file:hover {
    border-color: var(--accent);
    background: rgba(255, 255, 255, 0.08);
    transform: translateY(-2px);
}

.form-control-file:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(0, 255, 135, 0.1);
}

/* File input styling for browsers */
.form-control-file::file-selector-button {
    background: linear-gradient(135deg, var(--accent), var(--accent2));
    color: var(--bg-start);
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    margin-right: 1rem;
    transition: all 0.3s ease;
}

.form-control-file::file-selector-button:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 15px rgba(0, 255, 135, 0.3);
}

/* Image Preview Grid */
.image-preview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.preview-item {
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    background: var(--glass);
    backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    padding: 0.75rem;
    transition: all 0.3s ease;
}

.preview-item:hover {
    transform: translateY(-4px);
    border-color: var(--accent);
    box-shadow: 0 8px 25px rgba(0, 255, 135, 0.2);
}

.image-preview {
    width: 100%;
    height: 140px;
    object-fit: cover;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.05);
}

.preview-item .file-info {
    margin-top: 0.75rem;
}

.preview-item .file-name {
    font-size: 0.85rem;
    color: var(--text-primary);
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: block;
    margin-bottom: 0.25rem;
}

.preview-item .file-size {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.preview-item .remove-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(255, 71, 87, 0.9);
    backdrop-filter: blur(5px);
    border: none;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: all 0.2s ease;
    color: white;
    font-size: 1.2rem;
    line-height: 1;
    font-weight: bold;
}

.preview-item:hover .remove-btn {
    opacity: 1;
}

.preview-item .remove-btn:hover {
    background: rgba(255, 71, 87, 1);
    transform: scale(1.1);
}

/* Cost Analysis with Images */
.cost-breakdown {
    display: grid;
    gap: 1.5rem;
}

.cost-section {
    background: var(--glass);
    padding: 1.25rem;
    border-radius: 10px;
    border-left: 3px solid var(--accent);
}

.cost-section h4 {
    font-size: 1rem;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.cost-section p {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.image-cost-detail {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--glass-border);
}

.image-cost-detail h4 {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 0.75rem;
}

.image-cost-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.image-cost-item:last-child {
    border-bottom: none;
}

.image-name {
    flex: 1;
    font-size: 0.85rem;
    color: var(--text-secondary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.image-dims {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin: 0 1rem;
}

.image-tokens {
    font-size: 0.85rem;
    color: var(--accent);
    font-weight: 600;
}

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

.model-card {
    background: linear-gradient(135deg, rgba(156, 39, 176, 0.1), rgba(103, 58, 183, 0.1));
    padding: 1.25rem;
    border-radius: 10px;
    text-align: center;
    border: 1px solid var(--glass-border);
    transition: all 0.3s ease;
}

.model-card:hover {
    transform: translateY(-4px);
    border-color: var(--accent);
    box-shadow: 0 8px 25px rgba(156, 39, 176, 0.3);
}

.model-card h5 {
    font-size: 1rem;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.model-card .cost {
    font-size: 1.75rem;
    font-weight: bold;
    background: linear-gradient(135deg, var(--accent), var(--accent2));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin: 0.75rem 0;
}

.model-card small {
    color: var(--text-muted);
    font-size: 0.8rem;
}

/* ============================================
   Sub-Lotes Inteligentes
   ============================================ */

.batch-card.sub-batch {
    border-left: 3px solid var(--accent);
    background: linear-gradient(135deg, rgba(0, 255, 135, 0.02), rgba(96, 239, 255, 0.02));
}

.dependency-badge {
    display: inline-block;
    background: rgba(255, 193, 7, 0.2);
    color: #ffc107;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 600;
    margin-left: 8px;
    vertical-align: middle;
}

.batch-dependency-info {
    background: rgba(255, 193, 7, 0.1);
    border-left: 3px solid #ffc107;
    padding: 0.75rem;
    margin: 0.75rem 0;
    border-radius: 4px;
}

.batch-dependency-info small {
    color: var(--text-secondary);
    font-size: 0.85rem;
    line-height: 1.4;
}

.batch-dependency-info strong {
    color: var(--accent);
    font-weight: 600;
}

/* ============================================
   Request Type Buttons
   ============================================ */
.request-type-buttons {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
    margin-top: 0.5rem;
}

.request-type-btn {
    background: var(--glass);
    border: 2px solid var(--glass-border);
    border-radius: 12px;
    padding: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 0.5rem;
    color: var(--text-secondary);
}

.request-type-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: var(--accent);
    transform: translateY(-2px);
}

.request-type-btn.active {
    background: linear-gradient(135deg, rgba(0, 255, 135, 0.1), rgba(96, 239, 255, 0.1));
    border-color: var(--accent);
    color: var(--text-primary);
}

.request-type-btn .btn-icon {
    font-size: 2rem;
    line-height: 1;
}

.request-type-btn .btn-label {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-primary);
}

.request-type-btn .btn-hint {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.request-type-btn.active .btn-hint {
    color: var(--accent);
}

@media (max-width: 768px) {
    .request-type-buttons {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ============================================
   Template Textarea Styling
   ============================================ */
textarea.template-textarea {
    font-family: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, 'Courier New', monospace;
    font-size: 0.9rem;
    line-height: 1.6;
    color: var(--text-primary);
    letter-spacing: 0.02em;
    min-height: 400px;
}

textarea.template-textarea::placeholder {
    color: var(--text-secondary);
    opacity: 0.7;
    font-size: 0.88rem;
    line-height: 1.7;
}

/* Mejor contraste para el label dinámico */
#requestTextLabel {
    font-weight: 600;
    font-size: 1.05rem;
    color: var(--accent);
    display: inline-block;
    margin-bottom: 0.25rem;
}

#requestTextHint {
    color: var(--text-secondary);
    font-size: 0.875rem;
    margin-top: 0.5rem;
    padding: 0.5rem 0.75rem;
    background: rgba(0, 255, 135, 0.05);
    border-left: 3px solid var(--accent);
    border-radius: 4px;
}

/* ============================================
   HISTORIAL DE PETICIONES - Estilos Mejorados
   ============================================ */

/* Header con filtros */
.view-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.header-actions {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.project-filter {
    background: var(--glass);
    border: 1px solid var(--glass-border);
    color: var(--text-primary);
    padding: 0.75rem 1rem;
    border-radius: 8px;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 200px;
}

.project-filter:hover {
    border-color: var(--accent);
    background: rgba(255, 255, 255, 0.08);
}

.project-filter option {
    background: var(--bg-mid);
    color: var(--text-primary);
    padding: 0.5rem;
}

/* Stats Grid */
.history-stats {
    margin-bottom: 2rem;
}

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

.stat-card {
    background: var(--glass);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 1.25rem;
    text-align: center;
    transition: all 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-2px);
    border-color: var(--accent);
}

.stat-card.success {
    border-color: rgba(0, 255, 135, 0.3);
    background: rgba(0, 255, 135, 0.05);
}

.stat-card.warning {
    border-color: rgba(255, 170, 0, 0.3);
    background: rgba(255, 170, 0, 0.05);
}

.stat-card.danger {
    border-color: rgba(255, 71, 87, 0.3);
    background: rgba(255, 71, 87, 0.05);
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--accent), var(--accent2));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 0.25rem;
}

.stat-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Request Cards */
.history-request-card {
    background: var(--glass);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    transition: all 0.3s ease;
}

.history-request-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.history-request-card.success {
    border-left: 4px solid var(--success);
}

.history-request-card.warning {
    border-left: 4px solid var(--warning);
}

.history-request-card.danger {
    border-left: 4px solid var(--danger);
}

.history-request-card.secondary {
    border-left: 4px solid rgba(255, 255, 255, 0.3);
}

/* Card Header */
.history-card-header {
    margin-bottom: 1rem;
}

.history-card-title {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.history-card-title h3 {
    font-size: 1.25rem;
    color: var(--text-primary);
    margin: 0;
}

.history-card-meta {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.meta-item {
    font-size: 0.875rem;
    color: var(--text-secondary);
    padding: 0.25rem 0.75rem;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 6px;
}

.type-badge {
    background: rgba(0, 255, 135, 0.1);
    color: var(--accent);
    border: 1px solid rgba(0, 255, 135, 0.2);
}

/* Card Body */
.history-card-body {
    margin-bottom: 1rem;
}

.request-description {
    margin-bottom: 1rem;
}

.request-description p {
    color: var(--text-primary);
    line-height: 1.6;
    margin-bottom: 0.5rem;
}

.btn-link {
    background: none;
    border: none;
    color: var(--accent);
    cursor: pointer;
    font-size: 0.875rem;
    text-decoration: underline;
    padding: 0;
    transition: color 0.3s ease;
}

.btn-link:hover {
    color: var(--accent2);
}

/* Files Section */
.files-section {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
    padding: 1rem;
    margin-top: 1rem;
}

.files-section h4 {
    font-size: 0.95rem;
    color: var(--accent);
    margin-bottom: 0.75rem;
}

.files-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.files-list li {
    padding: 0.5rem 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

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

.file-path {
    font-family: 'Courier New', monospace;
    font-size: 0.875rem;
    color: var(--text-secondary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
}

.backup-indicator {
    font-size: 0.85rem;
    margin-left: 0.5rem;
}

.more-files {
    color: var(--text-muted);
    font-style: italic;
    font-size: 0.875rem;
}

/* Deliverable Section */
.deliverable-section {
    background: rgba(0, 255, 135, 0.05);
    border-left: 3px solid var(--accent);
    border-radius: 8px;
    padding: 1rem;
    margin-top: 1rem;
}

.deliverable-section h4 {
    font-size: 0.95rem;
    color: var(--accent);
    margin-bottom: 0.5rem;
}

.deliverable-section p {
    color: var(--text-secondary);
    font-size: 0.925rem;
    line-height: 1.6;
}

/* Card Footer */
.history-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    flex-wrap: wrap;
    gap: 1rem;
}

.footer-stats {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.stat-badge {
    font-size: 0.8rem;
    padding: 0.4rem 0.75rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    color: var(--text-secondary);
    white-space: nowrap;
}

.stat-badge-small {
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 4px;
    color: var(--text-muted);
}

.footer-actions {
    display: flex;
    gap: 0.5rem;
}

/* Modal para detalles */
.modal-content.large {
    max-width: 800px;
}

/* Modal fullscreen para detalles de petición */
.modal-content.fullscreen {
    width: 100%;
    max-width: 100%;
    height: 100%;
    max-height: 100%;
    border-radius: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
}

.modal-content.fullscreen .modal-header {
    flex-shrink: 0;
    padding: 1rem 2rem;
    margin-bottom: 0;
}

.modal-content.fullscreen .modal-body {
    flex: 1;
    max-height: none;
    overflow-y: auto;
    padding: 1.5rem 2rem;
}

.modal-content.fullscreen .detail-section {
    max-width: 1000px;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.modal-header h3 {
    margin: 0;
    font-size: 1.5rem;
}

.close-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 2rem;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.close-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

.modal-body {
    max-height: 70vh;
    overflow-y: auto;
    padding-right: 0.5rem;
}

/* Scroll personalizado para modal */
.modal-body::-webkit-scrollbar {
    width: 8px;
}

.modal-body::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
}

.modal-body::-webkit-scrollbar-thumb {
    background: var(--accent);
    border-radius: 4px;
}

.detail-section {
    margin-bottom: 1.5rem;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 8px;
}

.detail-section h4 {
    font-size: 1.1rem;
    color: var(--accent);
    margin-bottom: 0.75rem;
}

.request-full-text {
    background: rgba(0, 0, 0, 0.3);
    padding: 1rem;
    border-radius: 6px;
    color: var(--text-primary);
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    line-height: 1.6;
    white-space: pre-wrap;
    word-wrap: break-word;
    overflow-x: auto;
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
}

.info-item {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.info-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    padding-top: 1.5rem;
    margin-top: 1.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

/* Badge variants */
.badge-success {
    background: rgba(0, 255, 135, 0.2);
    color: var(--success);
    border: 1px solid rgba(0, 255, 135, 0.3);
}

.badge-warning {
    background: rgba(255, 170, 0, 0.2);
    color: var(--warning);
    border: 1px solid rgba(255, 170, 0, 0.3);
}

.badge-danger {
    background: rgba(255, 71, 87, 0.2);
    color: var(--danger);
    border: 1px solid rgba(255, 71, 87, 0.3);
}

.badge-secondary {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-secondary);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

/* Responsive para móviles */
@media (max-width: 768px) {
    .history-card-footer {
        flex-direction: column;
        align-items: stretch;
    }

    .footer-actions {
        width: 100%;
    }

    .footer-actions button {
        flex: 1;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .info-grid {
        grid-template-columns: 1fr;
    }

    .header-actions {
        width: 100%;
        flex-direction: column;
    }

    .project-filter {
        width: 100%;
    }
}

/* ============================================
   TDD Option with Tooltip
   ============================================ */
.tdd-option {
    background: var(--glass);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 1.25rem;
    transition: all 0.3s ease;
}

.tdd-option:hover {
    border-color: var(--accent);
    background: rgba(0, 255, 135, 0.05);
}

.tdd-checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
    user-select: none;
}

.tdd-checkbox {
    width: 20px;
    height: 20px;
    cursor: pointer;
    accent-color: var(--accent);
}

.tdd-label-text {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1rem;
    font-weight: 500;
    color: var(--text-primary);
}

/* Tooltip */
.tooltip-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    background: var(--accent);
    color: var(--bg-start);
    border-radius: 50%;
    font-size: 0.7rem;
    font-weight: bold;
    cursor: help;
    position: relative;
    transition: all 0.3s ease;
}

.tooltip-icon:hover {
    background: var(--accent2);
    transform: scale(1.1);
}

.tooltip-icon::before {
    content: attr(data-tooltip);
    position: absolute;
    bottom: calc(100% + 10px);
    left: 50%;
    transform: translateX(-50%);
    background: rgba(15, 12, 41, 0.98);
    color: var(--text-primary);
    padding: 0.75rem 1rem;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: normal;
    white-space: normal;
    width: 280px;
    line-height: 1.4;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    pointer-events: none;
    border: 1px solid var(--glass-border);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    z-index: 1000;
}

.tooltip-icon::after {
    content: '';
    position: absolute;
    bottom: calc(100% + 4px);
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: rgba(15, 12, 41, 0.98);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 1001;
}

.tooltip-icon:hover::before,
.tooltip-icon:hover::after {
    opacity: 1;
    visibility: visible;
}

/* Animation cuando el checkbox está marcado */
.tdd-checkbox:checked + .tdd-label-text {
    color: var(--accent);
}

.tdd-checkbox:checked ~ .tdd-label-text .tooltip-icon {
    background: var(--accent);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(0, 255, 135, 0.4);
    }
    50% {
        box-shadow: 0 0 0 8px rgba(0, 255, 135, 0);
    }
}

/* ============================================
   MODAL DE PROGRAMACIÓN DE LOTES
   ============================================ */

.schedule-modal {
    max-width: 600px;
    width: 90%;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.modal-header h3 {
    margin: 0;
    color: var(--text-primary);
    font-size: 1.5rem;
}

.modal-close {
    background: none;
    border: none;
    font-size: 2rem;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s ease;
}

.modal-close:hover {
    color: var(--text-primary);
}

.batch-info {
    background: rgba(0, 255, 135, 0.1);
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
    color: var(--text-primary);
}

.batch-info strong {
    color: var(--accent);
}

#modal-batch-name {
    color: var(--text-primary);
    font-weight: 600;
}

.schedule-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.schedule-option {
    display: block;
    position: relative;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid var(--border-color);
    border-radius: 12px;
    padding: 1.25rem;
    transition: all 0.3s ease;
}

.schedule-option:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: var(--accent);
}

.schedule-option input[type="radio"] {
    position: absolute;
    opacity: 0;
}

.schedule-option input[type="radio"]:checked ~ .option-content {
    opacity: 1;
}

.schedule-option input[type="radio"]:checked {
    opacity: 1;
}

.schedule-option input[type="radio"]:checked + .option-content {
    border-left-color: var(--accent);
}

.schedule-option:has(input:checked) {
    background: rgba(0, 255, 135, 0.1);
    border-color: var(--accent);
}

.option-content {
    padding-left: 0.5rem;
    border-left: 3px solid transparent;
    transition: border-color 0.3s ease;
}

.option-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}

.option-icon {
    font-size: 1.5rem;
}

.option-header strong {
    color: var(--text-primary);
    font-size: 1.1rem;
}

.option-description {
    margin: 0;
    color: var(--text-secondary);
    font-size: 0.95rem;
    line-height: 1.4;
}

.off-peak-time {
    color: var(--accent);
    font-weight: 600;
}

.datetime-picker {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    margin-top: 2rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

.status-scheduled {
    color: #ffa500;
    font-weight: 500;
}

/* ============================================
   PANEL DE CONFIGURACIÓN
   ============================================ */

.view-subtitle {
    margin-top: 0.5rem;
    color: var(--text-secondary);
    font-size: 0.95rem;
    font-weight: normal;
}

.settings-container {
    max-width: 900px;
}

.settings-form {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.settings-card {
    background: var(--card-background);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 2rem;
    transition: all 0.3s ease;
}

.settings-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
}

.settings-card h3 {
    margin: 0 0 0.5rem 0;
    color: var(--text-primary);
    font-size: 1.3rem;
    font-weight: 600;
}

.card-description {
    margin: 0 0 1.5rem 0;
    color: var(--text-secondary);
    font-size: 0.95rem;
    line-height: 1.5;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

.form-actions {
    display: flex;
    gap: 1rem;
    justify-content: flex-start;
    margin-top: 1rem;
}

.settings-info {
    background: var(--card-background);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.5rem 2rem;
    margin-top: 2rem;
}

.settings-info h4 {
    margin: 0 0 1rem 0;
    color: var(--text-primary);
    font-size: 1.1rem;
}

.settings-info ul {
    margin: 0;
    padding-left: 1.5rem;
    color: var(--text-secondary);
    line-height: 1.8;
}

.settings-info li {
    margin-bottom: 0.75rem;
}

.settings-info li strong {
    color: var(--text-primary);
}

@media (max-width: 768px) {
    .form-row {
        grid-template-columns: 1fr;
    }

    .settings-card {
        padding: 1.5rem;
    }

    .form-actions {
        flex-direction: column;
    }

    .form-actions .btn {
        width: 100%;
    }
}

/* ============================================
   LOTES EN MODAL DE DETALLES
   ============================================ */

.batches-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.batch-item {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1rem;
    transition: all 0.3s ease;
}

.batch-item:hover {
    background: rgba(255, 255, 255, 0.08);
    transform: translateX(4px);
}

.batch-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.batch-title {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.batch-title strong {
    color: var(--text-primary);
    font-size: 1rem;
}

.batch-cost {
    color: var(--accent);
    font-weight: 600;
    font-size: 0.9rem;
}

.batch-description {
    margin: 0.5rem 0 0 0;
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.5;
}

.batch-error {
    margin-top: 0.75rem;
    padding: 0.75rem;
    background: rgba(220, 38, 38, 0.1);
    border-left: 3px solid #dc2626;
    border-radius: 4px;
    font-size: 0.9rem;
}

.batch-error strong {
    color: #dc2626;
}

.batch-meta {
    margin-top: 0.5rem;
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.badge-info {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: 500;
}

/* ============================================
   MEJORAS HISTORIAL - VER MÁS / LOTES
   ============================================ */

.request-collapsed {
    max-height: 200px;
    overflow: hidden;
    position: relative;
}

.request-collapsed::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 40px;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.5));
    pointer-events: none;
}

.btn-expand-text {
    display: block;
    width: 100%;
    padding: 0.5rem;
    margin-top: 0.25rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    border-radius: 0 0 6px 6px;
    color: var(--accent);
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 500;
    transition: all 0.2s ease;
    text-align: center;
}

.btn-expand-text:hover {
    background: rgba(255, 255, 255, 0.1);
}

.batch-header-right {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-shrink: 0;
}

.batch-file-count {
    color: var(--text-secondary);
    font-size: 0.8rem;
    background: rgba(255, 255, 255, 0.08);
    padding: 0.15rem 0.5rem;
    border-radius: 10px;
}

.batch-files-details {
    margin-top: 0.5rem;
}

.batch-files-details[open] .batch-files-summary {
    margin-bottom: 0.5rem;
}

.batch-files-summary {
    cursor: pointer;
    color: var(--accent2, #60efff);
    font-size: 0.85rem;
    font-weight: 500;
    padding: 0.3rem 0;
    list-style: none;
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.batch-files-summary::-webkit-details-marker {
    display: none;
}

.batch-files-summary::before {
    content: '▶';
    font-size: 0.65rem;
    transition: transform 0.2s ease;
}

.batch-files-details[open] > .batch-files-summary::before {
    transform: rotate(90deg);
}

.batch-files-list {
    list-style: none;
    padding: 0;
    margin: 0;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 6px;
    padding: 0.5rem;
    max-height: 200px;
    overflow-y: auto;
}

.batch-files-list li {
    padding: 0.25rem 0.4rem;
    font-size: 0.8rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.batch-files-list li:last-child {
    border-bottom: none;
}

.batch-file-path {
    color: var(--text-primary);
    font-family: 'Courier New', monospace;
    font-size: 0.8rem;
    word-break: break-all;
}

.batch-file-action {
    color: var(--text-muted);
    font-size: 0.75rem;
    flex-shrink: 0;
}

.batch-actions-modal {
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--glass-border);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

/* ========================================
   ESTILOS PARA VISUALIZACIÓN USEE
   ======================================== */

/* Contenedor principal USEE */
.usee-proposal .stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin: 1rem 0;
}

.usee-proposal .stat-item {
    padding: 1rem;
    background: linear-gradient(135deg, #f3f4f6 0%, #e5e7eb 100%);
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.usee-proposal .stat-label {
    font-size: 0.85rem;
    color: #6b7280;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.usee-proposal .stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: #2563eb;
}

/* Piezas Container */
.piezas-container {
    display: grid;
    gap: 1.5rem;
    margin-top: 1rem;
}

/* Pieza Card */
.pieza-card {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
}

.pieza-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

.pieza-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid #f3f4f6;
}

.pieza-header h5 {
    margin: 0;
    color: var(--primary-color);
    font-size: 1.25rem;
}

.pieza-categoria {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 500;
}

.pieza-accion {
    margin-bottom: 1rem;
    padding: 0.75rem;
    background: #f9fafb;
    border-left: 4px solid #3b82f6;
    border-radius: 4px;
}

.pieza-descripcion {
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 1.5rem;
}

/* USEE Score Bar */
.usee-score {
    margin: 1.5rem 0;
    padding: 1rem;
    background: #f9fafb;
    border-radius: 8px;
}

.score-bar {
    height: 24px;
    background: #e5e7eb;
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 0.5rem;
}

.score-fill {
    height: 100%;
    background: linear-gradient(90deg, #10b981 0%, #059669 100%);
    transition: width 0.6s ease;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding-right: 0.5rem;
}

.score-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: #059669;
    margin-right: 0.5rem;
}

.score-label {
    color: var(--text-secondary);
    font-size: 0.85rem;
}

/* Compliance Grid */
.usee-compliance {
    margin: 1.5rem 0;
}

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

.compliance-item {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 1rem;
    background: white;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
}

.compliance-item.si {
    border-color: #10b981;
    background: rgba(16, 185, 129, 0.05);
}

.compliance-item.no {
    border-color: #ef4444;
    background: rgba(239, 68, 68, 0.05);
}

.compliance-item.parcial {
    border-color: #f59e0b;
    background: rgba(245, 158, 11, 0.05);
}

.compliance-icon {
    font-size: 1.5rem;
    flex-shrink: 0;
}

.compliance-content {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.compliance-content strong {
    color: var(--text-primary);
}

.compliance-content small {
    color: var(--text-secondary);
    font-size: 0.85rem;
    line-height: 1.4;
}

/* Viabilidad */
.viabilidad-info {
    margin: 1.5rem 0;
    padding: 1rem;
    background: #f9fafb;
    border-radius: 8px;
}

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

.viabilidad-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.viabilidad-item .label {
    font-weight: 500;
    color: var(--text-secondary);
}

.badge {
    padding: 0.375rem 0.75rem;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: 500;
    text-transform: capitalize;
}

.badge-bajo {
    background: #d1fae5;
    color: #065f46;
}

.badge-medio {
    background: #fed7aa;
    color: #92400e;
}

.badge-alto {
    background: #fecaca;
    color: #991b1b;
}

.razon-puntuacion {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-top: 0.5rem;
}

/* Details/Summary */
details {
    margin: 1rem 0;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    overflow: hidden;
}

summary {
    padding: 1rem;
    background: #f9fafb;
    cursor: pointer;
    font-weight: 600;
    color: var(--text-primary);
    user-select: none;
    transition: background 0.2s;
}

summary:hover {
    background: #f3f4f6;
}

details[open] summary {
    background: #e5e7eb;
    border-bottom: 1px solid #d1d5db;
}

/* Override para details dentro de modales (tema oscuro) */
.modal details {
    margin: 0.5rem 0;
    border: 1px solid var(--glass-border);
    background: rgba(15, 12, 41, 0.6);
}

.modal summary {
    padding: 0.75rem;
    background: transparent;
    color: var(--text-primary);
}

.modal summary:hover {
    background: rgba(255, 255, 255, 0.05);
}

.modal details[open] summary {
    background: rgba(255, 255, 255, 0.03);
    border-bottom: 1px solid var(--glass-border);
}

.details-content {
    padding: 1rem;
}

.details-content h6 {
    margin: 0 0 0.5rem 0;
    color: var(--primary-color);
    font-size: 0.95rem;
}

.details-content pre {
    background: #1f2937;
    color: #f9fafb;
    padding: 1rem;
    border-radius: 6px;
    overflow-x: auto;
    font-size: 0.85rem;
    margin: 0.5rem 0;
}

.details-content code {
    font-family: 'Courier New', monospace;
}

/* IO Section */
.io-section {
    margin-bottom: 1.5rem;
}

.io-section:last-child {
    margin-bottom: 0;
}

/* Use Cases */
.use-cases ul {
    margin: 0;
    padding-left: 1.5rem;
}

.use-cases li {
    margin: 0.5rem 0;
    line-height: 1.5;
}

/* Market Value */
.market-value {
    margin-top: 1rem;
    padding: 1rem;
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    border-radius: 8px;
    font-size: 0.95rem;
}

/* Subsections */
.subsection {
    margin: 1.5rem 0;
}

.subsection h5 {
    color: var(--primary-color);
    margin-bottom: 0.75rem;
    font-size: 1.1rem;
}

.subsection ul, .subsection ol {
    margin: 0.5rem 0;
    padding-left: 1.5rem;
}

.subsection li {
    margin: 0.5rem 0;
    line-height: 1.6;
}

/* Priority Sections */
.priority-high h5 {
    color: #dc2626;
}

.priority-medium h5 {
    color: #f59e0b;
}

/* Responsive */
@media (max-width: 768px) {
    .pieza-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }

    .compliance-grid,
    .viabilidad-grid,
    .stats-grid {
        grid-template-columns: 1fr;
    }
}

/* ===== COLA DE LOTES - PANEL DE PROGRESO ===== */
.queue-progress-panel {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 400px;
    max-height: 600px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    z-index: 10000;
    display: none;
    overflow: hidden;
}

.queue-progress-content {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.queue-progress-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.25rem;
    background: linear-gradient(135deg, var(--primary-color), #667eea);
    color: white;
}

.queue-progress-header h3 {
    margin: 0;
    font-size: 1.1rem;
}

.btn-close-progress {
    background: none;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: background 0.2s;
}

.btn-close-progress:hover {
    background: rgba(255, 255, 255, 0.2);
}

.queue-progress-body {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    max-height: 400px;
}

.queue-batch-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    margin-bottom: 0.5rem;
    background: #f8f9fa;
    border-radius: 8px;
    transition: all 0.3s;
}

.queue-batch-item.running {
    background: #e0f2fe;
    border-left: 4px solid #0ea5e9;
}

.queue-batch-item.completed {
    background: #dcfce7;
    border-left: 4px solid #22c55e;
}

.queue-batch-item.failed {
    background: #fee2e2;
    border-left: 4px solid #ef4444;
}

.queue-batch-item.cancelled {
    background: #f3f4f6;
    border-left: 4px solid #9ca3af;
    opacity: 0.6;
}

.queue-batch-status {
    font-size: 1.25rem;
    flex-shrink: 0;
}

.queue-batch-name {
    flex: 1;
    font-weight: 500;
    color: #1f2937;
}

.queue-batch-info {
    font-size: 0.85rem;
    color: #6b7280;
}

.queue-progress-footer {
    padding: 1rem 1.25rem;
    border-top: 1px solid #e5e7eb;
    background: #f9fafb;
}

.queue-progress-footer .btn-danger {
    width: 100%;
    background: #ef4444;
    color: white;
    border: none;
    padding: 0.75rem;
    border-radius: 6px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s;
}

.queue-progress-footer .btn-danger:hover {
    background: #dc2626;
}

/* Responsive para panel de progreso */
@media (max-width: 768px) {
    .queue-progress-panel {
        width: calc(100% - 40px);
        right: 20px;
        left: 20px;
    }
}

/* ============================================
   STORAGE BADGES (LOCAL / SHILO)
   ============================================ */

.badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-left: 0.5rem;
}

.badge-local {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    box-shadow: 0 2px 4px rgba(16, 185, 129, 0.3);
}

.badge-cloud {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: white;
    box-shadow: 0 2px 4px rgba(59, 130, 246, 0.3);
}

/* Ajuste de header de project card para badges */
.project-card .project-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid #e5e7eb;
}

.project-card .project-header h3 {
    margin: 0;
    font-size: 1.25rem;
    color: #1f2937;
}

/* Info de Shilo en modal */
.shilo-info {
    background: #f3f4f6;
    padding: 1rem;
    border-radius: 8px;
    margin: 1rem 0;
}

.shilo-info p {
    margin: 0.5rem 0;
    color: #374151;
}

.shilo-info p strong {
    color: #1f2937;
    font-weight: 600;
}

/* Acciones de Shilo en modal */
.shilo-actions {
    display: flex;
    gap: 0.75rem;
    margin: 1.5rem 0;
    flex-wrap: wrap;
}

.shilo-actions .btn {
    flex: 1;
    min-width: 150px;
}

/* Advertencia en formulario de Shilo */
.form-group small {
    display: block;
    margin-top: 0.5rem;
    font-size: 0.875rem;
    color: #6b7280;
}

.form-group small:has(⚠️) {
    color: #f59e0b;
    font-weight: 500;
}

/* Campos de storage type condicionalmente visibles */
#local-storage-fields,
#shilo-storage-fields {
    transition: all 0.3s ease;
}

/* Responsive para badges */
@media (max-width: 768px) {
    .project-card .project-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

    .badge {
        margin-left: 0;
        margin-top: 0.5rem;
    }

    .shilo-actions {
        flex-direction: column;
    }

    .shilo-actions .btn {
        width: 100%;
    }
}
