/* Variables */
:root {
    --primary-color: #2c3e50;
    --secondary-color: #34495e;
    --success: #27ae60;
    --warning: #f39c12;
    --error: #e74c3c;
    --info: #3498db;
    --text-primary: #2c3e50;
    --text-secondary: #7f8c8d;
    --border: #dfe6e9;
    --background: #f8f9fa;
    --surface: #ffffff;
}

/* Filters Section */
.filters-section {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 2px;
    padding: 16px 20px;
    margin-bottom: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.filters-row {
    display: flex;
    gap: 20px;
    align-items: center;
    flex-wrap: wrap;
}

.search-group {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    min-width: 250px;
}

.search-group label {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
}

.search-input {
    flex: 1;
    padding: 8px 12px;
    font-size: 0.875rem;
    border: 1px solid var(--border);
    border-radius: 2px;
    background: var(--surface);
    color: var(--text-primary);
    outline: none;
}

.search-input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(44, 62, 80, 0.1);
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 12px;
}

.filter-group label {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
}

.filter-select {
    padding: 8px 12px;
    font-size: 0.875rem;
    border: 1px solid var(--border);
    border-radius: 2px;
    background: var(--surface);
    color: var(--text-primary);
    cursor: pointer;
    outline: none;
}

.filter-select:focus {
    border-color: var(--primary-color);
}

.btn-create-planning {
    padding: 10px 20px;
    background: var(--success);
    color: white;
    border: none;
    border-radius: 2px;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
}

.btn-create-planning:hover {
    background: #229954;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(39, 174, 96, 0.2);
}

.btn-create-planning svg {
    width: 16px;
    height: 16px;
}

.stats {
    display: flex;
    gap: 20px;
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.875rem;
}

.stat-label {
    color: var(--text-secondary);
}

.stat-value {
    font-weight: 700;
    color: var(--primary-color);
}

/* Plannings List */
/* Planning Table */
.table-container {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 2px;
    overflow: hidden;
    margin-bottom: 20px;
}

.plannings-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.plannings-table thead {
    background: var(--background);
    border-bottom: 2px solid var(--border);
}

.plannings-table th {
    padding: 12px 16px;
    text-align: left;
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.813rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.plannings-table th.col-order-id {
    width: 100px;
}

.plannings-table td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

.planning-row:hover {
    background: rgba(52, 73, 94, 0.02);
}

.clickable-row {
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.clickable-row:hover {
    background: rgba(52, 73, 94, 0.05) !important;
}

.planning-order-id {
    font-weight: 600;
    color: var(--primary-color);
    white-space: nowrap;
    font-size: 0.875rem;
}

.planning-date {
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
}

.planning-status {
    text-align: center;
}

.status-badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 2px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.status-badge.initial {
    background: #e3f2fd;
    color: #1976d2;
}

.status-badge.placed {
    background: #e8f5e8;
    color: #2e7d32;
}

.planning-patient {
    font-weight: 500;
    color: var(--text-primary);
}

.planning-doctor {
    color: var(--text-secondary);
}

.planning-actions {
    text-align: center;
    white-space: nowrap;
}

.planning-actions {
    display: flex;
    gap: 8px;
    align-items: center;
    justify-content: center;
}


.planning-actions .btn-delete {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 32px !important;
    height: 32px !important;
    padding: 0 !important;
    margin: 0 !important;
    border: none !important;
    border-radius: 4px !important;
    cursor: pointer !important;
    transition: all 0.2s ease !important;
    font-size: 0 !important;
    line-height: 1 !important;
    background: #e74c3c !important;
    color: white !important;
}

.planning-actions .btn-delete:hover {
    background: #c0392b !important;
    transform: scale(1.05) !important;
}

.planning-actions svg {
    width: 16px !important;
    height: 16px !important;
    fill: white !important;
    stroke: none !important;
}

.btn-view {
    padding: 10px 20px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 2px;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-view:hover {
    background: var(--secondary-color);
    transform: translateY(-1px);
}

.btn-view svg {
    width: 16px;
    height: 16px;
}

.btn-delete {
    padding: 10px 20px;
    background: transparent;
    color: var(--error);
    border: 1px solid var(--error);
    border-radius: 2px;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-delete:hover {
    background: var(--error);
    color: white;
}

/* No Plannings */
.no-plannings {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 60px 20px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 2px;
}

.no-plannings svg {
    width: 64px;
    height: 64px;
    margin: 0 auto 20px;
    color: var(--text-secondary);
    opacity: 0.5;
}

.no-plannings h3 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 8px 0;
}

.no-plannings p {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin: 0;
}

/* Loading */
.loading {
    display: flex !important;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    gap: 16px;
    position: fixed !important;
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) !important;
    z-index: 9999 !important;
    background: rgba(255, 255, 255, 0.98) !important;
    border: 2px solid var(--primary-color) !important;
    border-radius: 12px !important;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2) !important;
    min-width: 200px !important;
    min-height: 120px !important;
}

.spinner {
    width: 48px;
    height: 48px;
    border: 4px solid var(--border);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

.loading p {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

/* Modal de Confirmación */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

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

.modal-content {
    background: var(--surface);
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    max-width: 400px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    transform: scale(0.9);
    transition: transform 0.3s ease;
}

.modal-overlay.show .modal-content {
    transform: scale(1);
}

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

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

.modal-close {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    color: var(--text-secondary);
    transition: all 0.2s ease;
}

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

.modal-close svg {
    width: 20px;
    height: 20px;
}

.modal-body {
    padding: 24px;
    text-align: center;
}

.confirm-icon {
    display: flex;
    justify-content: center;
    margin-bottom: 16px;
}

.confirm-icon svg {
    width: 48px;
    height: 48px;
    color: var(--warning);
}

.modal-body p {
    margin: 0;
    font-size: 1rem;
    color: var(--text-primary);
    line-height: 1.5;
}

.modal-footer {
    display: flex;
    gap: 12px;
    padding: 16px 24px 20px;
    justify-content: flex-end;
}

.btn-cancel,
.btn-confirm {
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 80px;
}

.btn-cancel {
    background: var(--background);
    color: var(--text-secondary);
    border: 1px solid var(--border);
}

.btn-cancel:hover {
    background: var(--border);
    color: var(--text-primary);
}

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

.btn-confirm:hover {
    background: #c0392b;
}

/* Pagination Section */
.pagination-section {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 2px;
    padding: 16px 20px;
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
}

.pagination-info {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.pagination-controls {
    display: flex;
    gap: 8px;
    align-items: center;
}

.btn-page {
    padding: 6px 12px;
    background: transparent;
    color: var(--text-primary);
    border: 1px solid var(--border);
    border-radius: 2px;
    font-size: 0.813rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-page:hover:not(:disabled) {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.btn-page:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.page-numbers {
    display: flex;
    gap: 4px;
}

.page-number {
    min-width: 32px;
    padding: 6px 8px;
    background: transparent;
    color: var(--text-primary);
    border: 1px solid var(--border);
    border-radius: 2px;
    font-size: 0.813rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
}

.page-number:hover {
    background: var(--background);
    border-color: var(--primary-color);
}

.page-number.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
    font-weight: 700;
}

.items-per-page {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.875rem;
}

.items-per-page label {
    color: var(--text-secondary);
}

/* Responsive */
@media (max-width: 768px) {
    .filters-section {
        padding: 12px;
    }

    .filters-row {
        flex-direction: column;
        align-items: stretch;
    }

    .search-group {
        min-width: 100%;
    }

    .btn-create-planning {
        width: 100%;
        justify-content: center;
    }

    .pagination-section {
        flex-direction: column;
        gap: 12px;
        padding: 12px;
    }

    .pagination-controls {
        flex-wrap: wrap;
        justify-content: center;
    }

    .btn-page {
        font-size: 0.75rem;
        padding: 6px 10px;
    }

    .page-numbers {
        order: -1;
        width: 100%;
        justify-content: center;
        margin-bottom: 8px;
    }

    .items-per-page {
        width: 100%;
        justify-content: center;
    }


    .table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .plannings-table {
        min-width: 600px;
    }
    
    .plannings-table th,
    .plannings-table td {
        padding: 8px 12px;
        font-size: 0.813rem;
    }
    
    .planning-actions .btn-delete {
        width: 28px !important;
        height: 28px !important;
    }
    
    .planning-actions svg {
        width: 14px !important;
        height: 14px !important;
    }

}

/* Loading en la tabla */
.loading-row {
    background: var(--surface);
}

.loading-cell {
    text-align: center;
    padding: 40px 20px !important;
    vertical-align: middle;
}

.loading-content {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    color: var(--text-secondary);
    font-size: 0.95rem;
    font-weight: 500;
}

.loading-spinner {
    width: 20px;
    height: 20px;
    border: 2px solid var(--border);
    border-top: 2px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

